Fix some compiler warnings emitted by gcc-4.8.0
[oweals/busybox.git] / util-linux / fdisk_gpt.c
index 4dfb5b227ffeaca4219aca61afbd259814e78112..5786d5f7d753d6e1e414e84a58cca306dcf5b5aa 100644 (file)
@@ -7,7 +7,7 @@
 
 #define GPT_MAGIC 0x5452415020494645ULL
 enum {
-       LEGACY_GPT_TYPE = 0xee,
+       LEGACY_GPT_TYPE = 0xee,
        GPT_MAX_PARTS   = 256,
        GPT_MAX_PART_ENTRY_LEN = 4096,
        GUID_LEN        = 16,
@@ -55,11 +55,10 @@ gpt_part(int i)
        return (gpt_partition *)&part_array[i * part_entry_len];
 }
 
-/* TODO: move to libbb */
 static uint32_t
 gpt_crc32(void *buf, int len)
 {
-       return 0xffffffff ^ crc32_block_endian0(0xffffffff, buf, len, global_crc32_table);
+       return ~crc32_block_endian0(0xffffffff, buf, len, global_crc32_table);
 }
 
 static void
@@ -94,9 +93,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
        int i;
        char numstr6[6];
 
-       numstr6[5] = '\0';
-
-       smart_ulltoa5(total_number_of_sectors, numstr6, " KMGTPEZY");
+       smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY")[0] = '\0';
        printf("Disk %s: %llu sectors, %s\n", disk_device,
                (unsigned long long)total_number_of_sectors,
                numstr6);
@@ -113,8 +110,8 @@ gpt_list_table(int xtra UNUSED_PARAM)
        for (i = 0; i < n_parts; i++) {
                gpt_partition *p = gpt_part(i);
                if (p->lba_start) {
-                       smart_ulltoa5(1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start),
-                               numstr6, " KMGTPEZY");
+                       smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size,
+                               numstr6, " KMGTPEZY")[0] = '\0';
                        printf("%4u %15llu %15llu %11s   %04x  ",
                                i + 1,
                                (unsigned long long)SWAP_LE64(p->lba_start),