]> www.infradead.org Git - mtd-utils.git/commitdiff
Fix several issues when compiling for 64bit systems
authorJosh Boyer <jwboyer@gmail.com>
Tue, 13 Feb 2007 02:41:17 +0000 (20:41 -0600)
committerJosh Boyer <jwboyer@gmail.com>
Tue, 13 Feb 2007 02:41:17 +0000 (20:41 -0600)
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
ubi-utils/src/hashmap.c
ubi-utils/src/libubi.c
ubi-utils/src/nand2bin.c
ubi-utils/src/pfi.c
ubi-utils/src/reader.c
ubi-utils/src/unubi.c
ubi-utils/src/unubi_analyze.c

index 250f71f6791376243e44f2fa952ed794ed92b4df..3511d56c94c38db36098630df38f06ae17d2ee42 100644 (file)
@@ -323,7 +323,7 @@ hashmap_dump(hashmap_t map)
 
        for(i = 0; i < map->maxsize; i++) {
                if (map->data[i] != NULL) {
-                       printf("[%d]: ", i);
+                       printf("[%zd]: ", i);
                        print_all(map->data[i]);
                }
        }
index 979f157875d454b9b5d363193bf8c81e92f95bfe..7cb74bf962c3679dea5c58a44bc174450a4978b0 100644 (file)
@@ -698,8 +698,8 @@ ubi_vol_update(int vol_fd, unsigned long long bytes)
        err = ioctl(vol_fd, UBI_IOCVOLUP, &bytes);
        if (err) {
                ubi_err("%s failure calling update ioctl\n"
-                       "    IOCTL(%08x) err=%d errno=%d\n",
-                       __func__, UBI_IOCVOLUP, err, errno);
+                       "    IOCTL(%08lx) err=%d errno=%d\n",
+                       __func__, (long unsigned int)UBI_IOCVOLUP, err, errno);
        }
        return err;
 }
index 636ee6f6f9dcff62da2de40dfc2b380bd016ff1a..b8e4ea317dd2970918e975bb088a7ce8fa75e233 100644 (file)
@@ -203,7 +203,7 @@ process_page(uint8_t* buf, uint8_t *oobbuf, size_t pagesize)
        case 2048: oobsize = 64; eccpoi = 64 / 2; break;
        case 512:  oobsize = 16; eccpoi = 16 / 2; break;
        default:
-               fprintf(stderr, "Unsupported page size: %d\n", pagesize);
+               fprintf(stderr, "Unsupported page size: %zd\n", pagesize);
                return -EINVAL;
        }
        memset(oobbuf, 0xff, oobsize);
index 7b5755906d6be33704d6813f4bec9ef1eaa74319..fa835e20513721052b734af75089979a3109f911 100644 (file)
@@ -253,7 +253,7 @@ int pfi_header_setvalue (pfi_header head,
 {
        int key_id = find_key_by_name(key);
 
-       if ((uint32_t)value == (uint32_t)NULL)
+       if (value == NULL)
                return PFI_EINSUFF;
 
        if ((key_id < 0) || (key_id >= num_keys))
index 975caa18e8c53541d5351a85fcd9183ed298ebb8..7935a154db6863c2326ed7a02152174621dfbfc1 100644 (file)
@@ -178,7 +178,8 @@ read_pfi_raw(pfi_header pfi_hd, FILE* fp_pfi __unused, pfi_raw_t* pfi_raw,
        }
 
        rc = bootenv_list_to_num_vector(raw_start_list,
-                                       &(res->starts_size), &(res->starts));
+                                       (void *) &(res->starts_size),
+                                       &(res->starts));
        if (rc != 0) {
                EBUF_PFI("Cannot create numeric value array: %s", tmp_str);
                goto err;
@@ -246,7 +247,7 @@ read_pfi_ubi(pfi_header pfi_hd, FILE* fp_pfi __unused, pfi_ubi_t* pfi_ubi,
                goto err;
        }
 
-       rc = bootenv_list_to_num_vector(ubi_id_list, &(res->ids_size),
+       rc = bootenv_list_to_num_vector(ubi_id_list, (void *) &(res->ids_size),
                                        &(res->ids));
        if (rc != 0) {
                EBUF_PFI("Cannot create numeric value array: %s", tmp_str);
@@ -298,7 +299,7 @@ read_pfi_ubi(pfi_header pfi_hd, FILE* fp_pfi __unused, pfi_ubi_t* pfi_ubi,
                EBUF_PFI("Cannot translate PFI value: %s", tmp_str);
                goto err;
        }
-       rc = bootenv_list_to_vector(ubi_name_list, &(res->names_size),
+       rc = bootenv_list_to_vector(ubi_name_list, (void *) &(res->names_size),
                                    &(tmp_names));
        if (rc != 0) {
                EBUF_PFI("Cannot create string array: %s", tmp_str);
index cade1e109fbe9b09cc072339bd6c3051a6f48935..811a6dba0d24dd40fcb37188ec0c964ebf003202 100644 (file)
@@ -102,7 +102,7 @@ static const char *usage =
 #define FN_INVAL       "%s/eb%04u%s"                   /* invalid eraseblock */
 #define FN_NSURE       "%s/eb%04u_%03u_%03u_%03x%s"    /* unsure eraseblock */
 #define FN_VALID       "%s/eb%04u_%03u_%03u_%03x%s"    /* valid eraseblock */
-#define FN_VOLSP       "%s/vol%03u_%03u_%03u_%04u"     /* split volume */
+#define FN_VOLSP       "%s/vol%03u_%03u_%03u_%04zu"    /* split volume */
 #define FN_VOLWH       "%s/volume%03u"                 /* whole volume */
 
 static uint32_t crc32_table[256];
index 2e94ca9f12729f7e77c739bd05cba11ea971621a..6009fc05491b497eabeb4077334dd47cd533620c 100644 (file)
@@ -167,9 +167,9 @@ unubi_analyze_ec_hdr(eb_info_t first, const char *path)
                    (crc != ubi32_to_cpu(cur->outer.hdr_crc)))
                        fprintf(fpdata, "# ");
 
-               fprintf(fpdata, "%u %llu %llu", count,
-                       ubi64_to_cpu(cur->outer.ec),
-                       erase_counts[count]);
+               fprintf(fpdata, "%zu %llu %llu", count,
+                       (unsigned long long) ubi64_to_cpu(cur->outer.ec),
+                       (unsigned long long) erase_counts[count]);
 
                if (ubi32_to_cpu(cur->outer.magic) != UBI_EC_HDR_MAGIC)
                        fprintf(fpdata, " ## bad magic: %08x",
@@ -198,7 +198,7 @@ unubi_analyze_ec_hdr(eb_info_t first, const char *path)
                if ((count % EC_X_INT) == 0) {
                        if (count > 0)
                                fprintf(fpplot, ", ");
-                       fprintf(fpplot, "%d", count);
+                       fprintf(fpplot, "%zd", count);
                }
 
                cur = cur->next;
@@ -207,9 +207,9 @@ unubi_analyze_ec_hdr(eb_info_t first, const char *path)
        fprintf(fpplot, ")\n");
 
        fprintf(fpplot, "set ylabel \"erase count\"\n");
-       fprintf(fpplot, "set xrange [-1:%u]\n", eraseblocks + 1);
+       fprintf(fpplot, "set xrange [-1:%zu]\n", eraseblocks + 1);
        fprintf(fpplot, "# set yrange [-1:%llu]\n",
-               erase_counts[eraseblocks - 1] + 1);
+               (unsigned long long) erase_counts[eraseblocks - 1] + 1);
        fprintf(fpplot, "plot \"%s\" u 1:2 t \"unsorted: %s\" with boxes\n",
                FN_EH_DATA, FN_EH_DATA);
        fprintf(fpplot, "# replot \"%s\" u 1:3 t \"sorted: %s\" with lines\n",
@@ -299,7 +299,7 @@ unubi_analyze_vid_hdr(eb_info_t *head, const char *path)
                if ((y1 == -1) || (y2 == -1))
                        return -1;
 
-               fprintf(fpdata, "%u %u %u   %u %u   %u %u\n",
+               fprintf(fpdata, "%zu %u %u   %u %u   %u %u\n",
                        count,
                        ubi32_to_cpu(cur->inner.vol_id),
                        ubi32_to_cpu(cur->inner.lnum),
@@ -325,10 +325,10 @@ unubi_analyze_vid_hdr(eb_info_t *head, const char *path)
                        fprintf(fpplot, ", ");
                if (step != ubi32_to_cpu(cur->inner.vol_id)) {
                        step = ubi32_to_cpu(cur->inner.vol_id);
-                       fprintf(fpplot, "\"%d\" %d 0", step, count);
+                       fprintf(fpplot, "\"%zd\" %zd 0", step, count);
                }
                else
-                       fprintf(fpplot, "\"%d\" %d 1",
+                       fprintf(fpplot, "\"%d\" %zd 1",
                                ubi32_to_cpu(cur->inner.lnum), count);
                cur = cur->next;
                count++;
@@ -384,7 +384,7 @@ unubi_analyze_vid_hdr(eb_info_t *head, const char *path)
 
        y1 = norm_index(leb_versions[breadth - 1], leb_versions, breadth);
        y2 = norm_index(data_sizes[breadth - 1], data_sizes, breadth);
-       fprintf(fpplot, "set xrange [-1:%u]\n", count + 1);
+       fprintf(fpplot, "set xrange [-1:%zu]\n", count + 1);
        fprintf(fpplot, "set yrange [-1:%u]\n", y1 + 1);
        fprintf(fpplot, "set y2range [-1:%u]\n", y2 + 1);
        fprintf(fpplot, "plot \"%s\" u 1:4 t \"leb version: %s\" "