Skip to contentSkip to conversation

fix compiler warnings: use puts() instead of printf()

RFC In review Fabio Porcedda 1 participant 2 messages Feb 20, 2013

lore
Share & tools
lore
#0 lore raw

RFC 1/1 fix compiler warnings: use puts() instead of printf()

Use puts() because printf() isn't needed,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ?menu_show?:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ?read_asic_id?:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
 			printf("Auto Select in");
 		} else {
 			auto_display_len = strlen(m->auto_display);
-			printf(m->auto_display);
+			puts(m->auto_display);
 		}
 		printf(" %2d", countdown--);
 	}
scripts/omap4_usbboot.c +1 -1
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
 			sprintf(line+4+j*3, "%02X ", id[i+j]);
 		line[4+j*3+0] = '\n';
 		line[4+j*3+1] = 0;
-		printf(line);
+		puts(line);
 	}
 	ret = 0;
 	for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
Signature · 1 line
1.8.1.1
#1 lore raw
Quoted 42 lines · Fabio Porcedda

Use puts() because printf() isn't needed,
to fix the following compiler warnings:

/barebox/common/menu.c: In function ?menu_show?:
/barebox/common/menu.c:277:4: warning: format not a string literal and no format arguments [-Wformat-security]

/barebox/scripts/omap4_usbboot.c: In function ?read_asic_id?:
/barebox/scripts/omap4_usbboot.c:101:3: warning: format not a string literal and no format arguments [-Wformat-security]

---
 common/menu.c           | 2 +-
 scripts/omap4_usbboot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/menu.c +1 -1
index ce93838..30dced7 100644
@@ -274,7 +274,7 @@ int menu_show(struct menu *m)
                        printf("Auto Select in");
                } else {
                        auto_display_len = strlen(m->auto_display);
-                       printf(m->auto_display);
+                       puts(m->auto_display);
                }
                printf(" %2d", countdown--);
        }
scripts/omap4_usbboot.c +1 -2
index 8c5775d..34e53c0 100644
@@ -98,7 +98,7 @@ int read_asic_id(struct usb_handle *usb)
                        sprintf(line+4+j*3, "%02X ", id[i+j]);
                line[4+j*3+0] = '\n';
                line[4+j*3+1] = 0;
-               printf(line);
+               puts(line);
        }
        ret = 0;
        for (i = 1, j = 0; i < sizeof(id) && j < id[0]; i += 2+id[i+1], j++) {
--
Quoted 2 lines

1.8.1.1

I'm sorry, i've sent to the wrong mailing list.

Best regards

Signature · 1 line
Fabio Porcedda