summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-10 10:16:48 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-10 10:16:48 +0100
commitd320760dc1c9d6501d84849219b4d9fc6c62b85b (patch)
treea2797b6f7502fa48109c4d0ba99c3b80c7a14b35
parent16ae82c772cd818316a19ce303d349657f6cb863 (diff)
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
-rw-r--r--codemaker/source/codemaker/global.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx
index ba3f42484d5a..54ceeb1dc8bd 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;