]> git.sur5r.net Git - openocd/commitdiff
struct fileio: improve member types
authorZachary T Welch <zw@superlucidity.net>
Fri, 13 Nov 2009 22:22:21 +0000 (14:22 -0800)
committerZachary T Welch <zw@superlucidity.net>
Mon, 16 Nov 2009 23:47:09 +0000 (15:47 -0800)
Add const keyword to file url and cast to free().

Make size an ssize_t and chase all format strings that use it.

src/flash/flash.c
src/flash/mflash.c
src/flash/nand.c
src/helper/fileio.c
src/helper/fileio.h
src/target/target.c

index bdee53b626fea28f70f632f27a72dadf6ed6e14e..03d4547d407df8307e6585479e991108da2ad1c1 100644 (file)
@@ -847,7 +847,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(cmd_ctx, "wrote %lld byte from file %s to flash bank %u"
+               command_print(cmd_ctx, "wrote %zu byte from file %s to flash bank %u"
                                " at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
                                fileio.size, args[1], p->bank_number, offset,
                                duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
index 49dc432f36eb002c7a41c5b384264a1a5c15f23b..4356f2709b30e812e8f836ad3addc8b0b133036e 100644 (file)
@@ -750,7 +750,7 @@ COMMAND_HANDLER(mg_write_cmd)
 
        if (duration_measure(&bench) == ERROR_OK)
        {
-               command_print(cmd_ctx, "wrote %lli byte from file %s "
+               command_print(cmd_ctx, "wrote %zu byte from file %s "
                                "in %fs (%0.3f kB/s)", fileio.size, args[1],
                                duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
        }
index fba8104a636d66736b86c27d14e418e39442a39b..9d997fadd8a25127cadc9f3b835e7db5e21a26b3 100644 (file)
@@ -1637,7 +1637,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
 
        if (nand_fileio_finish(&s) == ERROR_OK)
        {
-               command_print(cmd_ctx, "dumped %lld byte in %fs (%0.3f kb/s)", 
+               command_print(cmd_ctx, "dumped %zu bytes in %fs (%0.3f kb/s)", 
                                s.fileio.size, duration_elapsed(&s.bench),
                                duration_kbps(&s.bench, s.fileio.size));
        }
index 71cae758150fb5a4d7bbe2d68a18766061fb03cc..84d46bd57665f3ff3457a4fddf1f09ed4a281f6a 100644 (file)
@@ -137,7 +137,7 @@ int fileio_close(struct fileio *fileio)
 
        retval = fileio_close_local(fileio);
 
-       free(fileio->url);
+       free((void*)fileio->url);
        fileio->url = NULL;
 
        return retval;
index 8cba926a087eb1dc523bf1b3e3e94720eef55348..6ed6fe454e7f4c918e882b584e2e3c3459018f04 100644 (file)
@@ -47,8 +47,8 @@ enum fileio_access
 };
 
 struct fileio {
-       char *url;
-       long long size;
+       const char *url;
+       ssize_t size;
        enum fileio_type type;
        enum fileio_access access;
        FILE *file;
index c24085f142a0f116e6f905c6f8789a4e096b2347..f141e933f3865214290ef2ae03ddafb1e0058460 100644 (file)
@@ -2543,7 +2543,7 @@ COMMAND_HANDLER(handle_dump_image_command)
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
                command_print(cmd_ctx,
-                               "dumped %lld bytes in %fs (%0.3f kb/s)", fileio.size,
+                               "dumped %zu bytes in %fs (%0.3f kb/s)", fileio.size,
                                duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
        }