Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 88647 invoked from network); 6 Sep 2008 19:46:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Sep 2008 19:46:29 -0000 Received: (qmail 77945 invoked by uid 500); 6 Sep 2008 19:46:27 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 77928 invoked by uid 500); 6 Sep 2008 19:46:27 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 77919 invoked by uid 99); 6 Sep 2008 19:46:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Sep 2008 12:46:27 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Sep 2008 19:45:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3524A238898F; Sat, 6 Sep 2008 12:46:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r692714 - /stdcxx/branches/4.2.x/src/locale_combine.cpp Date: Sat, 06 Sep 2008 19:46:09 -0000 To: commits@stdcxx.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080906194609.3524A238898F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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]);