On 2009-12-24 23:07, David Brownell wrote:
A better fix would be to use "%zd" (for ssize_t, "%d" signed)
not "%zu" (for size_t, "%u" unsigned).

Can you submit a patch for all these build problems?

It seems that MinGW for Windows doesn't understand "%zd" (to be exact the "z" is not implemented), so I think that it's better to print size_t as "%lu". See the attached patch

4\/3!!
>From 1413cdd9839ad0873cd6b06f01e8755c80ead8bc Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie_cho...@op.pl>
Date: Fri, 25 Dec 2009 15:55:59 +0100
Subject: [PATCH] size_t is printed as "%lu" not as "%zu" - official MinGW 
doesn't understand "z" flag

Signed-off-by: Freddie Chopin <freddie_cho...@op.pl>
---
 src/flash/mflash.c   |    2 +-
 src/flash/nand/tcl.c |    2 +-
 src/flash/nor/tcl.c  |    2 +-
 src/target/target.c  |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/flash/mflash.c b/src/flash/mflash.c
index 123d61c..a038ba5 100644
--- a/src/flash/mflash.c
+++ b/src/flash/mflash.c
@@ -751,7 +751,7 @@ COMMAND_HANDLER(mg_write_cmd)
 
        if (duration_measure(&bench) == ERROR_OK)
        {
-               command_print(CMD_CTX, "wrote %zu byte from file %s "
+               command_print(CMD_CTX, "wrote %lu byte from file %s "
                                "in %fs (%0.3f kB/s)", fileio.size, CMD_ARGV[1],
                                duration_elapsed(&bench), duration_kbps(&bench, 
fileio.size));
        }
diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c
index ad77d7c..b822ad0 100644
--- a/src/flash/nand/tcl.c
+++ b/src/flash/nand/tcl.c
@@ -409,7 +409,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
 
        if (nand_fileio_finish(&s) == ERROR_OK)
        {
-               command_print(CMD_CTX, "dumped %zu bytes in %fs (%0.3f kb/s)", 
+               command_print(CMD_CTX, "dumped %lu bytes in %fs (%0.3f kb/s)", 
                                s.fileio.size, duration_elapsed(&s.bench),
                                duration_kbps(&s.bench, s.fileio.size));
        }
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index b5e1b2c..f48fa4e 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -625,7 +625,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(CMD_CTX, "wrote %zu byte from file %s to flash 
bank %u"
+               command_print(CMD_CTX, "wrote %lu byte from file %s to flash 
bank %u"
                                " at offset 0x%8.8" PRIx32 " in %fs (%0.3f 
kb/s)",
                                fileio.size, CMD_ARGV[1], p->bank_number, 
offset,
                                duration_elapsed(&bench), duration_kbps(&bench, 
fileio.size));
diff --git a/src/target/target.c b/src/target/target.c
index ebddbba..043cfee 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2488,7 +2488,7 @@ COMMAND_HANDLER(handle_dump_image_command)
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
                command_print(CMD_CTX,
-                               "dumped %zu bytes in %fs (%0.3f kb/s)", 
fileio.size,
+                               "dumped %lu bytes in %fs (%0.3f kb/s)", 
fileio.size,
                                duration_elapsed(&bench), duration_kbps(&bench, 
fileio.size));
        }
 
-- 
1.6.5.1.1367.gcd48

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to