Fix printf() format string warnings

This commit is contained in:
Ingo Weinhold 2011-06-27 01:45:06 +02:00
parent 59e76dbe41
commit 42ae64447e
2 changed files with 11 additions and 6 deletions

View File

@ -74,10 +74,12 @@ private:
{
switch (value.type) {
case B_HPKG_ATTRIBUTE_TYPE_INT:
printf("%lld (%#llx)", value.signedInt, value.signedInt);
printf("%lld (%#llx)", (long long)value.signedInt,
(long long)value.signedInt);
break;
case B_HPKG_ATTRIBUTE_TYPE_UINT:
printf("%llu (%#llx)", value.unsignedInt, value.unsignedInt);
printf("%llu (%#llx)", (unsigned long long)value.unsignedInt,
(unsigned long long)value.unsignedInt);
break;
case B_HPKG_ATTRIBUTE_TYPE_STRING:
printf("\"%s\"", value.string);
@ -85,12 +87,14 @@ private:
case B_HPKG_ATTRIBUTE_TYPE_RAW:
switch (value.encoding) {
case B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE:
printf("data: size: %llu, inline", value.data.size);
printf("data: size: %llu, inline",
(unsigned long long)value.data.size);
// TODO: Print the data bytes!
break;
case B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP:
printf("data: size: %llu, offset: %llu",
value.data.size, value.data.offset);
(unsigned long long)value.data.size,
(unsigned long long)value.data.offset);
break;
default:
break;

View File

@ -45,7 +45,7 @@ struct PackageContentListHandler : BPackageContentHandler {
// name and size
printf("%-*s", indentation < 32 ? 32 - indentation : 0, entry->Name());
printf(" %8llu", entry->Data().UncompressedSize());
printf(" %8llu", (unsigned long long)entry->Data().UncompressedSize());
// time
struct tm* time = localtime(&entry->ModifiedTime().tv_sec);
@ -89,7 +89,8 @@ struct PackageContentListHandler : BPackageContentHandler {
int indentation = fLevel * 2;
printf("%*s<", indentation, "");
printf("%-*s %8llu", indentation < 31 ? 31 - indentation : 0,
attribute->Name(), attribute->Data().UncompressedSize());
attribute->Name(),
(unsigned long long)attribute->Data().UncompressedSize());
uint32 type = attribute->Type();
if (isprint(type & 0xff) && isprint((type >> 8) & 0xff)