hrev45635 adds 3 changesets to branch 'master' old head: a1566b06b7b53d14fa53c169b0989925c54fd69d new head: 3f5d1e78252bb593cf5b430f37c3d18d779afab1 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=3f5d1e7+%5Ea1566b0 ---------------------------------------------------------------------------- 267a780: btrfs: fixes 64 bit warnings 575eeda: cdda: fixes 64 bit warnings 3f5d1e7: exfat: fixes 64 bit warnings [ Jérôme Duval <jerome.duval@xxxxxxxxx> ] ---------------------------------------------------------------------------- 17 files changed, 150 insertions(+), 134 deletions(-) .../kernel/file_systems/btrfs/Attribute.cpp | 4 +- .../kernel/file_systems/btrfs/BPlusTree.cpp | 30 ++++++------ src/add-ons/kernel/file_systems/btrfs/Chunk.cpp | 18 ++++---- .../file_systems/btrfs/DirectoryIterator.cpp | 4 +- src/add-ons/kernel/file_systems/btrfs/Inode.cpp | 31 +++++++------ src/add-ons/kernel/file_systems/btrfs/Volume.cpp | 48 +++++++++++--------- .../file_systems/btrfs/kernel_interface.cpp | 8 ++-- src/add-ons/kernel/file_systems/cdda/cdda.cpp | 6 +-- .../file_systems/cdda/kernel_interface.cpp | 24 +++++----- .../kernel/file_systems/exfat/DataStream.cpp | 4 +- .../file_systems/exfat/DirectoryIterator.cpp | 18 ++++---- src/add-ons/kernel/file_systems/exfat/Inode.cpp | 15 +++--- src/add-ons/kernel/file_systems/exfat/Inode.h | 2 +- src/add-ons/kernel/file_systems/exfat/Volume.cpp | 18 ++++---- .../kernel/file_systems/exfat/encodings.cpp | 40 ++++++++-------- .../kernel/file_systems/exfat/encodings.h | 6 +-- .../file_systems/exfat/kernel_interface.cpp | 8 ++-- ############################################################################ Commit: 267a780ab5ba7e7774dc6b4a6d391ab3cfbb9f78 URL: http://cgit.haiku-os.org/haiku/commit/?id=267a780 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Mon May 6 16:42:13 2013 UTC btrfs: fixes 64 bit warnings ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp b/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp index abc0fc5..d6be6d3 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp @@ -162,8 +162,8 @@ Attribute::_Lookup(const char* name, size_t nameLength, status_t status = fInode->GetVolume()->FSTree()->FindExact(key, (void**)&entries, &length); if (status != B_OK) { - TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %lu " - "\"%s\"\n", hash, name); + TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %" + B_PRIu32 " \"%s\"\n", hash, name); return status; } diff --git a/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp index 0460962..0f1bf01 100644 --- a/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp @@ -89,14 +89,14 @@ status_t BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, bplustree_traversing type) { - TRACE("Find() objectid %lld type %d offset %lld \n", key.ObjectID(), - key.Type(), key.Offset()); + TRACE("Find() objectid %" B_PRId64 " type %d offset %" B_PRId64 " \n", + key.ObjectID(), key.Type(), key.Offset()); btrfs_stream *stream = fStream; CachedBlock cached(fVolume); fsblock_t physical; if (stream == NULL) { if (fVolume->FindBlock(fRootBlock, physical) != B_OK) { - ERROR("Find() unmapped block %lld\n", fRootBlock); + ERROR("Find() unmapped block %" B_PRId64 "\n", fRootBlock); return B_ERROR; } stream = (btrfs_stream *)cached.SetTo(physical); @@ -107,19 +107,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, uint32 i = 1; for (; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(stream->index[i].key, key); - TRACE("Find() found index %ld at %lld comp %ld\n", i, - stream->index[i].BlockNum(), comp); + TRACE("Find() found index %" B_PRIu32 " at %" B_PRId64 " comp %" + B_PRId32 "\n", i, stream->index[i].BlockNum(), comp); if (comp < 0) continue; if (comp > 0 || type == BPLUSTREE_BACKWARD) break; } - TRACE("Find() getting index %ld at %lld\n", i - 1, + TRACE("Find() getting index %" B_PRIu32 " at %" B_PRId64 "\n", i - 1, stream->index[i - 1].BlockNum()); if (fVolume->FindBlock(stream->index[i - 1].BlockNum(), physical) != B_OK) { - ERROR("Find() unmapped block %lld\n", + ERROR("Find() unmapped block %" B_PRId64 "\n", stream->index[i - 1].BlockNum()); return B_ERROR; } @@ -128,18 +128,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, uint32 i; #ifdef TRACE_BTRFS - TRACE("Find() dump count %ld\n", stream->header.ItemCount()); + TRACE("Find() dump count %" B_PRId32 "\n", stream->header.ItemCount()); for (i = 0; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(key, stream->entries[i].key); - TRACE("Find() dump %ld %ld offset %lld comp %ld\n", - stream->entries[i].Offset(), + TRACE("Find() dump %" B_PRIu32 " %" B_PRIu32 " offset %" B_PRId64 + " comp %" B_PRId32 "\n", stream->entries[i].Offset(), stream->entries[i].Size(), stream->entries[i].key.Offset(), comp); } #endif for (i = 0; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(key, stream->entries[i].key); - TRACE("Find() found %ld %ld oid %lld type %d offset %lld comp %ld\n", + TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 " oid %" B_PRId64 + " type %d offset %" B_PRId64 " comp %" B_PRId32 "\n", stream->entries[i].Offset(), stream->entries[i].Size(), stream->entries[i].key.ObjectID(), stream->entries[i].key.Type(), stream->entries[i].key.Offset(), comp); @@ -163,8 +164,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, if (i < stream->header.ItemCount() && stream->entries[i].key.Type() == key.Type()) { - TRACE("Find() found %ld %ld\n", stream->entries[i].Offset(), - stream->entries[i].Size()); + TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 "\n", + stream->entries[i].Offset(), stream->entries[i].Size()); if (_value != NULL) { *_value = malloc(stream->entries[i].Size()); memcpy(*_value, ((uint8 *)&stream->entries[0] @@ -178,7 +179,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, } - TRACE("Find() not found %lld %lld\n", key.Offset(), key.ObjectID()); + TRACE("Find() not found %" B_PRId64 " %" B_PRId64 "\n", key.Offset(), + key.ObjectID()); return B_ENTRY_NOT_FOUND; } diff --git a/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp b/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp index d9b39e2..95d82a4 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp @@ -35,13 +35,15 @@ Chunk::Chunk(struct btrfs_chunk* chunk, fsblock_t offset) memcpy(fChunk, chunk, sizeof(struct btrfs_chunk) + chunk->StripeCount() * sizeof(struct btrfs_stripe)); - TRACE("chunk[0] length %llu owner %llu stripe_length %llu type %llu " - "stripe_count %u sub_stripes %u sector_size %lu\n", chunk->Length(), - chunk->Owner(), chunk->StripeLength(), chunk->Type(), - chunk->StripeCount(), chunk->SubStripes(), chunk->SectorSize()); + TRACE("chunk[0] length %" B_PRIu64 " owner %" B_PRIu64 " stripe_length %" + B_PRIu64 " type %" B_PRIu64 " stripe_count %u sub_stripes %u " + "sector_size %" B_PRIu32 "\n", chunk->Length(), chunk->Owner(), + chunk->StripeLength(), chunk->Type(), chunk->StripeCount(), + chunk->SubStripes(), chunk->SectorSize()); for(int32 i = 0; i < chunk->StripeCount(); i++) { - TRACE("chunk.stripe[%ld].physical %lld deviceid %lld\n", i, - chunk->stripes[i].Offset(), chunk->stripes[i].DeviceID()); + TRACE("chunk.stripe[%" B_PRId32 "].physical %" B_PRId64 " deviceid %" + B_PRId64 "\n", i, chunk->stripes[i].Offset(), + chunk->stripes[i].DeviceID()); } } @@ -66,8 +68,8 @@ Chunk::FindBlock(off_t logical, off_t &physical) if (fChunk == NULL) return B_NO_INIT; - if (logical < fChunkOffset - || logical > (fChunkOffset + fChunk->Length())) + if (logical < (off_t)fChunkOffset + || logical > (off_t)(fChunkOffset + fChunk->Length())) return B_BAD_VALUE; // only one stripe diff --git a/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp b/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp index 6ea6524..01eb988 100644 --- a/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp @@ -132,8 +132,8 @@ DirectoryIterator::Lookup(const char* name, size_t nameLength, ino_t* _id) status_t status = fInode->GetVolume()->FSTree()->FindExact(key, (void**)&entries, &length); if (status != B_OK) { - TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %lu " - "\"%s\"\n", hash, name); + TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %" B_PRIu32 + " \"%s\"\n", hash, name); return status; } diff --git a/src/add-ons/kernel/file_systems/btrfs/Inode.cpp b/src/add-ons/kernel/file_systems/btrfs/Inode.cpp index 6c231f0..757353f 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Inode.cpp @@ -133,7 +133,6 @@ Inode::CheckPermissions(int accessMode) const } return (accessMode & ~permissions) == 0 ? B_OK : B_NOT_ALLOWED; - return B_OK; } @@ -149,12 +148,13 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length) status_t status = fVolume->FSTree()->FindPrevious(search_key, (void**)&extent_data); if (status != B_OK) { - ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status); + ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32 + "\n", status); return status; } - TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %lld\n", ID(), - search_key.Offset()); + TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n", + ID(), search_key.Offset()); off_t diff = pos - search_key.Offset(); off_t logical = 0; @@ -165,8 +165,8 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length) status = fVolume->FindBlock(logical, physical); if (_length != NULL) *_length = extent_data->Size() - diff; - TRACE("Inode::FindBlock(%" B_PRIdINO ") %lld physical %lld\n", ID(), - pos, physical); + TRACE("Inode::FindBlock(%" B_PRIdINO ") %" B_PRIdOFF " physical %" + B_PRIdOFF "\n", ID(), pos, physical); free(extent_data); return status; @@ -180,14 +180,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) // set/check boundaries for pos/length if (pos < 0) { - ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n", - ID(), pos, length); + ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF + ", length %lu)\n", ID(), pos, length); return B_BAD_VALUE; } if (pos >= Size() || length == 0) { - TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n", - ID(), pos, length); + TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF + ", length %lu)\n", ID(), pos, length); *_length = 0; return B_NO_ERROR; } @@ -204,14 +204,15 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) status_t status = fVolume->FSTree()->FindPrevious(search_key, (void**)&extent_data, &item_size); if (status != B_OK) { - ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status); + ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32 + "\n", status); return status; } uint8 compression = extent_data->Compression(); if (FileCache() != NULL && extent_data->Type() == BTRFS_EXTENT_DATA_REGULAR) { - TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %lld, length %lu)\n", + TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %" B_PRIdOFF ", length %lu)\n", ID(), pos, length); free(extent_data); if (compression == BTRFS_EXTENT_COMPRESS_NONE) @@ -222,7 +223,7 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) panic("unknown extent compression; %d\n", compression); } - TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %lld\n", ID(), + TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n", ID(), search_key.Offset()); off_t diff = pos - search_key.Offset(); @@ -256,8 +257,8 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) size_t inline_size = item_size - 13; bool headerRead = false; - TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %lld size %ld\n", ID(), - diff, item_size); + TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %" B_PRIdOFF " size %" + B_PRIuSIZE "\n", ID(), diff, item_size); do { ssize_t bytesRead = min_c(sizeof(in), inline_size - offset); diff --git a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp index 0afac4c..5b99447 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp @@ -278,14 +278,15 @@ Volume::Mount(const char* deviceName, uint32 flags) } fBlockSize = fSuperBlock.BlockSize(); - TRACE("block size %ld\n", fBlockSize); + TRACE("block size %" B_PRIu32 "\n", fBlockSize); uint8* start = (uint8*)&fSuperBlock.system_chunk_array[0]; uint8* end = (uint8*)&fSuperBlock.system_chunk_array[2048]; while (start < end) { struct btrfs_key* key = (struct btrfs_key*)start; - TRACE("system_chunk_array object_id 0x%llx offset 0x%llx type 0x%x\n", - key->ObjectID(), key->Offset(), key->Type()); + TRACE("system_chunk_array object_id 0x%" B_PRIx64 " offset 0x%" + B_PRIx64 " type 0x%x\n", key->ObjectID(), key->Offset(), + key->Type()); if (key->Type() != BTRFS_KEY_TYPE_CHUNK_ITEM) { break; } @@ -297,16 +298,17 @@ Volume::Mount(const char* deviceName, uint32 flags) start += sizeof(struct btrfs_key) + fChunk->Size(); } - TRACE("Volume::Mount() generation: %lld\n", fSuperBlock.Generation()); + TRACE("Volume::Mount() generation: %" B_PRIu64 "\n", + fSuperBlock.Generation()); fsblock_t physical = 0; FindBlock(fSuperBlock.Root(), physical); - TRACE("Volume::Mount() root: %lld (physical %lld)\n", + TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.Root(), physical); FindBlock(fSuperBlock.ChunkRoot(), physical); - TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n", - fSuperBlock.ChunkRoot(), physical); + TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64 + ")\n", fSuperBlock.ChunkRoot(), physical); FindBlock(fSuperBlock.LogRoot(), physical); - TRACE("Volume::Mount() log_root: %lld (physical %lld)\n", + TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.LogRoot(), physical); // check if the device size is large enough to hold the file system @@ -329,13 +331,13 @@ Volume::Mount(const char* deviceName, uint32 flags) return B_NO_MEMORY; FindBlock(fSuperBlock.Root(), physical); - TRACE("Volume::Mount() root: %lld (physical %lld)\n", + TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.Root(), physical); FindBlock(fSuperBlock.ChunkRoot(), physical); - TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n", - fSuperBlock.ChunkRoot(), physical); + TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64 + ")\n", fSuperBlock.ChunkRoot(), physical); FindBlock(fSuperBlock.LogRoot(), physical); - TRACE("Volume::Mount() log_root: %lld (physical %lld)\n", + TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.LogRoot(), physical); fRootTree = new(std::nothrow) BPlusTree(this, fSuperBlock.Root()); @@ -351,7 +353,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find extent root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found extent root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found extent root: %" B_PRIu64 "\n", + root->BlockNum()); fExtentTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fExtentTree == NULL) @@ -363,7 +366,7 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find fs root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found fs root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found fs root: %" B_PRIu64 "\n", root->BlockNum()); fFSTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fFSTree == NULL) @@ -375,7 +378,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find dev root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found dev root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found dev root: %" B_PRIu64 "\n", + root->BlockNum()); fDevTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fDevTree == NULL) @@ -387,7 +391,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find checksum root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found checksum root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found checksum root: %" B_PRIu64 "\n", + root->BlockNum()); fChecksumTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fChecksumTree == NULL) @@ -401,8 +406,8 @@ Volume::Mount(const char* deviceName, uint32 flags) return status; } - TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(), - strerror(fRootNode->InitCheck())); + TRACE("Volume::Mount(): Found root node: %" B_PRIu64 " (%s)\n", + fRootNode->ID(), strerror(fRootNode->InitCheck())); // all went fine opener.Keep(); @@ -488,7 +493,8 @@ status_t Volume::FindBlock(off_t logical, off_t &physical) { if (fChunkTree == NULL - || (logical >= fChunk->Offset() && logical < fChunk->End())) { + || (logical >= (off_t)fChunk->Offset() + && logical < (off_t)fChunk->End())) { // try with fChunk return fChunk->FindBlock(logical, physical); } @@ -509,8 +515,8 @@ Volume::FindBlock(off_t logical, off_t &physical) status = _chunk.FindBlock(logical, physical); if (status != B_OK) return status; - TRACE("Volume::FindBlock(): logical: %lld, physical: %lld\n", logical, - physical); + TRACE("Volume::FindBlock(): logical: %" B_PRIdOFF ", physical: %" B_PRIdOFF + "\n", logical, physical); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp index eaac2c9..1de0f48 100644 --- a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp @@ -235,7 +235,7 @@ btrfs_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, while (true) { file_io_vec fileVecs[8]; - uint32 fileVecCount = 8; + size_t fileVecCount = 8; status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs, &fileVecCount, 0); @@ -321,10 +321,10 @@ btrfs_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, offset += blockLength; size -= blockLength; - if (size <= vecs[index - 1].length || offset >= inode->Size()) { + if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) { // We're done! *_count = index; - TRACE("btrfs_get_file_map for inode %lld\n", inode->ID()); + TRACE("btrfs_get_file_map for inode %" B_PRIdINO "\n", inode->ID()); return B_OK; } } @@ -362,7 +362,7 @@ static status_t btrfs_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, void* buffer, size_t bufferLength) { - TRACE("ioctl: %lu\n", cmd); + TRACE("ioctl: %" B_PRIu32 "\n", cmd); /*Volume* volume = (Volume*)_volume->private_volume;*/ return B_DEV_INVALID_IOCTL; ############################################################################ Commit: 575eeda9a5ac082851be3e158f26b89a1cedccbd URL: http://cgit.haiku-os.org/haiku/commit/?id=575eeda Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Mon May 6 17:05:30 2013 UTC cdda: fixes 64 bit warnings ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/file_systems/cdda/cdda.cpp b/src/add-ons/kernel/file_systems/cdda/cdda.cpp index 77320a9..605b5ca 100644 --- a/src/add-ons/kernel/file_systems/cdda/cdda.cpp +++ b/src/add-ons/kernel/file_systems/cdda/cdda.cpp @@ -557,7 +557,7 @@ read_cdtext(int fd, struct cdtext &cdtext) scsi_toc_general *header = (scsi_toc_general *)buffer; - size_t packLength = B_BENDIAN_TO_HOST_INT16(header->data_length) - 2; + uint32 packLength = B_BENDIAN_TO_HOST_INT16(header->data_length) - 2; cdtext_pack_data *pack = (cdtext_pack_data *)(header + 1); cdtext_pack_data *lastPack = NULL; uint8 state = 0; @@ -656,8 +656,8 @@ status_t read_cdda_data(int fd, off_t endFrame, off_t offset, void *data, size_t length, off_t bufferOffset, void *buffer, size_t bufferSize) { - if (bufferOffset >= 0 && bufferOffset <= offset + length - && bufferOffset + bufferSize > offset) { + if (bufferOffset >= 0 && bufferOffset <= offset + (off_t)length + && bufferOffset + (off_t)bufferSize > offset) { if (offset >= bufferOffset) { // buffer reaches into the beginning of the request off_t dataOffset = offset - bufferOffset; diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index 1a78ad4..9ad8195 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -153,7 +153,7 @@ public: status_t SetSize(off_t size); const char* Name() const { return fName; } - size_t Size() const { return fSize; } + off_t Size() const { return fSize; } type_code Type() const { return fType; } uint8* Data() const { return fData; } @@ -164,7 +164,7 @@ private: char* fName; type_code fType; uint8* fData; - size_t fSize; + off_t fSize; }; class Inode { @@ -473,7 +473,7 @@ open_attributes(uint32 cddbID, int deviceFD, int mode, if (attrMode == kDiscIDAttributes) { char id[64]; - snprintf(id, sizeof(id), "/%08lx", cddbID); + snprintf(id, sizeof(id), "/%08" B_PRIx32, cddbID); strlcat(path, id, B_PATH_NAME_LENGTH); } else if (attrMode == kDeviceAttributes) { uint32 length = strlen(path); @@ -690,14 +690,14 @@ Volume::Mount(const char* device) if (text.titles[i] != NULL) { if (text.artists[i] != NULL) { - snprintf(title, sizeof(title), "%02ld. %s - %s.wav", track, - text.artists[i], text.titles[i]); + snprintf(title, sizeof(title), "%02" B_PRId32 ". %s - %s.wav", + track, text.artists[i], text.titles[i]); } else { - snprintf(title, sizeof(title), "%02ld. %s.wav", track, - text.titles[i]); + snprintf(title, sizeof(title), "%02" B_PRId32 ". %s.wav", + track, text.titles[i]); } } else - snprintf(title, sizeof(title), "Track %02ld.wav", track); + snprintf(title, sizeof(title), "Track %02" B_PRId32 ".wav", track); // remove '/' and '\n' from title for (int32 j = 0; title[j]; j++) { @@ -722,7 +722,7 @@ Volume::Mount(const char* device) inode->AddAttribute("Audio:Track", B_INT32_TYPE, (uint32)track); inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1411 kbps"); inode->AddAttribute("Media:Length", B_INT64_TYPE, - inode->FrameCount() * 1000000LL / kFramesPerSecond); + inode->FrameCount() * 1000000L / kFramesPerSecond); inode->AddAttribute("BEOS:TYPE", B_MIME_STRING_TYPE, "audio/x-wav"); } @@ -1044,7 +1044,7 @@ Attribute::ReadAt(off_t offset, uint8* buffer, size_t* _length) *_length = 0; return B_OK; } - if (offset + length > fSize) + if (offset + (off_t)length > fSize) length = fSize - offset; if (user_memcpy(buffer, fData + offset, length) < B_OK) @@ -1710,13 +1710,13 @@ cdda_read(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t offset, } size_t length = *_length; - if (offset + length > maxSize) + if (offset + (off_t)length > maxSize) length = maxSize - offset; status_t status = B_OK; size_t bytesRead = 0; - if (offset < sizeof(wav_header)) { + if (offset < (off_t)sizeof(wav_header)) { // read fake WAV header size_t size = sizeof(wav_header) - offset; size = min_c(size, length); ############################################################################ Revision: hrev45635 Commit: 3f5d1e78252bb593cf5b430f37c3d18d779afab1 URL: http://cgit.haiku-os.org/haiku/commit/?id=3f5d1e7 Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Mon May 6 17:44:24 2013 UTC exfat: fixes 64 bit warnings ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/file_systems/exfat/DataStream.cpp b/src/add-ons/kernel/file_systems/exfat/DataStream.cpp index 48edf05..5a9647e 100644 --- a/src/add-ons/kernel/file_systems/exfat/DataStream.cpp +++ b/src/add-ons/kernel/file_systems/exfat/DataStream.cpp @@ -62,8 +62,8 @@ DataStream::FindBlock(off_t pos, off_t& physical, off_t *_length) } *_length = min_c((cluster - clusterIndex + 1) * kClusterSize - offset, fSize - pos); - TRACE("inode %" B_PRIdINO ": cluster %ld, pos %lld, %lld\n", - fInode->ID(), clusterIndex, pos, physical); + TRACE("inode %" B_PRIdINO ": cluster %" B_PRIu32 ", pos %" B_PRIdOFF ", %" + B_PRIdOFF "\n", fInode->ID(), clusterIndex, pos, physical); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp b/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp index bfa0553..2c33bba 100644 --- a/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp +++ b/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp @@ -27,7 +27,7 @@ DirectoryIterator::DirectoryIterator(Inode* inode) fBlock(inode->GetVolume()), fCurrent(NULL) { - TRACE("DirectoryIterator::DirectoryIterator() %ld\n", fCluster); + TRACE("DirectoryIterator::DirectoryIterator() %" B_PRIu32 "\n", fCluster); } @@ -78,7 +78,7 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id, if (status == B_OK && name != NULL) { status = unicode_to_utf8(unicodeName, nameLength, (uint8 *)name, _nameLength); - TRACE("DirectoryIterator::GetNext() %ld %s, %" B_PRIdINO "\n", + TRACE("DirectoryIterator::GetNext() %" B_PRIu32 " %s, %" B_PRIdINO "\n", fInode->Cluster(), name, *_id); } @@ -184,8 +184,9 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id, status_t status; int32 chunkCount = 1; while ((status = _NextEntry()) == B_OK) { - TRACE("DirectoryIterator::_GetNext() %ld/%p, type 0x%x, offset %lld\n", - fInode->Cluster(), fCurrent, fCurrent->type, fOffset); + TRACE("DirectoryIterator::_GetNext() %" B_PRIu32 "/%p, type 0x%x, " + "offset %" B_PRId64 "\n", fInode->Cluster(), fCurrent, + fCurrent->type, fOffset); if (fCurrent->type == EXFAT_ENTRY_TYPE_FILE) { chunkCount = fCurrent->file.chunkCount; if (_id != NULL) { @@ -194,8 +195,8 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id, } if (visitor != NULL) visitor->VisitFile(fCurrent); - TRACE("DirectoryIterator::_GetNext() File chunkCount %ld\n", - chunkCount); + TRACE("DirectoryIterator::_GetNext() File chunkCount %" B_PRId32 + "\n", chunkCount); } else if (fCurrent->type == EXFAT_ENTRY_TYPE_FILEINFO) { chunkCount--; TRACE("DirectoryIterator::_GetNext() Filename length %d\n", @@ -241,7 +242,8 @@ DirectoryIterator::_NextEntry() fInode->GetVolume()->ClusterToBlock(fCluster, block); block += (fOffset / fInode->GetVolume()->EntriesPerBlock()) % (1 << fInode->GetVolume()->SuperBlock().BlocksPerClusterShift()); - TRACE("DirectoryIterator::_NextEntry() init to block %lld\n", block); + TRACE("DirectoryIterator::_NextEntry() init to block %" B_PRIu64 "\n", + block); fCurrent = (struct exfat_entry*)fBlock.SetTo(block) + fOffset % fInode->GetVolume()->EntriesPerBlock(); } else if ((fOffset % fInode->GetVolume()->EntriesPerBlock()) == 0) { @@ -253,7 +255,7 @@ DirectoryIterator::_NextEntry() fInode->GetVolume()->ClusterToBlock(fCluster, block); } else block = fBlock.BlockNumber() + 1; - TRACE("DirectoryIterator::_NextEntry() block %lld\n", block); + TRACE("DirectoryIterator::_NextEntry() block %" B_PRIu64 "\n", block); fCurrent = (struct exfat_entry*)fBlock.SetTo(block); } else fCurrent++; diff --git a/src/add-ons/kernel/file_systems/exfat/Inode.cpp b/src/add-ons/kernel/file_systems/exfat/Inode.cpp index a03c13c..7081565 100644 --- a/src/add-ons/kernel/file_systems/exfat/Inode.cpp +++ b/src/add-ons/kernel/file_systems/exfat/Inode.cpp @@ -37,8 +37,8 @@ Inode::Inode(Volume* volume, cluster_t cluster, uint32 offset) fCache(NULL), fMap(NULL) { - TRACE("Inode::Inode(%ld, %d) inode %" B_PRIdINO "\n", Cluster(), Offset(), - ID()); + TRACE("Inode::Inode(%" B_PRIu32 ", %" B_PRIu32 ") inode %" B_PRIdINO "\n", + Cluster(), Offset(), ID()); _Init(); if (ID() == 1) { @@ -72,7 +72,8 @@ Inode::Inode(Volume* volume, ino_t ino) fOffset = key->offset; fInitStatus = B_OK; } - TRACE("Inode::Inode(%" B_PRIdINO ") cluster %ld\n", ID(), Cluster()); + TRACE("Inode::Inode(%" B_PRIdINO ") cluster %" B_PRIu32 "\n", ID(), + Cluster()); _Init(); if (fInitStatus == B_OK && ID() != 1) { @@ -204,14 +205,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) // set/check boundaries for pos/length if (pos < 0) { - ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n", - ID(), pos, length); + ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF", length %" + B_PRIuSIZE ")\n", ID(), pos, length); return B_BAD_VALUE; } if (pos >= Size() || length == 0) { - TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n", - ID(), pos, length); + TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF", length %" + B_PRIuSIZE ")\n", ID(), pos, length); *_length = 0; return B_NO_ERROR; } diff --git a/src/add-ons/kernel/file_systems/exfat/Inode.h b/src/add-ons/kernel/file_systems/exfat/Inode.h index 9c0ee16..26bc92f 100644 --- a/src/add-ons/kernel/file_systems/exfat/Inode.h +++ b/src/add-ons/kernel/file_systems/exfat/Inode.h @@ -40,7 +40,7 @@ public: ino_t ID() const { return fID; } ino_t Parent() const { return fParent; } cluster_t Cluster() const { return fCluster; } - uint32_t Offset() const { return fOffset; } + uint32 Offset() const { return fOffset; } cluster_t StartCluster() const { return fFileInfoEntry.file_info.StartCluster(); } bool IsContiguous() const diff --git a/src/add-ons/kernel/file_systems/exfat/Volume.cpp b/src/add-ons/kernel/file_systems/exfat/Volume.cpp index 8fea222..feea51b 100644 --- a/src/add-ons/kernel/file_systems/exfat/Volume.cpp +++ b/src/add-ons/kernel/file_systems/exfat/Volume.cpp @@ -318,7 +318,7 @@ Volume::Mount(const char* deviceName, uint32 flags) } fBlockSize = 1 << fSuperBlock.BlockShift(); - TRACE("block size %ld\n", fBlockSize); + TRACE("block size %" B_PRIu32 "\n", fBlockSize); fEntriesPerBlock = (fBlockSize / sizeof(struct exfat_entry)); // check if the device size is large enough to hold the file system @@ -348,7 +348,7 @@ Volume::Mount(const char* deviceName, uint32 flags) return status; } - TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(), + TRACE("Volume::Mount(): Found root node: %" B_PRIdINO " (%s)\n", fRootNode->ID(), strerror(fRootNode->InitCheck())); // all went fine @@ -422,7 +422,8 @@ Volume::ClusterToBlock(cluster_t cluster, fsblock_t &block) return B_BAD_VALUE; block = ((cluster - 2) << SuperBlock().BlocksPerClusterShift()) + SuperBlock().FirstDataBlock(); - TRACE("Volume::ClusterToBlock() cluster %lu %u %lu: %llu, %lu\n", cluster, + TRACE("Volume::ClusterToBlock() cluster %" B_PRIu32 " %u %" B_PRIu32 ": %" + B_PRIu64 ", %" B_PRIu32 "\n", cluster, SuperBlock().BlocksPerClusterShift(), SuperBlock().FirstDataBlock(), block, SuperBlock().FirstFatBlock()); return B_OK; @@ -438,7 +439,8 @@ Volume::NextCluster(cluster_t _cluster) + _cluster / clusterPerBlock; cluster_t *cluster = (cluster_t *)block.SetTo(blockNum); cluster += _cluster % clusterPerBlock; - TRACE("Volume::NextCluster() cluster %lu next %lu\n", _cluster, *cluster); + TRACE("Volume::NextCluster() cluster %" B_PRIu32 " next %" B_PRIu32 "\n", + _cluster, *cluster); return *cluster; } @@ -465,8 +467,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent) key.offset = offset; struct node* node = fNodeTree.Lookup(key); if (node != NULL) { - TRACE("Volume::GetIno() cached cluster %lu offset %lu ino %" B_PRIdINO - "\n", cluster, offset, node->ino); + TRACE("Volume::GetIno() cached cluster %" B_PRIu32 " offset %" B_PRIu32 + " ino %" B_PRIdINO "\n", cluster, offset, node->ino); return node->ino; } node = new struct node(); @@ -475,8 +477,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent) node->parent = parent; fNodeTree.Insert(node); fInoTree.Insert(node); - TRACE("Volume::GetIno() new cluster %lu offset %lu ino %" B_PRIdINO "\n", - cluster, offset, node->ino); + TRACE("Volume::GetIno() new cluster %" B_PRIu32 " offset %" B_PRIu32 + " ino %" B_PRIdINO "\n", cluster, offset, node->ino); return node->ino; } diff --git a/src/add-ons/kernel/file_systems/exfat/encodings.cpp b/src/add-ons/kernel/file_systems/exfat/encodings.cpp index 09c69c5..0393fab 100644 --- a/src/add-ons/kernel/file_systems/exfat/encodings.cpp +++ b/src/add-ons/kernel/file_systems/exfat/encodings.cpp @@ -98,14 +98,14 @@ static status_t _lendian_unicode_to_utf8( const char *src, - int32 *srcLen, + size_t *srcLen, char *dst, - uint32 *dstLen) + size_t *dstLen) { - int32 srcLimit = *srcLen; - int32 dstLimit = *dstLen; - int32 srcCount = 0; - int32 dstCount = 0; + size_t srcLimit = *srcLen; + size_t dstLimit = *dstLen; + size_t srcCount = 0; + size_t dstCount = 0; status_t status = B_ERROR; for (srcCount = 0; srcCount < srcLimit; srcCount += 2) { @@ -142,14 +142,14 @@ _lendian_unicode_to_utf8( static status_t _utf8_to_lendian_unicode( const char *src, - int32 *srcLen, + size_t *srcLen, char *dst, - uint32 *dstLen) + size_t *dstLen) { - int32 srcLimit = *srcLen; - int32 dstLimit = *dstLen - 1; - int32 srcCount = 0; - int32 dstCount = 0; + size_t srcLimit = *srcLen; + size_t dstLimit = *dstLen - 1; + size_t srcCount = 0; + size_t dstCount = 0; status_t status = B_ERROR; while ((srcCount < srcLimit) && (dstCount < dstLimit)) { @@ -186,12 +186,12 @@ _utf8_to_lendian_unicode( // takes a unicode name of unilen uchar's and converts to a utf8 name of at // most utf8len uint8's -status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, - uint32 *utf8len) +status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8, + size_t *utf8len) { - uint32 origlen = unilen; + //size_t origlen = unilen; status_t result = _lendian_unicode_to_utf8((char *)uni, - (int32 *)&unilen, (char *)utf8, utf8len); + &unilen, (char *)utf8, utf8len); /*if (unilen < origlen) { panic("Name is too long (%lx < %lx)\n", unilen, origlen); @@ -202,13 +202,13 @@ status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, } -status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen) +status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen) { - uint32 origlen = strlen(utf8) + 1; - uint32 utf8len = origlen; + size_t origlen = strlen(utf8) + 1; + size_t utf8len = origlen; status_t result = _utf8_to_lendian_unicode(utf8, - (int32 *)&utf8len, (char *)uni, unilen); + &utf8len, (char *)uni, unilen); /*if (origlen < utf8len) { panic("Name is too long (%lx < %lx)\n", *unilen, origlen); diff --git a/src/add-ons/kernel/file_systems/exfat/encodings.h b/src/add-ons/kernel/file_systems/exfat/encodings.h index 2d4fdcd..eaddd91 100644 --- a/src/add-ons/kernel/file_systems/exfat/encodings.h +++ b/src/add-ons/kernel/file_systems/exfat/encodings.h @@ -9,9 +9,9 @@ extern "C" { #endif -status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, - uint32 *utf8len); -status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen); +status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8, + size_t *utf8len); +status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen); #ifdef __cplusplus } diff --git a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp index 2fd7d2f..c2110e7 100644 --- a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp @@ -236,7 +236,7 @@ exfat_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, while (true) { file_io_vec fileVecs[8]; - uint32 fileVecCount = 8; + size_t fileVecCount = 8; status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs, &fileVecCount, 0); @@ -322,10 +322,10 @@ exfat_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, offset += blockLength; size -= blockLength; - if (size <= vecs[index - 1].length || offset >= inode->Size()) { + if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) { // We're done! *_count = index; - TRACE("exfat_get_file_map for inode %lld\n", inode->ID()); + TRACE("exfat_get_file_map for inode %" B_PRIdINO"\n", inode->ID()); return B_OK; } } @@ -367,7 +367,7 @@ static status_t exfat_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, void* buffer, size_t bufferLength) { - TRACE("ioctl: %lu\n", cmd); + TRACE("ioctl: %" B_PRIu32 "\n", cmd); /*Volume* volume = (Volume*)_volume->private_volume;*/ return B_DEV_INVALID_IOCTL;