[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-0' - codemaker/source

Stephan Bergmann sbergman at redhat.com
Fri Jan 10 12:33:56 PST 2014


 codemaker/source/codemaker/global.cxx |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit cfb3455bba641f43178abd2600ffc57b05930bf6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 10 10:16:48 2014 +0100

    codemaker: fix^2 invalid string index access
    
    ...originally the past-the-end checks in destination where always true, and thus
    happend to work as intended for empty destionation, but
    614e04019a672cdd61b86699d99250d80f169f95 broke that, so calling cppumaker w/o
    -O was broken now.
    
    Change-Id: I8d41dfe8d4c12e4a73a9782d4d5e7c9fa4d9df81
    (cherry picked from commit d320760dc1c9d6501d84849219b4d9fc6c62b85b)
    Reviewed-on: https://gerrit.libreoffice.org/7361
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx
index ba3f424..54ceeb1 100644
--- a/codemaker/source/codemaker/global.cxx
+++ b/codemaker/source/codemaker/global.cxx
@@ -87,11 +87,8 @@ OString createFileNameFromType( const OString& destination,
     length += prefix.getLength() + type.getLength() + postfix.getLength();
 
     sal_Bool withSeparator = sal_False;
-    if (!destination.isEmpty() &&
-        destination[destination.getLength() - 1] != '\\' &&
-        destination[destination.getLength() - 1] != '/' &&
-        type[0] != '\\' &&
-        type[0] != '/')
+    if (!(destination.endsWith("\\") || destination.endsWith("/"))
+        && !(type.startsWith("\\") || type.startsWith("/")))
     {
         length++;
         withSeparator = sal_True;


More information about the Libreoffice-commits mailing list