Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1593)

Unified Diff: gdb/common/format.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/common/format.h ('k') | gdb/common/gdb_assert.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/common/format.c
diff --git a/gdb/common/format.c b/gdb/common/format.c
index 9c22b6d060c51bbd4204a23d2c1d9ddcc6eb695c..985e0e4be55a76e4619fb50162009303974d4cd8 100644
--- a/gdb/common/format.c
+++ b/gdb/common/format.c
@@ -1,6 +1,6 @@
/* Parse a printf-style format string.
- Copyright (C) 1986-2012 Free Software Foundation, Inc.
+ Copyright (C) 1986-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,11 +28,12 @@
#include "format.h"
struct format_piece *
-parse_format_string (char **arg)
+parse_format_string (const char **arg)
{
- char *s, *f, *string;
- char *prev_start;
- char *percent_loc;
+ const char *s;
+ char *f, *string;
+ const char *prev_start;
+ const char *percent_loc;
char *sub_start, *current_substring;
struct format_piece *pieces;
int next_frag;
@@ -155,7 +156,7 @@ parse_format_string (char **arg)
/* The first part of a format specifier is a set of flag
characters. */
- while (strchr ("0-+ #", *f))
+ while (*f != '\0' && strchr ("0-+ #", *f))
{
if (*f == '#')
seen_hash = 1;
@@ -169,7 +170,7 @@ parse_format_string (char **arg)
}
/* The next part of a format specifier is a width. */
- while (strchr ("0123456789", *f))
+ while (*f != '\0' && strchr ("0123456789", *f))
f++;
/* The next part of a format specifier is a precision. */
@@ -177,7 +178,7 @@ parse_format_string (char **arg)
{
seen_prec = 1;
f++;
- while (strchr ("0123456789", *f))
+ while (*f != '\0' && strchr ("0123456789", *f))
f++;
}
@@ -245,10 +246,10 @@ parse_format_string (char **arg)
this_argclass = long_arg;
else
this_argclass = long_long_arg;
-
- if (seen_big_l)
- bad = 1;
- break;
+
+ if (seen_big_l)
+ bad = 1;
+ break;
case 'c':
this_argclass = lcount == 0 ? int_arg : wide_char_arg;
@@ -262,7 +263,9 @@ parse_format_string (char **arg)
this_argclass = ptr_arg;
if (lcount || seen_h || seen_big_l)
bad = 1;
- if (seen_prec || seen_zero || seen_space || seen_plus)
+ if (seen_prec)
+ bad = 1;
+ if (seen_hash || seen_zero || seen_space || seen_plus)
bad = 1;
break;
@@ -286,9 +289,9 @@ parse_format_string (char **arg)
else
this_argclass = double_arg;
- if (lcount || seen_h)
- bad = 1;
- break;
+ if (lcount || seen_h)
+ bad = 1;
+ break;
case '*':
error (_("`*' not supported for precision or width in printf"));
« no previous file with comments | « gdb/common/format.h ('k') | gdb/common/gdb_assert.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698