diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-10-16 22:53:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-17 09:03:53 +0200 |
commit | c8eaadb5d70f42723517bb028f363e37726be256 (patch) | |
tree | 6d91ba30db1dde2c0ad00f0bd453bed937d98660 /idlc | |
parent | 7972ce0d6bc22a36d7fbaaa19bed11ec4cfe52d7 (diff) |
Remaining loplugin:bufferadd
...that had been missing because the plugin didn't implement postRun, so it
didn't report anything when run as part of the shared plugin. (But did report
the expected warnings when run as a standalone plugin during
CompilerTest_compilerplugins_clang.)
Most fixes are straightforward. A noteworthy one is PreparedStatement::setBytes
in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx: The old
preallocation of a 20 character OStringBuffer might have prevented
buf.append( reinterpret_cast<char *>(escapedString), len -1 );
from potentially throwing std::bad_alloc, which would have caused escapedString
to be leaked. Even though that 20-character preallocation was likely just
random junk and not meant to address the potential leak, lets address it now.
Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900
Reviewed-on: https://gerrit.libreoffice.org/80925
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/source/options.cxx | 8 | ||||
-rw-r--r-- | idlc/source/parser.y | 7 |
2 files changed, 4 insertions, 11 deletions
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index c3a19a365267..d9b0003a60cb 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -274,9 +274,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) if (m_options.count("-I") > 0) { // append param. - OStringBuffer buffer(m_options["-I"]); - buffer.append(' '); buffer.append(param); - param = buffer.makeStringAndClear(); + param = m_options["-I"] + " " + param; } m_options["-I"] = param; break; @@ -291,9 +289,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) param += OString((*first).c_str(), (*first).size()); if (m_options.count("-D") > 0) { - OStringBuffer buffer(m_options["-D"]); - buffer.append(' '); buffer.append(param); - param = buffer.makeStringAndClear(); + param = m_options["-D"] + " " + param; } m_options["-D"] = param; break; diff --git a/idlc/source/parser.y b/idlc/source/parser.y index 083153c1827a..9c055d920a33 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -48,7 +48,7 @@ #include "attributeexceptions.hxx" -#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> #include <osl/diagnose.h> #include <algorithm> @@ -75,10 +75,7 @@ static void checkIdentifier(OString const * id) if ( (id->pData->buffer[0] >= 97 && id->pData->buffer[0] <= 122) || id->pData->buffer[0] == '_') { if (check == 1) { - OStringBuffer msg(25 + id->getLength()); - msg.append("mismatched identifier '"); - msg.append(*id); - msg.append("'"); + OString msg = "mismatched identifier '" + *id + "'"; ErrorHandler::syntaxError(idlc()->getParseState(), idlc()->getLineNumber(), msg.getStr()); |