Author: sebor
Date: Sat Sep 6 12:46:08 2008
New Revision: 692714
URL: http://svn.apache.org/viewvc?rev=692714&view=rev
Log:
2008-09-06 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-1012
* src/locale_combine.cpp (_C_get_body): Shut up bogus HP aCC
(cadvise) warnings #20200-D: Potential null pointer dereference.
Modified:
stdcxx/branches/4.2.x/src/locale_combine.cpp
Modified: stdcxx/branches/4.2.x/src/locale_combine.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/locale_combine.cpp?rev=692714&r1=692713&r2=692714&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/locale_combine.cpp (original)
+++ stdcxx/branches/4.2.x/src/locale_combine.cpp Sat Sep 6 12:46:08 2008
@@ -502,15 +502,12 @@
const char *pcatnames [__rw_n_cats] = { 0 };
// try the libc "native" separator first, semicolon next
- const char *sep = strchr (locname, *_RWSTD_CAT_SEP);
- if (!sep)
- sep = ";";
-
- for (const char *s = locname; *s; ) {
-
- const char *next = strchr (s, *sep);
- if (!next)
- next = s + strlen (s);
+ const char* const psep = strchr (locname, *_RWSTD_CAT_SEP);
+ const char sep = psep ? *psep : ';';
+
+ // redundant check for s being non-null shuts up a bogus
+ // HP cadvise null pointer derefence warning #20200
+ for (const char *s = locname; s && *s; ) {
const char* const endcat = strchr (s, '=');
if (!endcat)
@@ -530,7 +527,9 @@
}
}
- s = *next ? next + 1 : next;
+ // advance just past the next separator if one exists
+ const char* const next = strchr (s, sep);
+ s = next ? next + 1 : s + strlen (s);
}
// compose a normalized locale name out of category names
@@ -542,7 +541,7 @@
pcatnames [i] = "C";
}
- const char *endcat = strchr (pcatnames [i], *sep);
+ const char *endcat = strchr (pcatnames [i], sep);
if (!endcat)
endcat = pcatnames [i] + strlen (pcatnames [i]);