OSDN Git Service

Fix compiler warnings about mismatching printf format / argument type.
authorErik Larsson <mechie@users.sourceforge.net>
Tue, 16 Feb 2016 08:30:49 +0000 (09:30 +0100)
committerErik Larsson <mechie@users.sourceforge.net>
Tue, 16 Feb 2016 08:30:49 +0000 (09:30 +0100)
For 64-bit (e.g. x86_64) Linux the 64-bit wide types resolve to long,
not long long as is the case in 32-bit (e.g. i386) Linux. So we need an
explicit cast to long long for 64-bit types since the format string must
specify the 'll' modifier in order to print 64-bit values.

libntfs-3g/attrib.c
ntfsprogs/mkntfs.c
ntfsprogs/ntfsundelete.c
ntfsprogs/utils.c

index 25e7674..a5a6549 100644 (file)
@@ -2373,7 +2373,8 @@ int ntfs_attr_pclose(ntfs_attr *na)
        BOOL compressed;
 
        ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x.\n",
-                       na->ni->mft_no, le32_to_cpu(na->type));
+                       (unsigned long long)na->ni->mft_no,
+                       le32_to_cpu(na->type));
        
        if (!na || !na->ni || !na->ni->vol) {
                errno = EINVAL;
index 7b39fac..5eb7d4f 100644 (file)
@@ -3704,7 +3704,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
                                (long long)(volume_size / 1024));
                return FALSE;
        }
-       ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024);
+       ntfs_log_debug("volume size = %llikiB\n",
+                       (long long)(volume_size / 1024));
        /* If user didn't specify the cluster size, determine it now. */
        if (!vol->cluster_size) {
                /*
@@ -3789,7 +3790,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
                return FALSE;
        }
        ntfs_log_debug("number of clusters = %llu (0x%llx)\n",
-                       vol->nr_clusters, vol->nr_clusters);
+                       (unsigned long long)vol->nr_clusters,
+                       (unsigned long long)vol->nr_clusters);
        /* Number of clusters must fit within 32 bits (Win2k limitation). */
        if (vol->nr_clusters >> 32) {
                if (vol->cluster_size >= 65536) {
@@ -3868,7 +3870,7 @@ static BOOL mkntfs_initialize_bitmaps(void)
        i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) &
                        ~(g_vol->cluster_size - 1);
        ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n",
-                       g_lcn_bitmap_byte_size, i);
+                       g_lcn_bitmap_byte_size, (unsigned long long)i);
        g_dynamic_buf_size = mkntfs_get_page_size();
        g_dynamic_buf = (u8*)ntfs_calloc(g_dynamic_buf_size);
        if (!g_dynamic_buf)
index 7340dc5..d479ec1 100644 (file)
@@ -2358,7 +2358,7 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end)
        mft_end = min(mft_end, nr_mft_records - 1);
 
        ntfs_log_debug("MFT records:\n");
-       ntfs_log_debug("\tTotal: %8lld\n", nr_mft_records);
+       ntfs_log_debug("\tTotal: %8lld\n", (long long)nr_mft_records);
        ntfs_log_debug("\tBegin: %8lld\n", mft_begin);
        ntfs_log_debug("\tEnd:   %8lld\n", mft_end);
 
index 20ff786..45a03a4 100644 (file)
@@ -420,7 +420,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale)
        if (middle) {
                if (middle[1] == 0) {
                        b = LONG_MAX;           // XXX ULLONG_MAX
-                       ntfs_log_debug("Range has no end, defaulting to %lld.\n", b);
+                       ntfs_log_debug("Range has no end, defaulting to "
+                                       "%lld.\n", (long long)b);
                } else {
                        if (!utils_parse_size(middle+1, &b, scale))
                                return 0;
@@ -429,7 +430,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale)
                b = a;
        }
 
-       ntfs_log_debug("Range '%s' = %lld - %lld\n", string, a, b);
+       ntfs_log_debug("Range '%s' = %lld - %lld\n", string, (long long)a,
+                       (long long)b);
 
        *start  = a;
        *finish = b;
@@ -813,7 +815,9 @@ int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref)
 
        bit  = 1 << (mref & 7);
        byte = (mref >> 3) & (sizeof(buffer) - 1);
-       ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit);
+       ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, "
+                       "in use %d\n", (long long) mref, (long long) bmpmref,
+                       byte, bit, buffer[byte] & bit);
 
        return (buffer[byte] & bit);
 }