]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance the *mangled pointer...
authorStu Grossman <grossman@babylon-5.cygnus.com>
Mon, 17 May 1999 00:44:09 +0000 (00:44 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 17 May 1999 00:44:09 +0000 (18:44 -0600)
        * 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.

From-SVN: r26959

libiberty/ChangeLog
libiberty/cplus-dem.c

index f5e0928a73a66459833a0ee2c246be73bbc4496f..caf12de495bfe00a86952ef647b1d159afd7a687 100644 (file)
@@ -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.
index 706d929cca713e7d9675bdb220d117e0e7b76607..6d51710685c6001eadbf0cd224bf471faeb97fba 100644 (file)
@@ -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);