summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-21 13:40:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-21 14:01:28 +0100
commiteea5ad99994d279adc3d5897080c58f90b374536 (patch)
tree2788659c1ac2bf2e21711d9775c5e9cd49b4ce16 /sal
parent7e1d81cc9c8677a19f1f5f1adabbe23794828a3a (diff)
cppcheck: redundantCopy
Change-Id: I209b55a6ef962d4a350327e56c4d16c8180a21e0
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/oustring/rtl_ustr.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sal/qa/rtl/oustring/rtl_ustr.cxx b/sal/qa/rtl/oustring/rtl_ustr.cxx
index bbf62f515ca5..4fc33eab4218 100644
--- a/sal/qa/rtl/oustring/rtl_ustr.cxx
+++ b/sal/qa/rtl/oustring/rtl_ustr.cxx
@@ -518,8 +518,8 @@ namespace rtl_ustr
sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
sal_Unicode* pStr = (sal_Unicode*) malloc( nLength + sizeof(sal_Unicode)); // length + 1 (null terminator)
CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode));
memcpy(pStr, aStr1.getStr(), nLength);
+ pStr[aStr1.getLength()] = 0;
rtl_ustr_replaceChar( pStr, 'e', 'u' );
rtl::OUString suStr(pStr, aStr1.getLength());
@@ -614,8 +614,8 @@ namespace rtl_ustr
sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode) ); // we need to add '\0' so one more
CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode)); // empty the sal_Unicode array
memcpy(pStr, aStr1.getStr(), nLength);
+ pStr[aStr1.getLength()] = 0;
rtl_ustr_toAsciiLowerCase( pStr );
rtl::OUString suStr(pStr, aStr1.getLength());
@@ -693,8 +693,8 @@ namespace rtl_ustr
sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator
CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode));
memcpy(pStr, aStr1.getStr(), nLength);
+ pStr[aStr1.getLength()] = 0;
rtl_ustr_toAsciiUpperCase( pStr );
rtl::OUString suStr(pStr, aStr1.getLength());