diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:06:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:58:36 +0000 |
commit | 556373c41fddbac6cbee1c89e7707631270a1852 (patch) | |
tree | 026862690693419beb8810fdc6671ae30c72a026 /basic | |
parent | 62b124b2704adf11a63681164d05a8eb49dfb105 (diff) |
V668 no sense in testing the result of new against null
Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/image.cxx | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 338ed0218ec3..d99259b0082c 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -383,16 +383,9 @@ void SbiImage::MakeStrings( short nSize ) nStringSize = 1024; pStrings = new sal_Unicode[ nStringSize ]; pStringOff = new sal_uInt32[ nSize ]; - if( pStrings && pStringOff ) - { - nStrings = nSize; - memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) ); - memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); - } - else - { - bError = true; - } + nStrings = nSize; + memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) ); + memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); } // Add a string to StringPool. The String buffer is dynamically @@ -415,18 +408,11 @@ void SbiImage::AddString( const OUString& r ) { sal_uInt32 nNewLen = needed + 1024; nNewLen &= 0xFFFFFC00; // trim to 1K border - sal_Unicode* p = NULL; - if( (p = new sal_Unicode[ nNewLen ]) != NULL ) - { - memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); - delete[] pStrings; - pStrings = p; - nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen); - } - else - { - bError = true; - } + sal_Unicode* p = new sal_Unicode[nNewLen]; + memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); + delete[] pStrings; + pStrings = p; + nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen); } if( !bError ) { |