Skip to content

Commit

Permalink
Make it work for 32 bits platform with _FILE_OFFSET_BITS=64
Browse files Browse the repository at this point in the history
  • Loading branch information
jief committed Jun 16, 2018
1 parent 7ac55ec commit 4ec4d05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hfs/hfslib.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ void hfs_ls(Volume* volume, const char* path) {
printf("No such file or directory\n");
}

printf("Total filesystem size: %d, free: %d\n", (volume->volumeHeader->totalBlocks - volume->volumeHeader->freeBlocks) * volume->volumeHeader->blockSize, volume->volumeHeader->freeBlocks * volume->volumeHeader->blockSize);
printf("Total filesystem size: %lld, free: %lld\n", ((uint64_t)(volume->volumeHeader->totalBlocks - volume->volumeHeader->freeBlocks)) * volume->volumeHeader->blockSize, ((uint64_t)volume->volumeHeader->freeBlocks) * volume->volumeHeader->blockSize); // cast to uint64_t to be plateform independant.

free(record);
}
Expand Down
4 changes: 2 additions & 2 deletions hfs/rawfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ static int rawFileRead(io_func* io,off_t location, size_t size, void *buffer) {
possible = extent->blockCount * blockSize - locationInBlock;

if(size > possible) {
ASSERT(READ(volume->image, extent->startBlock * blockSize + locationInBlock, possible, buffer), "READ");
ASSERT(READ(volume->image, ((off_t)extent->startBlock) * blockSize + locationInBlock, possible, buffer), "READ");
size -= possible;
buffer = (void*)(((size_t)buffer) + possible);
extent = extent->next;
} else {
ASSERT(READ(volume->image, extent->startBlock * blockSize + locationInBlock, size, buffer), "READ");
ASSERT(READ(volume->image, ((off_t)extent->startBlock) * blockSize + locationInBlock, size, buffer), "READ");
break;
}

Expand Down

0 comments on commit 4ec4d05

Please sign in to comment.