equal
deleted
inserted
replaced
80 |
80 |
81 struct SortableEntry |
81 struct SortableEntry |
82 { |
82 { |
83 TRofsEntry* iEntry; |
83 TRofsEntry* iEntry; |
84 TBool iIsDir; |
84 TBool iIsDir; |
85 TUint32 iOffset; |
85 TUint16 iOffset; |
86 }; |
86 }; |
87 |
87 |
88 int compare(const void* l, const void* r) |
88 int compare(const void* l, const void* r) |
89 { |
89 { |
90 const SortableEntry* left = (const SortableEntry*)l; |
90 const SortableEntry* left = (const SortableEntry*)l; |
619 if( node->IsFile() ) |
619 if( node->IsFile() ) |
620 { |
620 { |
621 entry = pFileEntry; |
621 entry = pFileEntry; |
622 |
622 |
623 //Offset in 32bit words from start of file block |
623 //Offset in 32bit words from start of file block |
624 array[index].iOffset = (TUint32) ((((TUint8*) entry) - fileBlockBase) >> 2); |
624 TUint32 offset = ((((TUint8*) entry) - fileBlockBase) >> 2); |
|
625 |
|
626 if(offset > 0xFFFF) |
|
627 { |
|
628 printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset); |
|
629 throw "fail"; |
|
630 } |
|
631 |
|
632 |
|
633 array[index].iOffset = (TUint16) offset; |
625 array[index].iIsDir = EFalse; |
634 array[index].iIsDir = EFalse; |
626 } |
635 } |
627 else |
636 else |
628 { |
637 { |
629 entry = pDirEntry; |
638 entry = pDirEntry; |
630 |
639 |
|
640 TUint32 offset = ((((TUint8*) entry) - dirBlockBase) >> 2); |
|
641 if(offset > 0xFFFF) |
|
642 { |
|
643 printf("ERROR: Offset overflow: name=%s, OFFSET = %d\n", node->iName, offset); |
|
644 throw "fail"; |
|
645 } |
|
646 |
631 //Offset in 32bit words from start of directory block |
647 //Offset in 32bit words from start of directory block |
632 array[index].iOffset = (TUint32) ((((TUint8*) entry) - dirBlockBase) >> 2); |
648 array[index].iOffset = (TUint16) offset; |
633 array[index].iIsDir = ETrue; |
649 array[index].iIsDir = ETrue; |
634 } |
650 } |
635 array[index].iEntry = entry; |
651 array[index].iEntry = entry; |
636 index++; |
652 index++; |
637 entry->iNameOffset = KRofsEntryNameOffset; |
653 entry->iNameOffset = KRofsEntryNameOffset; |