From e825d892e18b961648f911cc6acf0bcfbbd31258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 9 May 2013 15:53:50 +0200 Subject: [PATCH] efi_gpt: fixes 64 bit warnings --- .../partitioning_systems/gpt/Header.cpp | 30 +++++++++---------- .../partitioning_systems/gpt/efi_gpt.cpp | 17 ++++++----- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp index 289f926ada..4fbc15965c 100644 --- a/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp +++ b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp @@ -336,7 +336,7 @@ Header::_PrintGUID(const guid_t &id) { static char guid[48]; snprintf(guid, sizeof(guid), - "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + "%08" B_PRIx32 "-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", B_LENDIAN_TO_HOST_INT32(id.data1), B_LENDIAN_TO_HOST_INT16(id.data2), B_LENDIAN_TO_HOST_INT16(id.data3), id.data4[0], id.data4[1], id.data4[2], id.data4[3], id.data4[4], id.data4[5], id.data4[6], @@ -350,17 +350,17 @@ Header::_Dump(const efi_table_header& header) { dprintf("EFI header: %.8s\n", header.header); dprintf("EFI revision: %" B_PRIx32 "\n", header.Revision()); - dprintf("header size: %ld\n", header.HeaderSize()); - dprintf("header CRC: %ld\n", header.HeaderCRC()); - dprintf("absolute block: %Ld\n", header.AbsoluteBlock()); - dprintf("alternate block: %Ld\n", header.AlternateBlock()); - dprintf("first usable block: %Ld\n", header.FirstUsableBlock()); - dprintf("last usable block: %Ld\n", header.LastUsableBlock()); + dprintf("header size: %" B_PRId32 "\n", header.HeaderSize()); + dprintf("header CRC: %" B_PRId32 "\n", header.HeaderCRC()); + dprintf("absolute block: %" B_PRIu64 "\n", header.AbsoluteBlock()); + dprintf("alternate block: %" B_PRIu64 "\n", header.AlternateBlock()); + dprintf("first usable block: %" B_PRIu64 "\n", header.FirstUsableBlock()); + dprintf("last usable block: %" B_PRIu64 "\n", header.LastUsableBlock()); dprintf("disk GUID: %s\n", _PrintGUID(header.disk_guid)); - dprintf("entries block: %Ld\n", header.EntriesBlock()); - dprintf("entry size: %ld\n", header.EntrySize()); - dprintf("entry count: %ld\n", header.EntryCount()); - dprintf("entries CRC: %ld\n", header.EntriesCRC()); + dprintf("entries block: %" B_PRIu64 "\n", header.EntriesBlock()); + dprintf("entry size: %" B_PRIu32 "\n", header.EntrySize()); + dprintf("entry count: %" B_PRIu32 "\n", header.EntryCount()); + dprintf("entries CRC: %" B_PRIu32 "\n", header.EntriesCRC()); } @@ -373,14 +373,14 @@ Header::_DumpPartitions() if (entry.partition_type == kEmptyGUID) continue; - dprintf("[%3ld] partition type: %s\n", i, + dprintf("[%3" B_PRIu32 "] partition type: %s\n", i, _PrintGUID(entry.partition_type)); dprintf(" unique id: %s\n", _PrintGUID(entry.unique_guid)); - dprintf(" start block: %Ld\n", entry.StartBlock()); - dprintf(" end block: %Ld\n", entry.EndBlock()); + dprintf(" start block: %" B_PRIu64 "\n", entry.StartBlock()); + dprintf(" end block: %" B_PRIu64 "\n", entry.EndBlock()); dprintf(" size: %g MB\n", (entry.EndBlock() - entry.StartBlock()) * 512 / 1024.0 / 1024.0); - dprintf(" attributes: %Lx\n", entry.Attributes()); + dprintf(" attributes: %" B_PRIx64 "\n", entry.Attributes()); char name[64]; to_utf8(entry.name, EFI_PARTITION_NAME_LENGTH, name, sizeof(name)); diff --git a/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp index 8dbf7ad741..ad8f784bca 100644 --- a/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp @@ -119,7 +119,8 @@ efi_gpt_scan_partition(int fd, partition_data* partition, void* _cookie) partition->offset + entry.StartBlock() * partition->block_size, entry.BlockCount() * partition->block_size, -1); if (child == NULL) { - TRACE(("efi_gpt: Creating child at index %ld failed\n", index - 1)); + TRACE(("efi_gpt: Creating child at index %" B_PRIu32 " failed\n", + index - 1)); return B_ERROR; } @@ -128,7 +129,7 @@ efi_gpt_scan_partition(int fd, partition_data* partition, void* _cookie) child->name = strdup(name); child->type = strdup(get_partition_type(entry.partition_type)); child->block_size = partition->block_size; - child->cookie = (void*)i; + child->cookie = (void*)(addr_t)i; } return B_OK; @@ -492,7 +493,7 @@ efi_gpt_resize_child(int fd, partition_id partitionID, off_t size, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -553,7 +554,7 @@ efi_gpt_move_child(int fd, partition_id partitionID, partition_id childID, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -614,7 +615,7 @@ efi_gpt_set_content_name(int fd, partition_id partitionID, const char* name, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -660,7 +661,7 @@ efi_gpt_set_type(int fd, partition_id partitionID, const char* type, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -777,7 +778,7 @@ efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, child->name = strdup(name); child->type = strdup(type); child->parameters = strdup(parameters); - child->cookie = (void*)entryIndex; + child->cookie = (void*)(addr_t)entryIndex; if (child->type == NULL || child->parameters == NULL) { delete_partition(child->id); @@ -813,7 +814,7 @@ efi_gpt_delete_child(int fd, partition_id partitionID, partition_id childID, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE;