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