diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-05-17 00:44:09 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-05-17 00:44:09 +0000 |
commit | 4198061159352ddab2fa733a264b395406165de9 (patch) | |
tree | cfb9111185284ec86eea5dc7777f4ae27bca7706 /libiberty | |
parent | c69ad72413dd888aa3f83502c07a452afdfa5c9a (diff) | |
download | gcc-4198061159352ddab2fa733a264b395406165de9.tar.gz |
* cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance
the *mangled pointer beyond the end of the string. Clean up code to
match prevailing coding style.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26959 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index f5e0928a73a..caf12de495b 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +Mon May 17 01:42:34 1999 Stu Grossman <grossman@babylon-5.cygnus.com> + + * cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance + the *mangled pointer beyond the end of the string. Clean up code to + match prevailing coding style. + 1999-05-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz> * tmpnam.c (L_tmpnam): Fix typo. diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 706d929cca7..6d51710685c 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -51,6 +51,8 @@ char * realloc (); #include "libiberty.h" +#define min(X,Y) (((X) < (Y)) ? (X) : (Y)) + static const char *mystrstr PARAMS ((const char *, const char *)); static const char * @@ -3373,14 +3375,14 @@ demangle_fund_type (work, mangled, result) break; } case 'I': - ++(*mangled); + (*mangled)++; if (**mangled == '_') { int i; - ++(*mangled); + (*mangled)++; for (i = 0; - (i < sizeof (buf) - 1 && **mangled && **mangled != '_'); - ++(*mangled), ++i) + i < sizeof (buf) - 1 && **mangled && **mangled != '_'; + (*mangled)++, i++) buf[i] = **mangled; if (**mangled != '_') { @@ -3388,13 +3390,13 @@ demangle_fund_type (work, mangled, result) break; } buf[i] = '\0'; - ++(*mangled); + (*mangled)++; } else { strncpy (buf, *mangled, 2); buf[2] = '\0'; - *mangled += 2; + *mangled += min (strlen (*mangled), 2); } sscanf (buf, "%x", &dec); sprintf (buf, "int%i_t", dec); |