Kaydet (Commit) d6bf32ba authored tarafından Caolán McNamara's avatar Caolán McNamara

make padmin ByteString free

üst 141c1c7b
...@@ -498,15 +498,15 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) ...@@ -498,15 +498,15 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
// read defaults // read defaults
aConfig.SetGroup( "Xprinter,PostScript" ); aConfig.SetGroup( "Xprinter,PostScript" );
ByteString aDefPageSize( aConfig.ReadKey( "PageSize" ) ); rtl::OString aDefPageSize( aConfig.ReadKey( "PageSize" ) );
ByteString aDefOrientation( aConfig.ReadKey( "Orientation" ) ); rtl::OString aDefOrientation( aConfig.ReadKey( "Orientation" ) );
ByteString aDefMarginLeft( aConfig.ReadKey( "MarginLeft" ) ); rtl::OString aDefMarginLeft( aConfig.ReadKey( "MarginLeft" ) );
ByteString aDefMarginRight( aConfig.ReadKey( "MarginRight" ) ); rtl::OString aDefMarginRight( aConfig.ReadKey( "MarginRight" ) );
ByteString aDefMarginTop( aConfig.ReadKey( "MarginTop" ) ); rtl::OString aDefMarginTop( aConfig.ReadKey( "MarginTop" ) );
ByteString aDefMarginBottom( aConfig.ReadKey( "MarginBottom" ) ); rtl::OString aDefMarginBottom( aConfig.ReadKey( "MarginBottom" ) );
ByteString aDefScale( aConfig.ReadKey( "Scale" ) ); rtl::OString aDefScale( aConfig.ReadKey( "Scale" ) );
ByteString aDefCopies( aConfig.ReadKey( "Copies" ) ); rtl::OString aDefCopies( aConfig.ReadKey( "Copies" ) );
ByteString aDefDPI( aConfig.ReadKey( "DPI" ) ); rtl::OString aDefDPI( aConfig.ReadKey( "DPI" ) );
using comphelper::string::getToken; using comphelper::string::getToken;
...@@ -540,8 +540,8 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) ...@@ -540,8 +540,8 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
// read the command // read the command
aConfig.SetGroup( "ports" ); aConfig.SetGroup( "ports" );
ByteString aCommand( aConfig.ReadKey( aPort ) ); rtl::OString aCommand( aConfig.ReadKey( aPort ) );
if( ! aCommand.Len() ) if (aCommand.isEmpty())
{ {
String aText( PaResId( RID_TXT_PRINTERWITHOUTCOMMAND ) ); String aText( PaResId( RID_TXT_PRINTERWITHOUTCOMMAND ) );
aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rtl::OStringToOUString(aPrinter, aEncoding) ); aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rtl::OStringToOUString(aPrinter, aEncoding) );
...@@ -603,23 +603,22 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) ...@@ -603,23 +603,22 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent )
aValue = aConfig.ReadKey( "Orientation", aDefOrientation ); aValue = aConfig.ReadKey( "Orientation", aDefOrientation );
if (!aValue.isEmpty()) if (!aValue.isEmpty())
aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCase( "landscape" ) == COMPARE_EQUAL ? orientation::Landscape : orientation::Portrait; aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("landscape")) ? orientation::Landscape : orientation::Portrait;
int nGroupKeys = aConfig.GetKeyCount(); int nGroupKeys = aConfig.GetKeyCount();
for( int nPPDKey = 0; nPPDKey < nGroupKeys; nPPDKey++ ) for( int nPPDKey = 0; nPPDKey < nGroupKeys; nPPDKey++ )
{ {
ByteString aPPDKey( aConfig.GetKeyName( nPPDKey ) ); rtl::OString aPPDKey( aConfig.GetKeyName( nPPDKey ) );
// ignore page region // ignore page region
// there are some ppd keys in old Xpdefaults that // there are some ppd keys in old Xpdefaults that
// should never have been writte because they are defaults // should never have been writte because they are defaults
// PageRegion leads to problems in conjunction // PageRegion leads to problems in conjunction
// with a not matching PageSize // with a not matching PageSize
if( aPPDKey.CompareTo( "PPD_", 4 ) == COMPARE_EQUAL && if (comphelper::string::matchL(aPPDKey, RTL_CONSTASCII_STRINGPARAM("PPD_")) &&
aPPDKey != "PPD_PageRegion" !aPPDKey.equalsL(RTL_CONSTASCII_STRINGPARAM("PPD_PageRegion")))
)
{ {
aValue = aConfig.ReadKey( nPPDKey ); aValue = aConfig.ReadKey( nPPDKey );
aPPDKey.Erase( 0, 4 ); aPPDKey = aPPDKey.copy(4);
const PPDKey* pKey = aInfo.m_pParser->getKey( String( aPPDKey, RTL_TEXTENCODING_ISO_8859_1 ) ); const PPDKey* pKey = aInfo.m_pParser->getKey( rtl::OStringToOUString(aPPDKey, RTL_TEXTENCODING_ISO_8859_1) );
const PPDValue* pValue = pKey ? ( aValue.equalsL(RTL_CONSTASCII_STRINGPARAM("*nil")) ? NULL : pKey->getValue(rtl::OStringToOUString(aValue, RTL_TEXTENCODING_ISO_8859_1)) ) : NULL; const PPDValue* pValue = pKey ? ( aValue.equalsL(RTL_CONSTASCII_STRINGPARAM("*nil")) ? NULL : pKey->getValue(rtl::OStringToOUString(aValue, RTL_TEXTENCODING_ISO_8859_1)) ) : NULL;
if( pKey ) if( pKey )
aInfo.m_aContext.setValue( pKey, pValue, true ); aInfo.m_aContext.setValue( pKey, pValue, true );
...@@ -1097,40 +1096,40 @@ String AddPrinterDialog::uniquePrinterName( const String& rBase ) ...@@ -1097,40 +1096,40 @@ String AddPrinterDialog::uniquePrinterName( const String& rBase )
String AddPrinterDialog::getOldPrinterLocation() String AddPrinterDialog::getOldPrinterLocation()
{ {
static const char* pHome = getenv( "HOME" ); static const char* pHome = getenv( "HOME" );
String aRet; rtl::OString aFileName;
ByteString aFileName;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
if( pHome ) if( pHome )
{ {
aFileName = pHome; aFileName = rtl::OStringBuffer().append(pHome).
aFileName.Append( "/.Xpdefaults" ); append(RTL_CONSTASCII_STRINGPARAM("/.Xpdefaults")).
if( access( aFileName.GetBuffer(), F_OK ) ) makeStringAndClear();
if (access(aFileName.getStr(), F_OK))
{ {
aFileName = pHome; aFileName = rtl::OStringBuffer().append(pHome).
aFileName.Append( "/.sversionrc" ); append(RTL_CONSTASCII_STRINGPARAM("/.sversionrc")).
Config aSVer( String( aFileName, aEncoding ) ); makeStringAndClear();
Config aSVer(rtl::OStringToOUString(aFileName, aEncoding));
aSVer.SetGroup( "Versions" ); aSVer.SetGroup( "Versions" );
aFileName = aSVer.ReadKey( "StarOffice 5.2" ); aFileName = aSVer.ReadKey( "StarOffice 5.2" );
if( aFileName.Len() ) if (!aFileName.isEmpty())
aFileName.Append( "/share/xp3/Xpdefaults" ); aFileName = aFileName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("/share/xp3/Xpdefaults"));
else if( else if(
(aFileName = aSVer.ReadKey( "StarOffice 5.1" ) ).Len() (aFileName = aSVer.ReadKey( "StarOffice 5.1" ) ).getLength()
|| ||
(aFileName = aSVer.ReadKey( "StarOffice 5.0" ) ).Len() (aFileName = aSVer.ReadKey( "StarOffice 5.0" ) ).getLength()
|| ||
(aFileName = aSVer.ReadKey( "StarOffice 4.0" ) ).Len() (aFileName = aSVer.ReadKey( "StarOffice 4.0" ) ).getLength()
) )
{ {
aFileName.Append( "/xp3/Xpdefaults" ); aFileName = aFileName + rtl::OString(RTL_CONSTASCII_STRINGPARAM("/xp3/Xpdefaults"));
} }
if( aFileName.Len() && access( aFileName.GetBuffer(), F_OK ) ) if (!aFileName.isEmpty() && access(aFileName.getStr(), F_OK))
aFileName.Erase(); aFileName = rtl::OString();
} }
} }
if( aFileName.Len() )
aRet = String( aFileName, aEncoding ); return !aFileName.isEmpty() ? rtl::OStringToOUString(aFileName, aEncoding) : rtl::OUString();
return aRet;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -82,7 +82,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) ...@@ -82,7 +82,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
int nLen = strlen( pBuffer ); int nLen = strlen( pBuffer );
if( pBuffer[nLen-1] == '\n' ) // strip newline if( pBuffer[nLen-1] == '\n' ) // strip newline
pBuffer[--nLen] = 0; pBuffer[--nLen] = 0;
aCommand = String( ByteString( pBuffer ), aEncoding ); aCommand = rtl::OUString(pBuffer, nLen, aEncoding);
if( ( ( aCommand.GetChar( 0 ) == '/' ) if( ( ( aCommand.GetChar( 0 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
...@@ -105,7 +105,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) ...@@ -105,7 +105,7 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands )
int nLen = strlen( pBuffer ); int nLen = strlen( pBuffer );
if( pBuffer[nLen-1] == '\n' ) // strip newline if( pBuffer[nLen-1] == '\n' ) // strip newline
pBuffer[--nLen] = 0; pBuffer[--nLen] = 0;
aCommand = String( ByteString( pBuffer ), aEncoding ); aCommand = rtl::OUString(pBuffer, nLen, aEncoding);
if( ( ( aCommand.GetChar( 0 ) == '/' ) if( ( ( aCommand.GetChar( 0 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' )
|| ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) )
......
...@@ -80,9 +80,9 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) : ...@@ -80,9 +80,9 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) :
m_aPathBox.SetText( rtl::OStringToOUString(rConfig.ReadKey("LastDir"), RTL_TEXTENCODING_UTF8) ); m_aPathBox.SetText( rtl::OStringToOUString(rConfig.ReadKey("LastDir"), RTL_TEXTENCODING_UTF8) );
for (sal_Int32 i = 0; i < 11; ++i) for (sal_Int32 i = 0; i < 11; ++i)
{ {
ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i))); rtl::OString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i)));
if( aEntry.Len() ) if (!aEntry.isEmpty())
m_aPathBox.InsertEntry( String( aEntry, RTL_TEXTENCODING_UTF8 ) ); m_aPathBox.InsertEntry(rtl::OStringToOUString(aEntry, RTL_TEXTENCODING_UTF8));
} }
m_aOKBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) ); m_aOKBtn.SetClickHdl( LINK( this, PPDImportDialog, ClickBtnHdl ) );
......
...@@ -123,8 +123,7 @@ void setupMethodStubs( functor_vector_type& res ) ...@@ -123,8 +123,7 @@ void setupMethodStubs( functor_vector_type& res )
aPoly3.Rotate( aPoly3.GetBoundRect().Center(), aPoly3.Rotate( aPoly3.GetBoundRect().Center(),
900 ); 900 );
const String aString( ByteString("This is a test"), const String aString(RTL_CONSTASCII_USTRINGPARAM("This is a test"));
RTL_TEXTENCODING_ASCII_US );
const LineInfo aLineInfo(LINE_SOLID,5); const LineInfo aLineInfo(LINE_SOLID,5);
// unfortunately, VDevs have inaccessible copy constructors // unfortunately, VDevs have inaccessible copy constructors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment