Fix printf() format string warnings

This commit is contained in:
Ingo Weinhold
2011-11-25 06:18:23 +01:00
parent c4c9e06c88
commit ca852d815b
2 changed files with 11 additions and 6 deletions
+8 -4
View File
@@ -74,10 +74,12 @@ private:
{ {
switch (value.type) { switch (value.type) {
case B_HPKG_ATTRIBUTE_TYPE_INT: 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; break;
case B_HPKG_ATTRIBUTE_TYPE_UINT: 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; break;
case B_HPKG_ATTRIBUTE_TYPE_STRING: case B_HPKG_ATTRIBUTE_TYPE_STRING:
printf("\"%s\"", value.string); printf("\"%s\"", value.string);
@@ -85,12 +87,14 @@ private:
case B_HPKG_ATTRIBUTE_TYPE_RAW: case B_HPKG_ATTRIBUTE_TYPE_RAW:
switch (value.encoding) { switch (value.encoding) {
case B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE: 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! // TODO: Print the data bytes!
break; break;
case B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP: case B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP:
printf("data: size: %llu, offset: %llu", 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; break;
default: default:
break; break;
+3 -2
View File
@@ -45,7 +45,7 @@ struct PackageContentListHandler : BPackageContentHandler {
// name and size // name and size
printf("%-*s", indentation < 32 ? 32 - indentation : 0, entry->Name()); printf("%-*s", indentation < 32 ? 32 - indentation : 0, entry->Name());
printf(" %8llu", entry->Data().UncompressedSize()); printf(" %8llu", (unsigned long long)entry->Data().UncompressedSize());
// time // time
struct tm* time = localtime(&entry->ModifiedTime().tv_sec); struct tm* time = localtime(&entry->ModifiedTime().tv_sec);
@@ -89,7 +89,8 @@ struct PackageContentListHandler : BPackageContentHandler {
int indentation = fLevel * 2; int indentation = fLevel * 2;
printf("%*s<", indentation, ""); printf("%*s<", indentation, "");
printf("%-*s %8llu", indentation < 31 ? 31 - indentation : 0, 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(); uint32 type = attribute->Type();
if (isprint(type & 0xff) && isprint((type >> 8) & 0xff) if (isprint(type & 0xff) && isprint((type >> 8) & 0xff)