Hi,
could someone please review this small patch and give feed back.
Thank you,
Christina
From c1770ed9ab8ba9f11cab7574e9ce626ec754337c Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Mon, 2 Jan 2012 21:56:19 +0100
Subject: [PATCH] Replace ByteString with rtl::OString
---
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
Context
- [Libreoffice] [PATCH] Replace ByteString with rtl::OString · Chr. Rossmanith
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.