summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-16 22:53:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-17 09:03:53 +0200
commitc8eaadb5d70f42723517bb028f363e37726be256 (patch)
tree6d91ba30db1dde2c0ad00f0bd453bed937d98660 /idlc
parent7972ce0d6bc22a36d7fbaaa19bed11ec4cfe52d7 (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.cxx8
-rw-r--r--idlc/source/parser.y7
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());
Jan Holesovsky 2017-12-19loplugin:unusedmethodsNoel Grandin 2017-12-19loplugin:unusedfieldsNoel Grandin 2017-12-18loplugin:unnecessaryvirtualNoel Grandin 2017-12-15loplugin:salcall (clang-cl)Stephan Bergmann 2017-12-15loplugin:salcall (macOS)Stephan Bergmann 2017-12-11loplugin:salcall fix functionsNoel Grandin 2017-12-06loplugin:salcallStephan Bergmann 2017-12-04tdf#113380: if the player doesn't exist,...Xisco Fauli 2017-12-04loplugin:singlevalfieldsNoel Grandin 2017-11-22Make loplugin:unnecessaryparen warn about (x) ? ... : ... after allStephan Bergmann 2017-11-10loplugin:unusedmethodsNoel Grandin 2017-11-10loplugin:finalclasses in accessibilityNoel Grandin 2017-10-30related: tdf#103884 remove gltf/collada featureThorsten Behrens