diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-10 20:47:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-11 11:20:43 +0200 |
commit | 2d582244680e7f6dec6e4a466e276f93ccb01dc9 (patch) | |
tree | b0e880ddfb3ce1ea2f47151b648e7fbb55132f08 /sax | |
parent | 74012c48d99634a7556a86f77e9522024f2afdb2 (diff) |
loplugin:flatten
Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastattribs.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 3df391c86150..c021e892f91e 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -85,13 +85,13 @@ void FastAttributeList::add( sal_Int32 nToken, const char* pValue, size_t nValue if (maAttributeValues.back() > mnChunkLength) { const sal_Int32 newLen = std::max(mnChunkLength * 2, maAttributeValues.back()); - if (auto p = static_cast<char*>(realloc(mpChunk, newLen))) - { - mnChunkLength = newLen; - mpChunk = p; - } - else + auto p = static_cast<char*>(realloc(mpChunk, newLen)); + if (!p) throw std::bad_alloc(); + + mnChunkLength = newLen; + mpChunk = p; + } strncpy(mpChunk + nWritePosition, pValue, nValueLength); mpChunk[nWritePosition + nValueLength] = '\0'; |