From 38f0004a90cf457683185a9d04c2ec84aede3f17 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Mon, 9 Jun 2003 22:09:08 +0000 Subject: [PATCH] 2003-06-09 Marcel Telka * cmd/cmd.c (cmd_get_number): Added variable initialization for %n conversion in sscanf() call. * cmd/help.c (cmd_help_run): Removed duplicate 'i' variable declaration. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@473 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- libbrux/ChangeLog | 5 +++++ libbrux/cmd/cmd.c | 6 +++++- libbrux/cmd/help.c | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libbrux/ChangeLog b/libbrux/ChangeLog index 29c7dcc6..e483cbc7 100644 --- a/libbrux/ChangeLog +++ b/libbrux/ChangeLog @@ -1,3 +1,8 @@ +2003-06-09 Marcel Telka + + * cmd/cmd.c (cmd_get_number): Added variable initialization for %n conversion in sscanf() call. + * cmd/help.c (cmd_help_run): Removed duplicate 'i' variable declaration. + 2003-06-03 Marcel Telka * flash/detectflash.c (detectflash): Renamed detect_cfi to cfi_detect. diff --git a/libbrux/cmd/cmd.c b/libbrux/cmd/cmd.c index 0e4ee1aa..f4a819ba 100644 --- a/libbrux/cmd/cmd.c +++ b/libbrux/cmd/cmd.c @@ -65,15 +65,19 @@ cmd_get_number( char *s, unsigned int *i ) { int n; int r; - int l; + size_t l; if (!s || !i) return -1; l = strlen( s ); + + n = -1; r = sscanf( s, "0x%x%n", i, &n); if (r == 1 && n == l) return 0; + + n = -1; r = sscanf( s, "%u%n", i, &n ); if (r == 1 && n == l) return 0; diff --git a/libbrux/cmd/help.c b/libbrux/cmd/help.c index 916d464d..05a04c81 100644 --- a/libbrux/cmd/help.c +++ b/libbrux/cmd/help.c @@ -36,7 +36,6 @@ cmd_help_run( char *params[] ) /* short description generation */ if (!params[1]) { - int i; printf( _("Command list:\n\n") ); for (i = 0; cmds[i]; i++) printf( _("%-13s %s\n"), cmds[i]->name, cmds[i]->desc ? _(cmds[i]->desc) : _("(no description available)") );