diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 10:13:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 12:12:31 +0200 |
commit | 4a96fb8ec0130e1036913093836bcf28bc37a49b (patch) | |
tree | e7aad9be4ca417e9e64f688cc99bee0638037741 /vcl/unx | |
parent | f33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff) |
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a
length
Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8
Reviewed-on: https://gerrit.libreoffice.org/80872
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/print/printerjob.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/generic/printer/cpdmgr.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/generic/printer/cupsmgr.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/generic/printer/printerinfomanager.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 5 |
6 files changed, 14 insertions, 32 deletions
diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index 73dedc5a2415..7d805ef942e5 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -211,18 +211,14 @@ createSpoolDir () do { - OUStringBuffer aDir( aTmpDir.getLength() + 16 ); - aDir.append( aTmpDir ); - aDir.append( "/psp" ); - aDir.append(nRand); - OUString aResult = aDir.makeStringAndClear(); - if( osl::Directory::create( aResult ) == osl::FileBase::E_None ) + OUString aDir = aTmpDir + "/psp" + OUString::number(nRand); + if( osl::Directory::create( aDir ) == osl::FileBase::E_None ) { - osl::File::setAttributes( aResult, + osl::File::setAttributes( aDir, osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnRead | osl_File_Attribute_OwnExe ); - return aResult; + return aDir; } nRand++; } while( nRand ); diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx index 5a2e1b01d271..cae2a4e1ab03 100644 --- a/vcl/unx/generic/printer/cpdmgr.cxx +++ b/vcl/unx/generic/printer/cpdmgr.cxx @@ -206,9 +206,6 @@ void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUn rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); aPrinter.m_aInfo.m_aComment = OStringToOUString(pDest->info, aEncoding); aPrinter.m_aInfo.m_aLocation = OStringToOUString(pDest->location, aEncoding); - OUStringBuffer aBuf( 256 ); - aBuf.append( "CPD:" ); - aBuf.append( aUniqueName ); // note: the parser that goes with the PrinterInfo // is created implicitly by the JobData::operator=() // when it detects the NULL ptr m_pParser. @@ -225,7 +222,7 @@ void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUn aPrinter.m_aInfo.m_aContext = c_it->second; } aPrinter.m_aInfo.setDefaultBackend(true); - aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear(); + aPrinter.m_aInfo.m_aDriverName = "CPD:" + aUniqueName; m_aPrinters[ aUniqueName ] = aPrinter; } #endif diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index a6d1ccbad7bb..12482b2ba878 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -312,11 +312,8 @@ void CUPSManager::initialize() OUString aPrinterName = OStringToOUString( pDest->name, aEncoding ); if( pDest->instance && *pDest->instance ) { - OUStringBuffer aBuf( 256 ); - aBuf.append( aPrinterName ); - aBuf.append( '/' ); - aBuf.append( OStringToOUString( pDest->instance, aEncoding ) ); - aPrinterName = aBuf.makeStringAndClear(); + aPrinterName += "/" + + OStringToOUString( pDest->instance, aEncoding ); } // initialize printer with possible configuration from psprint.conf @@ -338,9 +335,6 @@ void CUPSManager::initialize() aPrinter.m_aInfo.m_aAuthInfoRequired=OStringToOUString(pDest->options[k].value, aEncoding); } - OUStringBuffer aBuf( 256 ); - aBuf.append( "CUPS:" ); - aBuf.append( aPrinterName ); // note: the parser that goes with the PrinterInfo // is created implicitly by the JobData::operator=() // when it detects the NULL ptr m_pParser. @@ -357,7 +351,7 @@ void CUPSManager::initialize() aPrinter.m_aInfo.m_aContext = c_it->second; } aPrinter.m_aInfo.setDefaultBackend(bUsePDF); - aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear(); + aPrinter.m_aInfo.m_aDriverName = "CUPS:" + aPrinterName; m_aPrinters[ aPrinter.m_aInfo.m_aPrinterName ] = aPrinter; m_aCUPSDestMap[ aPrinter.m_aInfo.m_aPrinterName ] = nPrinter; diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 0d520e09d219..880a7d958000 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -620,10 +620,10 @@ PPDParser::PPDParser(const OUString& rFile, const std::vector<PPDKey*>& keys) pwg_media_t *pPWGMedia = pwgMediaForPWG(o.pData->buffer); if (pPWGMedia != nullptr) { OUStringBuffer aBuf( 256 ); - aBuf.append( "0 0 " ); - aBuf.append( PWG_TO_POINTS(pPWGMedia -> width) ); - aBuf.append( " " ); - aBuf.append( PWG_TO_POINTS(pPWGMedia -> length) ); + aBuf = "0 0 " + + OUString::number(PWG_TO_POINTS(pPWGMedia -> width)) + + " " + + OUString::number(PWG_TO_POINTS(pPWGMedia -> length)); if ( pImageableAreaValue ) pImageableAreaValue->m_aValue = aBuf.makeStringAndClear(); aBuf.append( PWG_TO_POINTS(pPWGMedia -> width) ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 1977a80b5e7f..8ba1df9810bb 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -846,12 +846,10 @@ void SystemQueueInfo::run() for(const auto & rParm : aParms) { aLines.clear(); - OStringBuffer aCmdLine( 128 ); - aCmdLine.append( rParm.pQueueCommand ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "trying print queue command \"%s\" ... ", rParm.pQueueCommand ); #endif - aCmdLine.append( " 2>/dev/null" ); + OString aCmdLine = rParm.pQueueCommand + OStringLiteral(" 2>/dev/null"); FILE *pPipe; if( (pPipe = popen( aCmdLine.getStr(), "r" )) ) { diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 370b47cbdb6b..87b795513367 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2881,10 +2881,7 @@ bool X11SalFrame::appendUnicodeSequence( sal_Unicode c ) (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ) { - OUStringBuffer aBuf( rSeq.getLength() + 1 ); - aBuf.append( rSeq ); - aBuf.append( c ); - rSeq = aBuf.makeStringAndClear(); + rSeq += OUStringLiteral1(c); std::vector<ExtTextInputAttr> attribs( rSeq.getLength(), ExtTextInputAttr::Underline ); SalExtTextInputEvent aEv; |