[Libreoffice-commits] core.git: connectivity/source i18nutil/source sc/source

Caolán McNamara caolanm at redhat.com
Sat Jan 14 20:28:04 UTC 2017


 connectivity/source/drivers/postgresql/pq_statement.cxx |    2 +-
 connectivity/source/drivers/postgresql/pq_xcolumns.cxx  |    6 +++---
 connectivity/source/drivers/postgresql/pq_xtables.cxx   |    4 ++--
 i18nutil/source/utility/unicode.cxx                     |   10 +++++-----
 sc/source/core/data/formulacell.cxx                     |    2 +-
 sc/source/filter/xml/xmlexprt.cxx                       |    2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit fffb674c1e5352048caeae325ecdc6428cb210bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 14 19:22:47 2017 +0000

    coverity#1371289 avoid the need for an assignment
    
    Change-Id: I7f9b8d21652c79642f9a2f916ad0609c8abd430b

diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 55715b0..805c7b9 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -797,7 +797,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
                     {
                         // it even was no autovalue, no sense to continue as we can't query the
                         // inserted row
-                        buf.setLength(0);
+                        buf.truncate();
                         break;
                     }
                 }
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index cfb4bc5..36f3a4f 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -404,7 +404,7 @@ void alterColumnByDescriptor(
     OUString pastDefaultValue = extractStringProperty( past, st.DEFAULT_VALUE );
     if( futureDefaultValue != pastDefaultValue )
     {
-        buf = OUStringBuffer( 128 );
+        buf.truncate();
         buf.append( "ALTER TABLE" );
         bufferQuoteQualifiedIdentifier( buf, schemaName, tableName, settings );
         buf.append( "ALTER COLUMN" );
@@ -422,7 +422,7 @@ void alterColumnByDescriptor(
     sal_Int32 pastNullable = extractIntProperty( past, st.IS_NULLABLE );
     if( futureNullable != pastNullable )
     {
-        buf = OUStringBuffer( 128 );
+        buf.truncate();
         buf.append( "ALTER TABLE" );
         bufferQuoteQualifiedIdentifier( buf, schemaName, tableName, settings );
         buf.append( "ALTER COLUMN" );
@@ -449,7 +449,7 @@ void alterColumnByDescriptor(
 
     if( futureComment != pastComment )
     {
-        buf = OUStringBuffer( 128 );
+        buf.truncate();
         buf.append( "COMMENT ON COLUMN" );
         bufferQuoteQualifiedIdentifier( buf, schemaName, tableName , futureColumnName, settings );
         buf.append( "IS " );
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 63e6c6a..cbd5c3f 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -270,7 +270,7 @@ void Tables::appendByDescriptor(
     OUString description = extractStringProperty( descriptor, st.DESCRIPTION );
     if( !description.isEmpty() )
     {
-        buf = OUStringBuffer( 128 );
+        buf.truncate();
         buf.append( "COMMENT ON TABLE" );
         bufferQuoteQualifiedIdentifier( buf, schema, name, m_pSettings );
         buf.append( "IS " );
@@ -292,7 +292,7 @@ void Tables::appendByDescriptor(
                 description = extractStringProperty( column,st.DESCRIPTION );
                 if( !description.isEmpty() )
                 {
-                    buf = OUStringBuffer( 128 );
+                    buf.truncate();
                     buf.append( "COMMENT ON COLUMN " );
                     bufferQuoteQualifiedIdentifier(
                         buf, schema, name, extractStringProperty( column, st.NAME ), m_pSettings );
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index 984c5f7..61ce7c0 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -1192,21 +1192,21 @@ OUString ToggleUnicodeCodepoint::StringToReplace()
     mbAllowMoreChars = false;
 
     //validate unicode notation.
-    OUStringBuffer sIn;
+    OUString sIn;
     sal_uInt32 nUnicode = 0;
     sal_Int32 nUPlus = maInput.indexOf("U+");
     //if U+ notation used, strip off all extra chars added not in U+ notation
     if( nUPlus != -1 )
     {
         maInput = maInput.copy(nUPlus);
-        sIn = maInput.copy(2);
+        sIn = maInput.copy(2).toString();
         nUPlus = sIn.indexOf("U+");
     }
     else
-        sIn = maInput;
+        sIn = maInput.toString();
     while( nUPlus != -1 )
     {
-        nUnicode = sIn.copy(0, nUPlus).toString().toUInt32(16);
+        nUnicode = sIn.copy(0, nUPlus).toUInt32(16);
         //prevent creating control characters or invalid Unicode values
         if( !rtl::isUnicodeCodePoint(nUnicode) || nUnicode < 0x20  )
             maInput = sIn.copy(nUPlus);
@@ -1214,7 +1214,7 @@ OUString ToggleUnicodeCodepoint::StringToReplace()
         nUPlus =  sIn.indexOf("U+");
     }
 
-    nUnicode = sIn.toString().toUInt32(16);
+    nUnicode = sIn.toUInt32(16);
     if( !rtl::isUnicodeCodePoint(nUnicode) || nUnicode < 0x20 )
        maInput.truncate().append( sIn[sIn.getLength()-1] );
     return maInput.toString();
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 839d776..d41a9cf 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -978,7 +978,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer,
 {
     if( pCode->GetCodeError() != FormulaError::NONE && !pCode->GetLen() )
     {
-        rBuffer = OUStringBuffer( ScGlobal::GetErrorString( pCode->GetCodeError()));
+        rBuffer = ScGlobal::GetErrorString(pCode->GetCodeError());
         return;
     }
     else if( cMatrixFlag == MM_REFERENCE )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 94cbd8e..64d2ff9 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4449,7 +4449,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
                         ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor.GetColor());
                         AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear());
 
-                        aBuffer = OUStringBuffer();
+                        aBuffer.truncate();
                         ::sax::Converter::convertColor(aBuffer, pFormatData->maAxisColor.GetColor());
                         AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, aBuffer.makeStringAndClear());
                         SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true);


More information about the Libreoffice-commits mailing list