diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-15 17:08:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-18 09:07:22 +0200 |
commit | 4738866207eadddf968bf07e08d478754c45368b (patch) | |
tree | 8a0df471d3f07bc0ff14421c4338c45d5b386279 /sw/source/filter/ww8/ww8par.cxx | |
parent | 3ec0bbd2e4b11fb94a62bf70f5d07fc044de731b (diff) |
loplugin:useuniqueptr in SwWW8ImplReader::ReadPlainChars
Change-Id: I677d9b229d1c9f69d74b4fbde9b81124bd1ddd12
Reviewed-on: https://gerrit.libreoffice.org/60611
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/ww8par.cxx')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 92d9e9ec5a4f..fbcddce801cf 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3050,14 +3050,14 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp sal_Unicode* pBuffer = pStr->buffer; sal_Unicode* pWork = pBuffer; - sal_Char* p8Bits = nullptr; + std::unique_ptr<sal_Char[]> p8Bits; rtl_TextToUnicodeConverter hConverter = nullptr; if (!m_bIsUnicode || m_bVer67) hConverter = rtl_createTextToUnicodeConverter(eSrcCharSet); if (!m_bIsUnicode) - p8Bits = new sal_Char[nStrLen]; + p8Bits.reset( new sal_Char[nStrLen] ); // read the stream data sal_uInt8 nBCode = 0; @@ -3083,7 +3083,6 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp { rPos = WW8_CP_MAX-10; // -> eof or other error std::free(pStr); - delete [] p8Bits; return true; } @@ -3122,7 +3121,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp if (nL2) { const sal_Int32 nEndUsed = !m_bIsUnicode - ? Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nStrLen) + ? Custom8BitToUnicode(hConverter, p8Bits.get(), nL2, pBuffer, nStrLen) : pWork - pBuffer; if (m_bRegardHindiDigits && m_bBidi && LangUsesHindiNumbers(nCTLLang)) @@ -3145,7 +3144,6 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp rtl_destroyTextToUnicodeConverter(hConverter); if (pStr) rtl_uString_release(pStr); - delete [] p8Bits; return nL2 >= nStrLen; } |