[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printing u64s (again)
From: |
Matt_Domsch |
Subject: |
printing u64s (again) |
Date: |
Mon, 10 Dec 2001 13:19:43 -0600 |
Andrew, I think we can drop the -Wno-format flag after applying the patch at
http://domsch.com/linux/patches/parted/parted-1.4.21-gpt-format.patch.
Essentially, you've got to
+#define __STDC_FORMAT_MACROS
for PRIx64 to work, and you need the % in the format string preceeding the
PRIx64. Patch applies to 1.4.21, but I couldn't build it (autoconfuse
really dislikes AC_PREREQ(2.49b) - the b in there throws it off
considerably, at least on my ancient 2.13-based RH7.2 system).
Thanks,
Matt
--
Matt Domsch
Sr. Software Engineer
Dell Linux Solutions
www.dell.com/linux
#1 US Linux Server provider with 24% (IDC Sept 2001)
#2 Worldwide Linux Server provider with 17% (IDC Sept 2001)
#3 Unix provider with 18% in the US (Dataquest)!
--- parted-1.4.21/libparted/disk_gpt.c.orig Sat Oct 20 00:52:42 2001
+++ parted-1.4.21/libparted/disk_gpt.c Fri Dec 7 15:27:32 2001
@@ -28,6 +28,9 @@
- Make partition labels get/set properly
*/
+/* For PRIx64 */
+#define __STDC_FORMAT_MACROS
+
#include "config.h"
#include <parted/parted.h>
@@ -352,8 +355,8 @@
memcpy(uuid, &pte->UniquePartitionGuid, sizeof(uuid_t));
uuid_unparse(uuid, uuid_buffer);
printf("\tUniquePartitionGuid : %s\n", uuid_buffer);
- printf("\tStartingLBA : " PRIx64 "\n", pte->StartingLBA);
- printf("\tEndingLBA : " PRIx64 "\n", pte->EndingLBA);
+ printf("\tStartingLBA : %" PRIx64 "\n", pte->StartingLBA);
+ printf("\tEndingLBA : %" PRIx64 "\n", pte->EndingLBA);
printf("\tAttributes : ");
printf("\tRequiredToFunction: %x",
pte->Attributes.RequiredToFunction);
@@ -371,18 +374,18 @@
uuid_t uuid;
printf("GUID Partition Table Header\n");
PED_ASSERT(gpt != NULL, return);
- printf("Signature : 0x" PRIx64 "\n", gpt->Signature);
+ printf("Signature : 0x%" PRIx64 "\n", gpt->Signature);
printf("Revision : 0x%x\n", gpt->Revision);
printf("HeaderSize : 0x%x\n", gpt->HeaderSize);
printf("HeaderCRC32 : 0x%x\n", gpt->HeaderCRC32);
- printf("MyLBA : 0x" PRIx64 "\n", gpt->MyLBA);
- printf("AlternateLBA : 0x" PRIx64 "\n", gpt->AlternateLBA);
- printf("FirstUsableLBA : 0x" PRIx64 "\n", gpt->FirstUsableLBA);
- printf("LastUsableLBA : 0x" PRIx64 "\n", gpt->LastUsableLBA);
+ printf("MyLBA : 0x%" PRIx64 "\n", gpt->MyLBA);
+ printf("AlternateLBA : 0x%" PRIx64 "\n", gpt->AlternateLBA);
+ printf("FirstUsableLBA : 0x%" PRIx64 "\n", gpt->FirstUsableLBA);
+ printf("LastUsableLBA : 0x%" PRIx64 "\n", gpt->LastUsableLBA);
memcpy(uuid, &gpt->DiskGUID, sizeof(uuid_t));
uuid_unparse(uuid, uuid_buffer);
printf("DiskGUID : %s\n", uuid_buffer);
- printf("PartitionEntryLBA : " PRIx64 "\n", gpt->PartitionEntryLBA);
+ printf("PartitionEntryLBA : %" PRIx64 "\n", gpt->PartitionEntryLBA);
printf("NumberOfPartitionEntries : %x\n",
gpt->NumberOfPartitionEntries);
printf("SizeOfPartitionEntry : %x\n", gpt->SizeOfPartitionEntry);
@@ -518,7 +521,7 @@
PED_EXCEPTION_ERROR,
PED_EXCEPTION_CANCEL,
_("GUID Partition Table Header Signature is wrong: "
- "" PRIx64 " should be " PRIx64 ""),
+ "%" PRIx64 " should be %" PRIx64 "\n"),
(*gpt)->Signature, GPT_HEADER_SIGNATURE);
goto error_free_gpt;
}
@@ -544,7 +547,7 @@
ped_exception_throw (
PED_EXCEPTION_ERROR,
PED_EXCEPTION_CANCEL,
- "MyLBA " PRIx64 " != lba " PRIx64 ".\n",
+ "MyLBA %" PRIx64 " != lba %" PRIx64 ".\n",
(*gpt)->MyLBA, lba);
goto error_free_gpt;
}
- printing u64s (again),
Matt_Domsch <=