public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options
@ 2008-07-14 12:11 Jean-Christophe PLAGNIOL-VILLARD
  2008-07-14 12:11 ` [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues Jean-Christophe PLAGNIOL-VILLARD
  2008-07-14 12:37 ` [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-07-14 12:11 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 lib_generic/vsprintf.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c
index 3db6c3f..1d9b25b 100644
--- a/lib_generic/vsprintf.c
+++ b/lib_generic/vsprintf.c
@@ -262,7 +262,9 @@ int vsprintf(char *buf, const char *fmt, va_list args)
 
 		/* get the conversion qualifier */
 		qualifier = -1;
-		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'q') {
+		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
+		    *fmt =='Z' || *fmt == 'z' || *fmt == 't' ||
+		    *fmt == 'q' ) {
 			qualifier = *fmt;
 			if (qualifier == 'l' && *(fmt+1) == 'l') {
 				qualifier = 'q';
@@ -355,9 +357,13 @@ int vsprintf(char *buf, const char *fmt, va_list args)
 			num = va_arg(args, unsigned long long);
 		else
 #endif
-		if (qualifier == 'l')
+		if (qualifier == 'l') {
 			num = va_arg(args, unsigned long);
-		else if (qualifier == 'h') {
+		} else if (qualifier == 'Z' || qualifier == 'z') {
+			num = va_arg(args, size_t);
+		} else if (qualifier == 't') {
+			num = va_arg(args, ptrdiff_t);
+		} else if (qualifier == 'h') {
 			num = (unsigned short) va_arg(args, int);
 			if (flags & SIGN)
 				num = (short) num;
-- 
1.5.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues.
  2008-07-14 12:11 [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Jean-Christophe PLAGNIOL-VILLARD
@ 2008-07-14 12:11 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-07-14 20:59   ` Wolfgang Denk
  2008-07-14 12:37 ` [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Wolfgang Denk
  1 sibling, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-07-14 12:11 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/cmd_flash.c     |    4 ++--
 drivers/usb/usbdcore.c |    2 +-
 fs/jffs2/jffs2_1pass.c |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index 9bd8074..d959c3d 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -342,7 +342,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			puts ("Bad sector specification\n");
 			return 1;
 		}
-		printf ("Erase Flash Sectors %d-%d in Bank # %d ",
+		printf ("Erase Flash Sectors %d-%d in Bank # %zu ",
 			sect_first, sect_last, (info-flash_info)+1);
 		rcode = flash_erase(info, sect_first, sect_last);
 		return rcode;
@@ -534,7 +534,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 			puts ("Bad sector specification\n");
 			return 1;
 		}
-		printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
+		printf("%sProtect Flash Sectors %d-%d in Bank # %zu\n",
 			p ? "" : "Un-", sect_first, sect_last,
 			(info-flash_info)+1);
 		for (i = sect_first; i <= sect_last; i++) {
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/usbdcore.c
index 808da9f..53ed669 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/usbdcore.c
@@ -552,7 +552,7 @@ struct urb *usbd_alloc_urb (struct usb_device_instance *device,
 	struct urb *urb;
 
 	if (!(urb = (struct urb *) malloc (sizeof (struct urb)))) {
-		usberr (" F A T A L:  malloc(%u) FAILED!!!!",
+		usberr (" F A T A L:  malloc(%zu) FAILED!!!!",
 			sizeof (struct urb));
 		return NULL;
 	}
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 5c1d265..3c454f6 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -1213,12 +1213,12 @@ jffs2_1pass_build_lists(struct part_info * part)
 			} else if (node->nodetype == JFFS2_NODETYPE_CLEANMARKER) {
 				if (node->totlen != sizeof(struct jffs2_unknown_node))
 					printf("OOPS Cleanmarker has bad size "
-						"%d != %u\n", node->totlen,
+						"%d != %zu\n", node->totlen,
 						sizeof(struct jffs2_unknown_node));
 			} else if (node->nodetype == JFFS2_NODETYPE_PADDING) {
 				if (node->totlen < sizeof(struct jffs2_unknown_node))
 					printf("OOPS Padding has bad size "
-						"%d < %u\n", node->totlen,
+						"%d < %zu\n", node->totlen,
 						sizeof(struct jffs2_unknown_node));
 			} else {
 				printf("Unknown node type: %x len %d "
-- 
1.5.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options
  2008-07-14 12:11 [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Jean-Christophe PLAGNIOL-VILLARD
  2008-07-14 12:11 ` [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues Jean-Christophe PLAGNIOL-VILLARD
@ 2008-07-14 12:37 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-07-14 12:37 UTC (permalink / raw)
  To: u-boot

In message <1216037506-20460-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  lib_generic/vsprintf.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The optimum committee has no members.
                                                   - Norman Augustine

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues.
  2008-07-14 12:11 ` [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues Jean-Christophe PLAGNIOL-VILLARD
@ 2008-07-14 20:59   ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-07-14 20:59 UTC (permalink / raw)
  To: u-boot

In message <1216037506-20460-2-git-send-email-plagnioj@jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  common/cmd_flash.c     |    4 ++--
>  drivers/usb/usbdcore.c |    2 +-
>  fs/jffs2/jffs2_1pass.c |    4 ++--
>  3 files changed, 5 insertions(+), 5 deletions(-)

Thanks, but your patch catches only a  small  part  of  all  uses  of
sizeof_t  in  printf() and debug() calls. I tried to find and fix the
other locations, too - see "[PATCH] Fix printf() format  issues  with
sizeof_t types by using %zu"

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The universe does not have laws - it has habits, and  habits  can  be
broken.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-14 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14 12:11 [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Jean-Christophe PLAGNIOL-VILLARD
2008-07-14 12:11 ` [U-Boot-Users] [PATCH 1/1] Fix some more printf() format issues Jean-Christophe PLAGNIOL-VILLARD
2008-07-14 20:59   ` Wolfgang Denk
2008-07-14 12:37 ` [U-Boot-Users] [PATCH 0/1] vsprintf: add z and t options Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox