[PATCH] Replace ByteString with rtl::OString
Christina Rossmanith
ChrRossmanith at web.de
Mon Jan 2 12:56:19 PST 2012
---
vcl/generic/print/genprnpsp.cxx | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 23a7bf5..ba81a72 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -47,6 +47,7 @@
#endif
#include "rtl/ustring.hxx"
+#include "comphelper/string.hxx"
#include "osl/module.h"
@@ -86,19 +87,19 @@ typedef int(*faxFunction)(String&);
static faxFunction pFaxNrFunction = NULL;
}
-static String getPdfDir( const PrinterInfo& rInfo )
+static rtl::OUString getPdfDir( const PrinterInfo& rInfo )
{
- String aDir;
+ rtl::OUString aDir;
sal_Int32 nIndex = 0;
while( nIndex != -1 )
{
- OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
+ rtl::OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
if( ! aToken.compareToAscii( "pdf=", 4 ) )
{
sal_Int32 nPos = 0;
aDir = aToken.getToken( 1, '=', nPos );
- if( ! aDir.Len() )
- aDir = String( ByteString( getenv( "HOME" ) ), osl_getThreadTextEncoding() );
+ if( aDir.isEmpty() )
+ aDir = rtl::OUString( getenv( "HOME" ), 4, osl_getThreadTextEncoding() );
break;
}
}
@@ -235,20 +236,19 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
bool bSuccess = false;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- ByteString aCmdLine(rtl::OUStringToOString(rCommandLine, aEncoding));
+ rtl::OString aCmdLine(rtl::OUStringToOString(rCommandLine, aEncoding));
rtl::OString aFilename(rtl::OUStringToOString(rFilename, aEncoding));
- bool bPipe = aCmdLine.Search( "(TMP)" ) != STRING_NOTFOUND ? false : true;
+ bool bPipe = aCmdLine.indexOf( "(TMP)" ) >= 0 ? false : true;
// setup command line for exec
if( ! bPipe )
- while( aCmdLine.SearchAndReplace( "(TMP)", aFilename ) != STRING_NOTFOUND )
- ;
+ aCmdLine = comphelper::string::replace( aCmdLine, rtl::OString("(TMP)"), aFilename );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "%s commandline: \"%s\"\n",
bPipe ? "piping to" : "executing",
- aCmdLine.GetBuffer() );
+ aCmdLine.getStr() );
struct stat aStat;
if( stat( aFilename.getStr(), &aStat ) )
fprintf( stderr, "stat( %s ) failed\n", aFilename.getStr() );
@@ -258,7 +258,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
argv[ 0 ] = "/bin/sh";
argv[ 1 ] = "-c";
- argv[ 2 ] = aCmdLine.GetBuffer();
+ argv[ 2 ] = aCmdLine.getStr();
argv[ 3 ] = 0;
bool bHavePipes = false;
@@ -301,7 +301,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
dup2( fd[0], STDIN_FILENO );
}
execv( argv[0], const_cast<char**>(argv) );
- fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.GetBuffer() );
+ fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.getStr() );
_exit( 1 );
}
else
--
1.7.4.1
--------------070908030406080201010502--
More information about the LibreOffice
mailing list