diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2012-09-12 16:38:34 +0200 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-09-25 18:06:50 +0300 |
commit | f3f3a208048eac5f8b5752a17ebcd44db9230fd8 (patch) | |
tree | 2f697e448f84cf55ecaebcb19f6fc1b10d54e303 /mtd_debug.c | |
parent | 4f1b10827b81cd9acaa9e02b0da0dc447f1471ea (diff) |
consistency between u_int32_t / off_t / off64_t
We should use the off_t type instead of off64_t or u_int32_t as its
length is controlled by the WITHOUT_LARGEFILE flag.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'mtd_debug.c')
-rw-r--r-- | mtd_debug.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mtd_debug.c b/mtd_debug.c index 2d307a9..9110e9b 100644 --- a/mtd_debug.c +++ b/mtd_debug.c @@ -103,7 +103,7 @@ void printsize(u_int32_t x) printf("(%u%c)", x, flags[i]); } -int flash_to_file(int fd, u_int32_t offset, size_t len, const char *filename) +int flash_to_file(int fd, off_t offset, size_t len, const char *filename) { u_int8_t *buf = NULL; int outfd, err; @@ -157,7 +157,7 @@ retry: if (buf != NULL) free(buf); close(outfd); - printf("Copied %zu bytes from address 0x%.8x in flash to %s\n", len, offset, filename); + printf("Copied %zu bytes from address 0x%.8"PRIxoff_t" in flash to %s\n", len, offset, filename); return 0; err2: @@ -169,7 +169,7 @@ err0: return 1; } -int file_to_flash(int fd, u_int32_t offset, u_int32_t len, const char *filename) +int file_to_flash(int fd, off_t offset, u_int32_t len, const char *filename) { u_int8_t *buf = NULL; FILE *fp; @@ -221,7 +221,7 @@ retry: if (buf != NULL) free(buf); fclose(fp); - printf("Copied %d bytes from %s to address 0x%.8x in flash\n", len, filename, offset); + printf("Copied %d bytes from %s to address 0x%.8"PRIxoff_t" in flash\n", len, filename, offset); return 0; } @@ -376,13 +376,13 @@ int main(int argc, char *argv[]) showinfo(fd); break; case OPT_READ: - err = flash_to_file(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0), argv[5]); + err = flash_to_file(fd, strtoll(argv[3], NULL, 0), strtoul(argv[4], NULL, 0), argv[5]); break; case OPT_WRITE: - err = file_to_flash(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0), argv[5]); + err = file_to_flash(fd, strtoll(argv[3], NULL, 0), strtoul(argv[4], NULL, 0), argv[5]); break; case OPT_ERASE: - err = erase_flash(fd, strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0)); + err = erase_flash(fd, strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0)); break; } |