storage kit: fix Wrong type of arguments to formatting function
Pointed out by LGTM. Change-Id: I802814ef53dd3f46a355db0a57926676037984a7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4080 Reviewed-by: Adrien Destugues <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
69cd1bde89
commit
0594775c0f
@@ -525,7 +525,8 @@ ResourceFile::_InitELFXFile(BFile& file, uint64 fileSize)
|
||||
// ELF header size
|
||||
if (headerSize < sizeof(ElfHeader) || headerSize > kMaxELFHeaderSize) {
|
||||
throw Exception(B_IO_ERROR,
|
||||
"Invalid ELF header: invalid ELF header size: %lu.", headerSize);
|
||||
"Invalid ELF header: invalid ELF header size: %" B_PRIu32 ".",
|
||||
headerSize);
|
||||
}
|
||||
uint64 resourceOffset = headerSize;
|
||||
uint64 resourceAlignment = 0;
|
||||
@@ -707,12 +708,12 @@ ResourceFile::_InitPEFFile(BFile& file, const PEFContainerHeader& pefHeader)
|
||||
// check the values
|
||||
if (offset < sectionHeaderTableEnd || offset > fileSize) {
|
||||
throw Exception(B_IO_ERROR, "Invalid PEF section header: invalid "
|
||||
"section offset: %lu.", offset);
|
||||
"section offset: %" B_PRIu32 ".", offset);
|
||||
}
|
||||
uint32 sectionEnd = offset + size;
|
||||
if (sectionEnd > fileSize) {
|
||||
throw Exception(B_IO_ERROR, "Invalid PEF section header: section "
|
||||
"exceeds file: %lu.", sectionEnd);
|
||||
"exceeds file: %" B_PRIu32 ".", sectionEnd);
|
||||
}
|
||||
resourceOffset = std::max(resourceOffset, sectionEnd);
|
||||
}
|
||||
@@ -757,8 +758,8 @@ ResourceFile::_ReadHeader(resource_parse_info& parseInfo)
|
||||
uint32 indexSectionOffset = _GetInt(header.rh_index_section_offset);
|
||||
if (indexSectionOffset != kResourceIndexSectionOffset) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource index section "
|
||||
"offset. Is: %lu, should be: %lu.", indexSectionOffset,
|
||||
kResourceIndexSectionOffset);
|
||||
"offset. Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".",
|
||||
indexSectionOffset, kResourceIndexSectionOffset);
|
||||
}
|
||||
// admin section size
|
||||
uint32 indexSectionSize = kResourceIndexSectionHeaderSize
|
||||
@@ -768,7 +769,7 @@ ResourceFile::_ReadHeader(resource_parse_info& parseInfo)
|
||||
uint32 adminSectionSize = _GetInt(header.rh_admin_section_size);
|
||||
if (adminSectionSize != indexSectionOffset + indexSectionSize) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource admin section size. "
|
||||
"Is: %lu, should be: %lu.", adminSectionSize,
|
||||
"Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".", adminSectionSize,
|
||||
indexSectionOffset + indexSectionSize);
|
||||
}
|
||||
// set the resource count
|
||||
@@ -793,8 +794,8 @@ ResourceFile::_ReadIndex(resource_parse_info& parseInfo)
|
||||
uint32 indexSectionOffset = _GetInt(header.rish_index_section_offset);
|
||||
if (indexSectionOffset != kResourceIndexSectionOffset) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource index section "
|
||||
"offset. Is: %lu, should be: %lu.", indexSectionOffset,
|
||||
kResourceIndexSectionOffset);
|
||||
"offset. Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".",
|
||||
indexSectionOffset, kResourceIndexSectionOffset);
|
||||
}
|
||||
// index section size
|
||||
uint32 expectedIndexSectionSize = kResourceIndexSectionHeaderSize
|
||||
@@ -804,7 +805,7 @@ ResourceFile::_ReadIndex(resource_parse_info& parseInfo)
|
||||
uint32 indexSectionSize = _GetInt(header.rish_index_section_size);
|
||||
if (indexSectionSize != expectedIndexSectionSize) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource index section size. "
|
||||
"Is: %lu, should be: %lu.", indexSectionSize,
|
||||
"Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".", indexSectionSize,
|
||||
expectedIndexSectionSize);
|
||||
}
|
||||
// unknown section offset
|
||||
@@ -812,14 +813,14 @@ ResourceFile::_ReadIndex(resource_parse_info& parseInfo)
|
||||
= _GetInt(header.rish_unknown_section_offset);
|
||||
if (unknownSectionOffset != indexSectionOffset + indexSectionSize) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource index section size. "
|
||||
"Is: %lu, should be: %lu.", unknownSectionOffset,
|
||||
indexSectionOffset + indexSectionSize);
|
||||
"Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".",
|
||||
unknownSectionOffset, indexSectionOffset + indexSectionSize);
|
||||
}
|
||||
// unknown section size
|
||||
uint32 unknownSectionSize = _GetInt(header.rish_unknown_section_size);
|
||||
if (unknownSectionSize != kUnknownResourceSectionSize) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected resource index section "
|
||||
"offset. Is: %lu, should be: %lu.",
|
||||
"offset. Is: %" B_PRIu32 ", should be: %" B_PRIu32 ".",
|
||||
unknownSectionOffset, kUnknownResourceSectionSize);
|
||||
}
|
||||
|
||||
@@ -884,8 +885,9 @@ ResourceFile::_ReadIndexEntry(BPositionIO& buffer,
|
||||
if (result && offset + size > fileSize) {
|
||||
if (!peekAhead) {
|
||||
throw Exception(B_IO_ERROR, "Invalid resource index entry: index: "
|
||||
"%ld, offset: %lu (%lx), size: %lu (%lx).", index + 1, offset,
|
||||
offset, size, size);
|
||||
"%" B_PRId32 ", offset: %" B_PRIu32 " (%" B_PRIx32 "), "
|
||||
"size: %" B_PRIu32 " (%" B_PRIx32 ").",
|
||||
index + 1, offset, offset, size, size);
|
||||
}
|
||||
result = false;
|
||||
}
|
||||
@@ -940,7 +942,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info& parseInfo)
|
||||
// read a resource block
|
||||
if (!area.check(data, kMinResourceInfoBlockSize)) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected end of resource info "
|
||||
"table at index %ld.", resourceIndex);
|
||||
"table at index %" B_PRId32 ".", resourceIndex);
|
||||
}
|
||||
const resource_info_block* infoBlock
|
||||
= (const resource_info_block*)data;
|
||||
@@ -952,7 +954,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info& parseInfo)
|
||||
// prepare for next iteration, if there is another info
|
||||
if (!area.check(data, kResourceInfoSeparatorSize)) {
|
||||
throw Exception(B_IO_ERROR, "Unexpected end of resource info "
|
||||
"table after index %ld.", resourceIndex);
|
||||
"table after index %" B_PRId32 ".", resourceIndex);
|
||||
}
|
||||
const resource_info_separator* separator
|
||||
= (const resource_info_separator*)data;
|
||||
@@ -1024,8 +1026,8 @@ ResourceFile::_ReadInfoTableEnd(const void* data, int32 dataSize)
|
||||
uint32 fileCheckSum = _GetInt(tableEnd->rite_check_sum);
|
||||
if (checkSum != fileCheckSum) {
|
||||
throw Exception(B_IO_ERROR, "Invalid resource info table check"
|
||||
" sum: In file: %lx, calculated: %lx.", fileCheckSum,
|
||||
checkSum);
|
||||
" sum: In file: %" B_PRIx32 ", calculated: %" B_PRIx32 ".",
|
||||
fileCheckSum, checkSum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1056,14 +1058,15 @@ ResourceFile::_ReadResourceInfo(resource_parse_info& parseInfo,
|
||||
if (!ignore) {
|
||||
if (readIndices[index - 1]) {
|
||||
throw Exception(B_IO_ERROR, "Multiple resource infos with the "
|
||||
"same index field: %ld.", index);
|
||||
"same index field: %" B_PRId32 ".", index);
|
||||
}
|
||||
readIndices[index - 1] = true;
|
||||
}
|
||||
// name size
|
||||
if (!area.check(name, nameSize)) {
|
||||
throw Exception(B_IO_ERROR, "Invalid name size (%d) for index %ld in "
|
||||
"resource info table.", (int)nameSize, index);
|
||||
throw Exception(B_IO_ERROR, "Invalid name size (%" B_PRIu16 ") "
|
||||
"for index %" B_PRId32 " in resource info table.",
|
||||
nameSize, index);
|
||||
}
|
||||
// check, if name is null terminated
|
||||
if (name[nameSize - 1] != 0) {
|
||||
@@ -1078,7 +1081,7 @@ ResourceFile::_ReadResourceInfo(resource_parse_info& parseInfo,
|
||||
item->SetIdentity(type, id, resourceName.String());
|
||||
else {
|
||||
throw Exception(B_IO_ERROR, "Unexpected error: No resource item "
|
||||
"at index %ld.", index);
|
||||
"at index %" B_PRId32 ".", index);
|
||||
}
|
||||
}
|
||||
return skip_bytes(name, nameSize);
|
||||
|
||||
Reference in New Issue
Block a user