[Libreoffice-commits] core.git: autodoc/source

Norbert Thiebaud nthiebaud at gmail.com
Tue Feb 19 06:16:51 PST 2013


 autodoc/source/display/idl/hfi_typetext.cxx |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 396eb4f5cf8b37cd2a9f14d85764e03761ade19f
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Feb 18 00:47:58 2013 -0600

    coverity#440141 Null Dereference
    
    Change-Id: Ifdbfecdb5443024f7186882cf09d8fba998e94f2
    Reviewed-on: https://gerrit.libreoffice.org/2213
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/autodoc/source/display/idl/hfi_typetext.cxx b/autodoc/source/display/idl/hfi_typetext.cxx
index a100066..03c4b26 100644
--- a/autodoc/source/display/idl/hfi_typetext.cxx
+++ b/autodoc/source/display/idl/hfi_typetext.cxx
@@ -543,23 +543,19 @@ int
 HF_IdlTypeText::count_Sequences( const char * i_sFullType ) const
 {
     int ret = 0;
+    const char* pCount = i_sFullType;
 
-    for ( const char * pCount = i_sFullType;
-          *pCount != 0;
-           )
+    while((pCount = strstr(pCount,"sequence")) != 0)
     {
-        pCount = strstr(pCount,"sequence");
-        if (pCount != 0)
+
+        pCount += sizeof("sequence");   // = strlen(sequence) + 1 for '<'.
+        if ( *(pCount-1) == '\0' )
         {
-            pCount += sizeof("sequence");   // = strlen(sequence) + 1 for '<'.
-            if ( *(pCount-1) == '\0' )
-            {
-                // SYNTAX_ERR
-                return 0;
-            }
-            ++ret;
+            // SYNTAX_ERR
+            return 0;
         }
-    }   // end for
+        ret += 1;
+    }
 
     return ret;
 }


More information about the Libreoffice-commits mailing list