forked from amazingfate/loongoffice
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>
This commit is contained in:
@ -56,11 +56,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void run() override
|
||||
void postRun() override
|
||||
{
|
||||
if (!preRun())
|
||||
return;
|
||||
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
|
||||
for (auto const& pair : goodMap)
|
||||
if (!isa<ParmVarDecl>(pair.first) &&
|
||||
// reference types have slightly weird behaviour
|
||||
@ -72,6 +69,14 @@ public:
|
||||
<< pair.first->getSourceRange();
|
||||
}
|
||||
|
||||
virtual void run() override
|
||||
{
|
||||
if (!preRun())
|
||||
return;
|
||||
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
|
||||
postRun();
|
||||
}
|
||||
|
||||
bool VisitStmt(Stmt const*);
|
||||
bool VisitCallExpr(CallExpr const*);
|
||||
bool VisitCXXConstructExpr(CXXConstructExpr const*);
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "pq_xviews.hxx"
|
||||
#include "pq_xusers.hxx"
|
||||
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <rtl/uuid.h>
|
||||
#include <rtl/bootstrap.hxx>
|
||||
@ -576,11 +575,7 @@ void Connection::initialize( const Sequence< Any >& aArguments )
|
||||
|
||||
if (isLog(&m_settings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "connection to '" );
|
||||
buf.append( url );
|
||||
buf.append( "' successfully opened" );
|
||||
log(&m_settings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(&m_settings, LogLevel::Info, "connection to '" + url + "' successfully opened");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1119,12 +1119,9 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTables(
|
||||
|
||||
if (isLog(m_pSettings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "DatabaseMetaData::getTables got called with " );
|
||||
buf.append( schemaPattern );
|
||||
buf.append( "." );
|
||||
buf.append( tableNamePattern );
|
||||
log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(m_pSettings, LogLevel::Info,
|
||||
("DatabaseMetaData::getTables got called with " + schemaPattern + "."
|
||||
+ tableNamePattern));
|
||||
}
|
||||
// ignore catalog, as a single pq connection does not support multiple catalogs
|
||||
|
||||
@ -1453,14 +1450,9 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getColumns(
|
||||
|
||||
if (isLog(m_pSettings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "DatabaseMetaData::getColumns got called with " );
|
||||
buf.append( schemaPattern );
|
||||
buf.append( "." );
|
||||
buf.append( tableNamePattern );
|
||||
buf.append( "." );
|
||||
buf.append( columnNamePattern );
|
||||
log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(m_pSettings, LogLevel::Info,
|
||||
("DatabaseMetaData::getColumns got called with " + schemaPattern + "."
|
||||
+ tableNamePattern + "." + columnNamePattern));
|
||||
}
|
||||
|
||||
// ignore catalog, as a single pq connection
|
||||
@ -1634,14 +1626,9 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getColumnPrivileges(
|
||||
|
||||
if (isLog(m_pSettings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "DatabaseMetaData::getColumnPrivileges got called with " );
|
||||
buf.append( schema );
|
||||
buf.append( "." );
|
||||
buf.append( table );
|
||||
buf.append( "." );
|
||||
buf.append( columnNamePattern );
|
||||
log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(m_pSettings, LogLevel::Info,
|
||||
("DatabaseMetaData::getColumnPrivileges got called with " + schema + "." + table + "."
|
||||
+ columnNamePattern));
|
||||
}
|
||||
|
||||
Reference< XParameters > parameters( m_getColumnPrivs_stmt, UNO_QUERY_THROW );
|
||||
@ -1663,12 +1650,9 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTablePrivileges(
|
||||
|
||||
if (isLog(m_pSettings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "DatabaseMetaData::getTablePrivileges got called with " );
|
||||
buf.append( schemaPattern );
|
||||
buf.append( "." );
|
||||
buf.append( tableNamePattern );
|
||||
log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(m_pSettings, LogLevel::Info,
|
||||
("DatabaseMetaData::getTablePrivileges got called with " + schemaPattern + "."
|
||||
+ tableNamePattern));
|
||||
}
|
||||
|
||||
Reference< XParameters > parameters( m_getTablePrivs_stmt, UNO_QUERY_THROW );
|
||||
@ -1721,12 +1705,8 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys(
|
||||
|
||||
if (isLog(m_pSettings, LogLevel::Info))
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
buf.append( "DatabaseMetaData::getPrimaryKeys got called with " );
|
||||
buf.append( schema );
|
||||
buf.append( "." );
|
||||
buf.append( table );
|
||||
log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
|
||||
log(m_pSettings, LogLevel::Info,
|
||||
"DatabaseMetaData::getPrimaryKeys got called with " + schema + "." + table);
|
||||
}
|
||||
|
||||
Reference< XPreparedStatement > statement = m_origin->prepareStatement(
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
#include <com/sun/star/sdbc/ResultSetType.hpp>
|
||||
#include <com/sun/star/sdbc/SQLException.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string.h>
|
||||
|
||||
#include <connectivity/dbconversion.hxx>
|
||||
@ -430,11 +431,7 @@ void PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x )
|
||||
MutexGuard guard(m_xMutex->GetMutex() );
|
||||
checkClosed();
|
||||
checkColumnIndex( parameterIndex );
|
||||
OStringBuffer buf( 20 );
|
||||
buf.append( "'" );
|
||||
buf.append( x );
|
||||
buf.append( "'" );
|
||||
m_vars[parameterIndex-1] = buf.makeStringAndClear();
|
||||
m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
|
||||
}
|
||||
|
||||
void PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
|
||||
@ -442,11 +439,7 @@ void PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
|
||||
MutexGuard guard(m_xMutex->GetMutex() );
|
||||
checkClosed();
|
||||
checkColumnIndex( parameterIndex );
|
||||
OStringBuffer buf( 20 );
|
||||
buf.append( "'" );
|
||||
buf.append( x );
|
||||
buf.append( "'" );
|
||||
m_vars[parameterIndex-1] = buf.makeStringAndClear();
|
||||
m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
|
||||
}
|
||||
|
||||
void PreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
|
||||
@ -454,11 +447,7 @@ void PreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
|
||||
MutexGuard guard(m_xMutex->GetMutex() );
|
||||
checkClosed();
|
||||
checkColumnIndex( parameterIndex );
|
||||
OStringBuffer buf( 20 );
|
||||
buf.append( "'" );
|
||||
buf.append( x );
|
||||
buf.append( "'" );
|
||||
m_vars[parameterIndex-1] = buf.makeStringAndClear();
|
||||
m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
|
||||
}
|
||||
|
||||
void PreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
|
||||
@ -466,11 +455,7 @@ void PreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
|
||||
MutexGuard guard(m_xMutex->GetMutex() );
|
||||
checkClosed();
|
||||
checkColumnIndex( parameterIndex );
|
||||
OStringBuffer buf( 20 );
|
||||
buf.append( "'" );
|
||||
buf.append( x );
|
||||
buf.append( "'" );
|
||||
m_vars[parameterIndex-1] = buf.makeStringAndClear();
|
||||
m_vars[parameterIndex-1] = "'" + OString::number(x) + "'";
|
||||
}
|
||||
|
||||
void PreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
|
||||
@ -496,21 +481,18 @@ void PreparedStatement::setBytes(
|
||||
MutexGuard guard(m_xMutex->GetMutex() );
|
||||
checkClosed();
|
||||
checkColumnIndex( parameterIndex );
|
||||
OStringBuffer buf( 20 );
|
||||
buf.append( "'" );
|
||||
size_t len;
|
||||
unsigned char * escapedString =
|
||||
PQescapeBytea( reinterpret_cast<unsigned char const *>(x.getConstArray()), x.getLength(), &len);
|
||||
struct Free { void operator ()(void * p) const { free(p); } };
|
||||
std::unique_ptr<unsigned char, Free> escapedString(
|
||||
PQescapeBytea( reinterpret_cast<unsigned char const *>(x.getConstArray()), x.getLength(), &len));
|
||||
if( ! escapedString )
|
||||
{
|
||||
throw SQLException(
|
||||
"pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string",
|
||||
*this, OUString(), 1, Any() );
|
||||
}
|
||||
buf.append( reinterpret_cast<char *>(escapedString), len -1 );
|
||||
free( escapedString );
|
||||
buf.append( "'" );
|
||||
m_vars[parameterIndex-1] = buf.makeStringAndClear();
|
||||
m_vars[parameterIndex-1]
|
||||
= "'" + rtl::OStringView(reinterpret_cast<char *>(escapedString.get()), len -1) + "'";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -218,14 +218,9 @@ void Statement::close( )
|
||||
void Statement::raiseSQLException(
|
||||
const OUString & sql, const char * errorMsg )
|
||||
{
|
||||
OUStringBuffer buf(128);
|
||||
buf.append( "pq_driver: ");
|
||||
buf.append(
|
||||
OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding ) );
|
||||
buf.append( " (caused by statement '" );
|
||||
buf.append( sql );
|
||||
buf.append( "')" );
|
||||
OUString error = buf.makeStringAndClear();
|
||||
OUString error = "pq_driver: "
|
||||
+ OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding )
|
||||
+ " (caused by statement '" + sql + "')";
|
||||
log(m_pSettings, LogLevel::Error, error);
|
||||
throw SQLException( error, *this, OUString(), 1, Any() );
|
||||
}
|
||||
@ -319,11 +314,10 @@ static std::vector< OUString > lookupKeys(
|
||||
keySupplier.clear();
|
||||
if (isLog(pSettings, LogLevel::Info))
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "Can't offer updateable result set because table " );
|
||||
buf.append( OUStringToOString(name, ConnectionSettings::encoding) );
|
||||
buf.append( " is duplicated, add schema to resolve ambiguity" );
|
||||
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
|
||||
OString buf = "Can't offer updateable result set because table "
|
||||
+ OUStringToOString(name, ConnectionSettings::encoding)
|
||||
+ " is duplicated, add schema to resolve ambiguity";
|
||||
log(pSettings, LogLevel::Info, buf.getStr());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -336,11 +330,9 @@ static std::vector< OUString > lookupKeys(
|
||||
{
|
||||
if (isLog(pSettings, LogLevel::Info))
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "Can't offer updateable result set ( table " );
|
||||
buf.append( OUStringToOString(table, ConnectionSettings::encoding) );
|
||||
buf.append( " is unknown)" );
|
||||
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
|
||||
OString buf = "Can't offer updateable result set ( table "
|
||||
+ OUStringToOString(table, ConnectionSettings::encoding) + " is unknown)";
|
||||
log(pSettings, LogLevel::Info, buf.getStr());
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,11 +374,10 @@ static std::vector< OUString > lookupKeys(
|
||||
{
|
||||
if (isLog(pSettings, LogLevel::Info))
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "Can't offer updateable result set ( table " );
|
||||
buf.append( OUStringToOString(table, ConnectionSettings::encoding) );
|
||||
buf.append( " does not have a primary key)" );
|
||||
log(pSettings, LogLevel::Info, buf.makeStringAndClear().getStr());
|
||||
OString buf = "Can't offer updateable result set ( table "
|
||||
+ OUStringToOString(table, ConnectionSettings::encoding)
|
||||
+ " does not have a primary key)";
|
||||
log(pSettings, LogLevel::Info, buf.getStr());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -496,12 +487,8 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
|
||||
}
|
||||
else if( ! table.getLength() )
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "can't support updateable resultset, because a single table in the "
|
||||
"WHERE part of the statement could not be identified (" );
|
||||
buf.append( cmd );
|
||||
buf.append( "." );
|
||||
aReason = buf.makeStringAndClear();
|
||||
aReason = "can't support updateable resultset, because a single table in the "
|
||||
"WHERE part of the statement could not be identified (" + cmd + ".";
|
||||
}
|
||||
else if( !sourceTableKeys.empty() )
|
||||
{
|
||||
@ -518,22 +505,17 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
|
||||
else
|
||||
{
|
||||
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "can't support updateable resultset for table " );
|
||||
buf.append( OUStringToOString( schema, ConnectionSettings::encoding ) );
|
||||
buf.append( "." );
|
||||
buf.append( OUStringToOString( table, ConnectionSettings::encoding ) );
|
||||
buf.append( ", because resultset table does not have a primary key " );
|
||||
aReason = buf.makeStringAndClear();
|
||||
aReason = "can't support updateable resultset for table "
|
||||
+ OUStringToOString( schema, ConnectionSettings::encoding ) + "."
|
||||
+ OUStringToOString( table, ConnectionSettings::encoding )
|
||||
+ ", because resultset table does not have a primary key ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "can't support updateable result for selects with multiple tables (" );
|
||||
buf.append( cmd );
|
||||
buf.append( ")" );
|
||||
log(pSettings, LogLevel::Sql, buf.makeStringAndClear().getStr() );
|
||||
OString buf = "can't support updateable result for selects with multiple tables ("
|
||||
+ cmd + ")";
|
||||
log(pSettings, LogLevel::Sql, buf.getStr() );
|
||||
}
|
||||
if( ! (*(data->pLastResultset)).is() )
|
||||
{
|
||||
@ -568,16 +550,10 @@ bool executePostgresCommand( const OString & cmd, struct CommandData *data )
|
||||
ret = true;
|
||||
if (isLog(pSettings, LogLevel::Sql))
|
||||
{
|
||||
OStringBuffer buf( 128 );
|
||||
buf.append( "executed query '" );
|
||||
buf.append( cmd );
|
||||
buf.append( "' successfully" );
|
||||
buf.append( ", duration=" );
|
||||
buf.append( duration );
|
||||
buf.append( "ms, returnedRows=" );
|
||||
buf.append( returnedRows );
|
||||
buf.append( "." );
|
||||
log(pSettings, LogLevel::Sql, buf.makeStringAndClear().getStr());
|
||||
OString buf = "executed query '" + cmd + "' successfully, duration="
|
||||
+ OString::number(duration) + "ms, returnedRows=" + OString::number(returnedRows)
|
||||
+ ".";
|
||||
log(pSettings, LogLevel::Sql, buf.getStr());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -88,11 +88,7 @@ namespace pq_sdbc_driver
|
||||
|
||||
OUString concatQualified( const OUString & a, const OUString &b)
|
||||
{
|
||||
OUStringBuffer buf( a.getLength() + 2 + b.getLength() );
|
||||
buf.append( a );
|
||||
buf.append( "." );
|
||||
buf.append( b );
|
||||
return buf.makeStringAndClear();
|
||||
return a + "." + b;
|
||||
}
|
||||
|
||||
static OString iOUStringToOString( const OUString& str, ConnectionSettings const *settings) {
|
||||
|
||||
@ -133,9 +133,7 @@ void Tables::refresh()
|
||||
|
||||
{
|
||||
m_values.push_back( makeAny( prop ) );
|
||||
OUStringBuffer buf( name.getLength() + schema.getLength() + 1);
|
||||
buf.append( schema ).append( "." ).append( name );
|
||||
map[ buf.makeStringAndClear() ] = tableIndex;
|
||||
map[ schema + "." + name ] = tableIndex;
|
||||
++tableIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,9 +115,7 @@ void Views::refresh()
|
||||
|
||||
{
|
||||
m_values.push_back( makeAny( prop ) );
|
||||
OUStringBuffer buf( table.getLength() + schema.getLength() + 1);
|
||||
buf.append( schema ).append( "." ).append( table );
|
||||
map[ buf.makeStringAndClear() ] = viewIndex;
|
||||
map[ schema + "." + table ] = viewIndex;
|
||||
++viewIndex;
|
||||
}
|
||||
}
|
||||
@ -191,12 +189,9 @@ void Views::dropByIndex( sal_Int32 index )
|
||||
set->getPropertyValue( st.SCHEMA_NAME ) >>= schema;
|
||||
set->getPropertyValue( st.NAME ) >>= name;
|
||||
|
||||
OUStringBuffer update( 128 );
|
||||
update.append( "DROP VIEW \"" ).append( schema ).append( "\".\"" ).append( name ).append( "\"" );
|
||||
|
||||
Reference< XStatement > stmt = m_origin->createStatement( );
|
||||
|
||||
stmt->executeUpdate( update.makeStringAndClear() );
|
||||
stmt->executeUpdate( "DROP VIEW \"" + schema + "\".\"" + name + "\"" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#include <typelib/typedescription.h>
|
||||
#include <uno/any2.h>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
|
||||
using namespace ::rtl;
|
||||
@ -32,11 +32,8 @@ extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
|
||||
typelib_TypeDescriptionReference * pType )
|
||||
SAL_THROW_EXTERN_C()
|
||||
{
|
||||
OUStringBuffer buf( 64 );
|
||||
buf.append( "unsatisfied query for interface of type " );
|
||||
buf.append( OUString::unacquired( &pType->pTypeName ) );
|
||||
buf.append( '!' );
|
||||
OUString ret( buf.makeStringAndClear() );
|
||||
OUString ret = "unsatisfied query for interface of type "
|
||||
+ OUString::unacquired( &pType->pTypeName ) + "!";
|
||||
rtl_uString_acquire( ret.pData );
|
||||
return ret.pData;
|
||||
}
|
||||
@ -46,11 +43,8 @@ extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
|
||||
typelib_TypeDescriptionReference * pType )
|
||||
SAL_THROW_EXTERN_C()
|
||||
{
|
||||
OUStringBuffer buf( 64 );
|
||||
buf.append( "invalid attempt to assign an empty interface of type " );
|
||||
buf.append( OUString::unacquired( &pType->pTypeName ) );
|
||||
buf.append( '!' );
|
||||
OUString ret( buf.makeStringAndClear() );
|
||||
OUString ret = "invalid attempt to assign an empty interface of type "
|
||||
+ OUString::unacquired( &pType->pTypeName ) + "!";
|
||||
rtl_uString_acquire( ret.pData );
|
||||
return ret.pData;
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
|
||||
#include <osl/mutex.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
|
||||
#include <typelib/typedescription.h>
|
||||
@ -297,10 +296,7 @@ void SAL_CALL typelib_static_sequence_type_init(
|
||||
MutexGuard aGuard( typelib_StaticInitMutex::get() );
|
||||
if (! *ppRef)
|
||||
{
|
||||
OUStringBuffer aBuf( 32 );
|
||||
aBuf.append( "[]" );
|
||||
aBuf.append( pElementType->pTypeName );
|
||||
OUString aTypeName( aBuf.makeStringAndClear() );
|
||||
OUString aTypeName = "[]" + OUString::unacquired(&pElementType->pTypeName);
|
||||
|
||||
assert( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_SEQUENCE) );
|
||||
*ppRef = igetTypeByName( aTypeName.pData );
|
||||
|
||||
@ -774,11 +774,9 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName(
|
||||
}
|
||||
else
|
||||
{
|
||||
OUStringBuffer buf( 32 );
|
||||
buf.append( "environment \"" );
|
||||
buf.append( pEnvDcp );
|
||||
buf.append( "\" does not exist!" );
|
||||
writeLine( stream, buf.makeStringAndClear(), pFilter );
|
||||
writeLine(
|
||||
stream, "environment \"" + OUString::unacquired(&pEnvDcp) + "\" does not exist!",
|
||||
pFilter );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -796,9 +796,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
|
||||
if (n100s < 0)
|
||||
incErrorInt( "Error: Time100SecSeparator not present in FormatCode formatindex=\"%d\".\n",
|
||||
formatindex);
|
||||
OUStringBuffer a100s( pSep->getValue());
|
||||
a100s.append( "00");
|
||||
n100s = aCode.indexOf( a100s.makeStringAndClear());
|
||||
n100s = aCode.indexOf( pSep->getValue() + "00");
|
||||
if (n100s < 0)
|
||||
incErrorInt( "Error: Time100SecSeparator+00 not present in FormatCode formatindex=\"%d\".\n",
|
||||
formatindex);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
#include <cellform.hxx>
|
||||
#include <cellvalue.hxx>
|
||||
|
||||
#include <rtl/strbuf.hxx>
|
||||
|
||||
#define DEBUG_CSV_HANDLER 0
|
||||
|
||||
inline OUString getConditionalFormatString(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
|
||||
@ -49,24 +47,15 @@ inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab)
|
||||
|
||||
inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rExpectedString, const OUString& rString)
|
||||
{
|
||||
OStringBuffer aString(createErrorMessage(nCol, nRow, nTab));
|
||||
aString.append("; Expected: '");
|
||||
aString.append(OUStringToOString(rExpectedString, RTL_TEXTENCODING_UTF8));
|
||||
aString.append("' Found: '");
|
||||
aString.append(OUStringToOString(rString, RTL_TEXTENCODING_UTF8));
|
||||
aString.append("'");
|
||||
return aString.makeStringAndClear();
|
||||
return createErrorMessage(nCol, nRow, nTab) + "; Expected: '"
|
||||
+ OUStringToOString(rExpectedString, RTL_TEXTENCODING_UTF8) + "' Found: '"
|
||||
+ OUStringToOString(rString, RTL_TEXTENCODING_UTF8) + "'";
|
||||
}
|
||||
|
||||
inline OString createErrorMessage(SCCOL nCol, SCROW nRow, SCTAB nTab, double aExpected, double aValue)
|
||||
{
|
||||
OStringBuffer aString(createErrorMessage(nCol, nRow, nTab));
|
||||
aString.append("; Expected: '");
|
||||
aString.append(aExpected);
|
||||
aString.append("' Found: '");
|
||||
aString.append(aValue);
|
||||
aString.append("'");
|
||||
return aString.makeStringAndClear();
|
||||
return createErrorMessage(nCol, nRow, nTab) + "; Expected: '" + OString::number(aExpected)
|
||||
+ "' Found: '" + OString::number(aValue) + "'";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -298,10 +298,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI )
|
||||
)
|
||||
{
|
||||
Reference< provider::XScriptProvider > xScriptProvider;
|
||||
OUStringBuffer buf( 80 );
|
||||
buf.append( "com.sun.star.script.provider.ScriptProviderFor");
|
||||
buf.append( language );
|
||||
OUString serviceName = buf.makeStringAndClear();
|
||||
OUString serviceName = "com.sun.star.script.provider.ScriptProviderFor" + language;
|
||||
if ( !providerCache() )
|
||||
{
|
||||
throw provider::ScriptFrameworkErrorException(
|
||||
|
||||
@ -93,11 +93,8 @@ private:
|
||||
|
||||
void SwMacrosTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
|
||||
{
|
||||
OUString aSep("/");
|
||||
OUStringBuffer aBuffer( m_directories.getSrcRootURL() );
|
||||
aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
|
||||
aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
|
||||
rFilePath = aBuffer.makeStringAndClear();
|
||||
rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileExtension + "/"
|
||||
+ aFileBase + aFileExtension;
|
||||
}
|
||||
|
||||
void SwMacrosTest::testVba()
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
#include <o3tl/enumarray.hxx>
|
||||
#include <o3tl/enumrange.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <sal/log.hxx>
|
||||
|
||||
#include "itemholder1.hxx"
|
||||
@ -194,11 +193,7 @@ void GlobalEventConfig_Impl::initBindingInfo()
|
||||
Sequence< OUString > lMacros(1);
|
||||
for (const auto& rEventName : lEventNames )
|
||||
{
|
||||
OUStringBuffer aBuffer( 32 );
|
||||
aBuffer.append( aSetNode );
|
||||
aBuffer.append( rEventName );
|
||||
aBuffer.append( aCommandKey );
|
||||
lMacros[0] = aBuffer.makeStringAndClear();
|
||||
lMacros[0] = aSetNode + rEventName + aCommandKey;
|
||||
SAL_INFO("unotools", "reading binding for: " << lMacros[0]);
|
||||
Sequence< Any > lValues = GetProperties( lMacros );
|
||||
OUString sMacroURL;
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <o3tl/enumarray.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
@ -728,11 +727,7 @@ void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable()
|
||||
css::uno::Sequence< OUString > lFactories = GetNodeNames(OUString());
|
||||
std::transform(lFactories.begin(), lFactories.end(), lFactories.begin(),
|
||||
[](const OUString& rFactory) -> OUString {
|
||||
OUStringBuffer sPath(256);
|
||||
sPath.append(rFactory );
|
||||
sPath.append(PATHSEPARATOR );
|
||||
sPath.append(PROPERTYNAME_DEFAULTFILTER);
|
||||
return sPath.makeStringAndClear();
|
||||
return rFactory + PATHSEPARATOR PROPERTYNAME_DEFAULTFILTER;
|
||||
});
|
||||
|
||||
css::uno::Sequence< sal_Bool > lReadonlyStates = GetReadOnlyStates(lFactories);
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <sal/log.hxx>
|
||||
#include <i18nlangtag/mslangid.hxx>
|
||||
@ -660,11 +659,7 @@ OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
|
||||
OUString aIsoStr( LanguageTag::convertToBcp47( eLang ) );
|
||||
if ( !aIsoStr.isEmpty() )
|
||||
{
|
||||
OUStringBuffer aStr( rAbbrev.getLength() + 1 + aIsoStr.getLength() );
|
||||
aStr.append( rAbbrev );
|
||||
aStr.append( '-' );
|
||||
aStr.append( aIsoStr );
|
||||
return aStr.makeStringAndClear();
|
||||
return rAbbrev + "-" + aIsoStr;
|
||||
}
|
||||
else
|
||||
return rAbbrev;
|
||||
|
||||
@ -123,12 +123,7 @@ namespace treeview {
|
||||
{
|
||||
if( targetURL.isEmpty() )
|
||||
{
|
||||
OUStringBuffer strBuff( 21 + id.getLength() );
|
||||
strBuff.append(
|
||||
"vnd.sun.star.help://"
|
||||
).append(id);
|
||||
|
||||
targetURL = strBuff.makeStringAndClear();
|
||||
targetURL = "vnd.sun.star.help://" + id;
|
||||
}
|
||||
|
||||
return targetURL;
|
||||
|
||||
Reference in New Issue
Block a user