summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-07 11:37:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-07 12:27:32 +0000
commit0a590fc4f0ae79faeea402ec4868cfd89b5f0371 (patch)
treeb95f882ac48c947da986226f0cee09760f49d941 /extensions
parent994a737a317165db736f2a2f6a25b3439207da5d (diff)
make extensions ByteString free
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/bibliography/datman.cxx189
-rw-r--r--extensions/source/plugin/base/xplugin.cxx10
-rw-r--r--extensions/source/plugin/inc/plugin/unx/mediator.hxx8
-rw-r--r--extensions/source/plugin/unx/sysplug.cxx26
-rw-r--r--extensions/source/plugin/unx/unxmgr.cxx44
-rw-r--r--extensions/source/scanner/sane.cxx16
-rw-r--r--extensions/source/scanner/sane.hxx2
-rw-r--r--extensions/source/scanner/sanedlg.cxx50
8 files changed, 162 insertions, 183 deletions
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index f825c6f42f75..8668ed1ff174 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -118,7 +118,7 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL)
{
xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY);
}
- catch(Exception &)
+ catch (const Exception&)
{
OSL_FAIL("Exception caught in ODatabaseContext::getRegisteredObject()");
}
@@ -138,15 +138,13 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL)
Reference<task::XInteractionHandler> xIHdl(xHdl, UNO_QUERY);
xConn = xComplConn->connectWithCompletion(xIHdl);
}
- catch(SQLException&)
+ catch (const SQLException&)
{
// TODO : a real error handling
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
}
-
}
return xConn;
}
@@ -166,9 +164,8 @@ Reference< XConnection > getConnection(const Reference< XInterface > & xRowSe
DBG_WARNING("no active connection");
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("exception in getConnection");
}
@@ -204,17 +201,15 @@ Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
if (xSupplyCols.is())
xReturn = xSupplyCols->getColumns();
}
-#ifdef DBG_UTIL
- catch(Exception& e )
-#else
- catch(Exception&)
-#endif
+ catch (const Exception& e)
{
#ifdef DBG_UTIL
String sMsg(String::CreateFromAscii("::getColumns : catched an exception ("));
sMsg += String(e.Message);
sMsg.AppendAscii(") ...");
- OSL_FAIL( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer());
+ OSL_FAIL(rtl::OUStringToOString(sMsg, RTL_TEXTENCODING_ASCII_US ).getStr());
+#else
+ (void)e;
#endif
}
@@ -625,13 +620,10 @@ DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan )
}
aSelectionLB.GetModel()->Resort();
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl");
}
-
-
}
IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, /*pLB*/)
@@ -855,9 +847,8 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
xColContainer->insertByName( *pFields, makeAny( xCurrentCol ) );
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("Exception in BibDataManager::InsertFields");
}
}
@@ -887,13 +878,11 @@ Reference< awt::XControlModel > BibDataManager::updateGridModel(const Reference<
Reference< XFormComponent > xFormComp( m_xGridModel, UNO_QUERY );
InsertFields( xFormComp );
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::updateGridModel: something went wrong !");
}
-
return m_xGridModel;
}
@@ -971,13 +960,11 @@ Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc)
}
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::createDatabaseForm: something went wrong !");
}
-
return xResult;
}
//------------------------------------------------------------------------
@@ -994,13 +981,11 @@ Sequence< ::rtl::OUString > BibDataManager::getDataSources()
if (xTables.is())
aTableNameSeq = xTables->getElementNames();
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::getDataSources: something went wrong !");
}
-
return aTableNameSeq;
}
//------------------------------------------------------------------------
@@ -1022,7 +1007,7 @@ void BibDataManager::setFilter(const ::rtl::OUString& rQuery)
xFormProps->setPropertyValue( C2U( "ApplyFilter" ), makeAny( sal_True ) );
reload();
}
- catch(Exception&)
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -1039,7 +1024,7 @@ void BibDataManager::setFilter(const ::rtl::OUString& rQuery)
Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW );
OSL_VERIFY( xFormProps->getPropertyValue( C2U( "Filter" ) ) >>= aQueryString );
}
- catch( const Exception& )
+ catch (const Exception&)
{
DBG_UNHANDLED_EXCEPTION();
}
@@ -1234,12 +1219,10 @@ void BibDataManager::setActiveDataTable(const ::rtl::OUString& rTable)
}
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::setActiveDataTable: something went wrong !");
}
-
}
//------------------------------------------------------------------------
@@ -1367,13 +1350,11 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const ::rtl::OUS
xPropSet->setPropertyValue( uProp, makeAny( sId ) );
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::createGridModel: something went wrong !");
}
-
return xModel;
}
//------------------------------------------------------------------------
@@ -1489,9 +1470,8 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel(
}
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::loadControlModel: something went wrong !");
}
return xModel;
@@ -1529,104 +1509,97 @@ void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw
xLocate->moveToBookmark(aUID);
}
}
- catch(Exception& e )
+ catch (const Exception&)
{
- (void) e; // make compiler happy
OSL_FAIL("::propertyChange: something went wrong !");
}
-
-
}
+
//------------------------------------------------------------------------
void BibDataManager::SetMeAsUidListener()
{
-try
-{
- Reference< XNameAccess > xFields = getColumns( m_xForm );
- if (!xFields.is())
- return;
-
- Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
- const ::rtl::OUString* pFields = aFields.getConstArray();
- sal_Int32 nCount=aFields.getLength();
- String StrUID(C2S(STR_UID));
- ::rtl::OUString theFieldName;
- for( sal_Int32 i=0; i<nCount; i++ )
+ try
{
- String aName= pFields[i];
+ Reference< XNameAccess > xFields = getColumns( m_xForm );
+ if (!xFields.is())
+ return;
- if(aName.EqualsIgnoreCaseAscii(StrUID))
+ Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
+ const ::rtl::OUString* pFields = aFields.getConstArray();
+ sal_Int32 nCount=aFields.getLength();
+ String StrUID(C2S(STR_UID));
+ ::rtl::OUString theFieldName;
+ for( sal_Int32 i=0; i<nCount; i++ )
{
- theFieldName=pFields[i];
- break;
+ String aName= pFields[i];
+
+ if(aName.EqualsIgnoreCaseAscii(StrUID))
+ {
+ theFieldName=pFields[i];
+ break;
+ }
}
- }
- if(theFieldName.getLength()>0)
- {
- Reference< XPropertySet > xPropSet;
- Any aElement;
+ if(theFieldName.getLength()>0)
+ {
+ Reference< XPropertySet > xPropSet;
+ Any aElement;
- aElement = xFields->getByName(theFieldName);
- xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
+ aElement = xFields->getByName(theFieldName);
+ xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
- xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this);
- }
+ xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this);
+ }
+ }
+ catch (const Exception&)
+ {
+ OSL_FAIL("Exception in BibDataManager::SetMeAsUidListener");
+ }
}
-catch(Exception& e )
-{
- (void) e; // make compiler happy
- OSL_FAIL("Exception in BibDataManager::SetMeAsUidListener");
-}
-
-}
//------------------------------------------------------------------------
void BibDataManager::RemoveMeAsUidListener()
{
-try
-{
- Reference< XNameAccess > xFields = getColumns( m_xForm );
- if (!xFields.is())
- return;
-
-
- Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
- const ::rtl::OUString* pFields = aFields.getConstArray();
- sal_Int32 nCount=aFields.getLength();
- String StrUID(C2S(STR_UID));
- ::rtl::OUString theFieldName;
- for( sal_Int32 i=0; i<nCount; i++ )
+ try
{
- String aName= pFields[i];
+ Reference< XNameAccess > xFields = getColumns( m_xForm );
+ if (!xFields.is())
+ return;
- if(aName.EqualsIgnoreCaseAscii(StrUID))
- {
- theFieldName=pFields[i];
- break;
- }
- }
- if(theFieldName.getLength()>0)
- {
- Reference< XPropertySet > xPropSet;
- Any aElement;
+ Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
+ const ::rtl::OUString* pFields = aFields.getConstArray();
+ sal_Int32 nCount=aFields.getLength();
+ String StrUID(C2S(STR_UID));
+ ::rtl::OUString theFieldName;
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ String aName= pFields[i];
- aElement = xFields->getByName(theFieldName);
- xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
+ if(aName.EqualsIgnoreCaseAscii(StrUID))
+ {
+ theFieldName=pFields[i];
+ break;
+ }
+ }
- xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this);
- }
+ if(theFieldName.getLength()>0)
+ {
+ Reference< XPropertySet > xPropSet;
+ Any aElement;
-}
-catch(Exception& e )
-{
- (void) e; // make compiler happy
- OSL_FAIL("Exception in BibDataManager::RemoveMeAsUidListener");
-}
+ aElement = xFields->getByName(theFieldName);
+ xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
+ xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this);
+ }
+ }
+ catch (const Exception&)
+ {
+ OSL_FAIL("Exception in BibDataManager::RemoveMeAsUidListener");
+ }
}
void BibDataManager::CreateMappingDialog(Window* pParent)
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index 09745a69d014..fd202ad5897d 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -777,15 +777,15 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype,
#endif
if( isfile && stype == NP_ASFILEONLY )
{
- OString aFileName;
+ rtl::OString aFileName;
if( url.compareToAscii( "file:", 5 ) == 0 )
{
OUString aSysName;
osl_getSystemPathFromFileURL( url.pData, &aSysName.pData );
- aFileName = OUStringToOString( aSysName, m_aEncoding );
+ aFileName = rtl::OUStringToOString( aSysName, m_aEncoding );
}
else
- aFileName = OUStringToOString( url, m_aEncoding );
+ aFileName = rtl::OUStringToOString( url, m_aEncoding );
m_pPluginComm->
NPP_StreamAsFile( &m_aInstance,
pStream->getStream(),
@@ -989,7 +989,7 @@ PluginInputStream::~PluginInputStream()
m_aFileStream.Close();
if( m_pPlugin )
{
- ByteString aFileName( aFile, m_pPlugin->getTextEncoding() );
+ rtl::OString aFileName(rtl::OUStringToOString(aFile, m_pPlugin->getTextEncoding()));
if( m_pPlugin->getPluginComm() && m_nMode != -1 )
// mode -1 means either an error occurred,
// or the plugin is already disposing
@@ -1000,7 +1000,7 @@ PluginInputStream::~PluginInputStream()
m_pPlugin->getPluginComm()->
NPP_StreamAsFile( m_pPlugin->getNPPInstance(),
&m_aNPStream,
- aFileName.GetBuffer() );
+ aFileName.getStr() );
}
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin );
m_pPlugin->getInputStreams().remove( this );
diff --git a/extensions/source/plugin/inc/plugin/unx/mediator.hxx b/extensions/source/plugin/inc/plugin/unx/mediator.hxx
index 72c0e3e82d3d..6a0dd053c298 100644
--- a/extensions/source/plugin/inc/plugin/unx/mediator.hxx
+++ b/extensions/source/plugin/inc/plugin/unx/mediator.hxx
@@ -114,10 +114,10 @@ public:
void invalidate() { m_bValid = false; }
sal_uLong SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong nMessageID = 0 );
- sal_uLong SendMessage( const ByteString& rMessage, sal_uLong nMessageID = 0 )
- {
- return SendMessage( rMessage.Len(), rMessage.GetBuffer(), nMessageID );
- }
+ sal_uLong SendMessage( const rtl::OString& rMessage, sal_uLong nMessageID = 0 )
+ {
+ return SendMessage( rMessage.getLength(), rMessage.getStr(), nMessageID );
+ }
sal_Bool WaitForMessage( sal_uLong nTimeOut = 5000 );
// timeout in ms
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
index e2772170267a..dbc1514d2f45 100644
--- a/extensions/source/plugin/unx/sysplug.cxx
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -58,22 +58,24 @@ UnxPluginComm::UnxPluginComm(
PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ), false ),
PluginConnector( nDescriptor2 )
{
- char pDesc[32];
- char pWindow[32];
- sprintf( pWindow, "%d", (int)aParent );
- sprintf( pDesc, "%d", nDescriptor1 );
- ByteString aLib( library, osl_getThreadTextEncoding() );
rtl::OString path;
- if (!getPluginappPath(&path)) {
+ if (!getPluginappPath(&path))
+ {
fprintf( stderr, "cannot construct path to pluginapp.bin\n" );
m_nCommPID = -1;
return;
}
+ char pDesc[32];
+ char pWindow[32];
+ sprintf( pWindow, "%d", (int)aParent );
+ sprintf( pDesc, "%d", nDescriptor1 );
+ rtl::OString aLib(rtl::OUStringToOString(library, osl_getThreadTextEncoding()));
+
char const* pArgs[5];
pArgs[0] = path.getStr();
pArgs[1] = pDesc;
- pArgs[2] = aLib.GetBuffer();
+ pArgs[2] = aLib.getStr();
pArgs[3] = pWindow;
pArgs[4] = NULL;
@@ -83,11 +85,11 @@ UnxPluginComm::UnxPluginComm(
#endif
if( ! ( m_nCommPID = fork() ) )
- {
- execvp( pArgs[0], const_cast< char ** >(pArgs) );
- fprintf( stderr, "Error: could not exec %s\n", pArgs[0] );
- _exit(255);
- }
+ {
+ execvp( pArgs[0], const_cast< char ** >(pArgs) );
+ fprintf( stderr, "Error: could not exec %s\n", pArgs[0] );
+ _exit(255);
+ }
if( m_nCommPID != -1 )
{
diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx
index 7c77c835dbc3..270ba931d50c 100644
--- a/extensions/source/plugin/unx/unxmgr.cxx
+++ b/extensions/source/plugin/unx/unxmgr.cxx
@@ -56,14 +56,14 @@ using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
// Unix specific implementation
-static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rDescriptions )
+static bool CheckPlugin( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions )
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "Trying plugin %s ... ", rPath.GetBuffer() );
+ fprintf( stderr, "Trying plugin %s ... ", rPath.getStr() );
#endif
- xub_StrLen nPos = rPath.SearchBackward( '/' );
- if( nPos == STRING_NOTFOUND )
+ sal_Int32 nPos = rPath.lastIndexOf('/');
+ if (nPos == -1)
{
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "no absolute path to plugin\n" );
@@ -71,29 +71,29 @@ static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rD
return false;
}
- ByteString aBaseName = rPath.Copy( nPos+1 );
- if( aBaseName.Equals( "libnullplugin.so" ) )
+ rtl::OString aBaseName = rPath.copy(nPos+1);
+ if (aBaseName.equalsL(RTL_CONSTASCII_STRINGPARAM("libnullplugin.so")))
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "don't like %s\n", aBaseName.GetBuffer() );
+ fprintf( stderr, "don't like %s\n", aBaseName.getStr() );
#endif
return false;
}
struct stat aStat;
- if( stat( rPath.GetBuffer(), &aStat ) || ! S_ISREG( aStat.st_mode ) )
+ if (stat(rPath.getStr(), &aStat) || !S_ISREG(aStat.st_mode))
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s is not a regular file\n", rPath.GetBuffer() );
+ fprintf( stderr, "%s is not a regular file\n", rPath.getStr() );
#endif
return false;
}
-
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
rtl::OString path;
- if (!UnxPluginComm::getPluginappPath(&path)) {
+ if (!UnxPluginComm::getPluginappPath(&path))
+ {
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "cannot construct path to pluginapp.bin\n" );
#endif
@@ -209,7 +209,7 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes
for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
;
if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
- CheckPlugin( ByteString( aLine, nDotPos ), rDescriptions );
+ CheckPlugin( rtl::OString(aLine, nDotPos), rDescriptions );
}
fclose( fp );
}
@@ -270,16 +270,16 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th
rPaths.getConstArray()[i], aEncoding));
}
- ByteString aSearchPath = aSearchBuffer.makeStringAndClear();
+ rtl::OString aSearchPath = aSearchBuffer.makeStringAndClear();
- int nPaths = aSearchPath.GetTokenCount( ':' );
+ sal_Int32 nIndex = 0;
maxDirent u;
- for( i = 0; i < nPaths; i++ )
+ do
{
- ByteString aPath( aSearchPath.GetToken( i, ':' ) );
- if( aPath.Len() )
+ rtl::OString aPath(aSearchPath.getToken(0, ':', nIndex));
+ if (aPath.getLength())
{
- DIR* pDIR = opendir( aPath.GetBuffer() );
+ DIR* pDIR = opendir(aPath.getStr());
struct dirent* pDirEnt = NULL;
while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt )
{
@@ -288,16 +288,16 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th
pBaseName[1] != '.' ||
pBaseName[2] != 0 )
{
- ByteString aFileName( aPath );
- aFileName += "/";
- aFileName += pBaseName;
- CheckPlugin( aFileName, aPlugins );
+ rtl::OStringBuffer aFileName(aPath);
+ aFileName.append('/').append(pBaseName);
+ CheckPlugin( aFileName.makeStringAndClear(), aPlugins );
}
}
if( pDIR )
closedir( pDIR );
}
}
+ while ( nIndex >= 0 );
// try ~/.mozilla/pluginreg.dat
rtl::OStringBuffer aBuf(256);
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index 39638ca51767..48eae47edc91 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -156,7 +156,7 @@ SANE_Status Sane::ControlOption( int nOption, SANE_Action nAction,
pAction = "SANE_ACTION_SET_AUTO";break;
}
dbg_msg( "Option: \"%s\" action: %s\n",
- ByteString( GetOptionName( nOption ), gsl_getSystemTextEncoding() ).GetBuffer(),
+ rtl::OUStringToOString(GetOptionName(nOption), osl_getThreadTextEncoding()).getStr(),
pAction );
}
#endif
@@ -312,10 +312,10 @@ sal_Bool Sane::Open( const char* name )
if( mnDevice == -1 )
{
- ByteString aDevice( name );
+ rtl::OString aDevice( name );
for( int i = 0; i < nDevices; i++ )
{
- if( aDevice.Equals( ppDevices[i]->name ) )
+ if( aDevice.equals( ppDevices[i]->name ) )
{
mnDevice = i;
break;
@@ -351,10 +351,10 @@ void Sane::Close()
int Sane::GetOptionByName( const char* rName )
{
int i;
- ByteString aOption( rName );
+ rtl::OString aOption( rName );
for( i = 0; i < mnOptions; i++ )
{
- if( mppOptions[i]->name && aOption.Equals( mppOptions[i]->name ) )
+ if( mppOptions[i]->name && aOption.equals( mppOptions[i]->name ) )
return i;
}
return -1;
@@ -373,7 +373,7 @@ sal_Bool Sane::GetOptionValue( int n, sal_Bool& rRet )
return sal_True;
}
-sal_Bool Sane::GetOptionValue( int n, ByteString& rRet )
+sal_Bool Sane::GetOptionValue( int n, rtl::OString& rRet )
{
sal_Bool bSuccess = sal_False;
if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING )
@@ -450,8 +450,8 @@ sal_Bool Sane::SetOptionValue( int n, const String& rSet )
{
if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING )
return sal_False;
- ByteString aSet( rSet, gsl_getSystemTextEncoding() );
- SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, (void*)aSet.GetBuffer() );
+ rtl::OString aSet(rtl::OUStringToOString(rSet, osl_getThreadTextEncoding()));
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, (void*)aSet.getStr() );
if( nStatus != SANE_STATUS_GOOD )
return sal_False;
return sal_True;
diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx
index fe5a63477cf2..680a66727c17 100644
--- a/extensions/source/scanner/sane.hxx
+++ b/extensions/source/scanner/sane.hxx
@@ -156,7 +156,7 @@ public:
inline int GetOptionElements( int n );
int GetOptionByName( const char* );
sal_Bool GetOptionValue( int, sal_Bool& );
- sal_Bool GetOptionValue( int, ByteString& );
+ sal_Bool GetOptionValue( int, rtl::OString& );
sal_Bool GetOptionValue( int, double&, int nElement = 0 );
sal_Bool GetOptionValue( int, double* );
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index c83406fec628..5e9bfac4644b 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -515,8 +515,9 @@ IMPL_LINK( SaneDlg, SelectHdl, ListBox*, pListBox )
{
if( pListBox == &maQuantumRangeBox )
{
- ByteString aValue( maQuantumRangeBox.GetSelectEntry(), osl_getThreadTextEncoding() );
- double fValue = atof( aValue.GetBuffer() );
+ rtl::OString aValue(rtl::OUStringToOString(maQuantumRangeBox.GetSelectEntry(),
+ osl_getThreadTextEncoding()));
+ double fValue = atof(aValue.getStr());
mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
}
else if( pListBox == &maStringRangeBox )
@@ -533,7 +534,8 @@ IMPL_LINK( SaneDlg, OptionsBoxSelectHdl, SvTreeListBox*, pBox )
{
String aOption =
maOptionBox.GetEntryText( maOptionBox.FirstSelected() );
- int nOption = mrSane.GetOptionByName( ByteString( aOption, osl_getThreadTextEncoding() ).GetBuffer() );
+ int nOption = mrSane.GetOptionByName(rtl::OUStringToOString(aOption,
+ osl_getThreadTextEncoding()).getStr());
if( nOption != -1 && nOption != mnCurrentOption )
{
DisableOption();
@@ -636,8 +638,9 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit )
{
double fValue;
char pBuf[256];
- ByteString aContents( maNumericEdit.GetText(), osl_getThreadTextEncoding() );
- fValue = atof( aContents.GetBuffer() );
+ rtl::OString aContents(rtl::OUStringToOString(maNumericEdit.GetText(),
+ osl_getThreadTextEncoding()));
+ fValue = atof(aContents.getStr());
if( mfMin != mfMax && ( fValue < mfMin || fValue > mfMax ) )
{
if( fValue < mfMin )
@@ -825,7 +828,7 @@ void SaneDlg::EstablishBoolOption()
void SaneDlg::EstablishStringOption()
{
sal_Bool bSuccess;
- ByteString aValue;
+ rtl::OString aValue;
bSuccess = mrSane.GetOptionValue( mnCurrentOption, aValue );
if( bSuccess )
@@ -843,7 +846,7 @@ void SaneDlg::EstablishStringRange()
maStringRangeBox.Clear();
for( int i = 0; ppStrings[i] != 0; i++ )
maStringRangeBox.InsertEntry( String( ppStrings[i], osl_getThreadTextEncoding() ) );
- ByteString aValue;
+ rtl::OString aValue;
mrSane.GetOptionValue( mnCurrentOption, aValue );
maStringRangeBox.SelectEntry( String( aValue, osl_getThreadTextEncoding() ) );
maStringRangeBox.Show( sal_True );
@@ -1189,13 +1192,13 @@ sal_Bool SaneDlg::LoadState()
return sal_False;
aConfig.SetGroup( "SANE" );
- ByteString aString = aConfig.ReadKey( "SO_LastSaneDevice" );
- for( i = 0; i < Sane::CountDevices() && ! aString.Equals( ByteString( Sane::GetName( i ), osl_getThreadTextEncoding() ) ); i++ ) ;
+ rtl::OString aString = aConfig.ReadKey( "SO_LastSaneDevice" );
+ for( i = 0; i < Sane::CountDevices() && !aString.equals(rtl::OUStringToOString(Sane::GetName(i), osl_getThreadTextEncoding())); i++ ) ;
if( i == Sane::CountDevices() )
return sal_False;
mrSane.Close();
- mrSane.Open( aString.GetBuffer() );
+ mrSane.Open( aString.getStr() );
DisableOption();
InitFields();
@@ -1207,7 +1210,7 @@ sal_Bool SaneDlg::LoadState()
{
aString = aConfig.GetKeyName( i );
rtl::OString aValue = aConfig.ReadKey( i );
- int nOption = mrSane.GetOptionByName( aString.GetBuffer() );
+ int nOption = mrSane.GetOptionByName( aString.getStr() );
if( nOption == -1 )
continue;
@@ -1235,7 +1238,7 @@ sal_Bool SaneDlg::LoadState()
rtl::OString aSub = aValue.getToken(0, ':', nIndex);
double fValue=0.0;
sscanf(aSub.getStr(), "%lg", &fValue);
- SetAdjustedNumericalValue(aString.GetBuffer(), fValue, n++);
+ SetAdjustedNumericalValue(aString.getStr(), fValue, n++);
}
while ( nIndex >= 0 );
}
@@ -1260,7 +1263,8 @@ void SaneDlg::SaveState()
Config aConfig( aFileName );
aConfig.DeleteGroup( "SANE" );
aConfig.SetGroup( "SANE" );
- aConfig.WriteKey( "SO_LastSANEDevice", ByteString( maDeviceBox.GetSelectEntry(), RTL_TEXTENCODING_UTF8 ) );
+ aConfig.WriteKey( "SO_LastSANEDevice",
+ rtl::OUStringToOString(maDeviceBox.GetSelectEntry(), RTL_TEXTENCODING_UTF8) );
static char const* pSaveOptions[] = {
"resolution",
@@ -1269,9 +1273,9 @@ void SaneDlg::SaveState()
"br-x",
"br-y"
};
- for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); i++ )
+ for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); ++i )
{
- ByteString aOption = pSaveOptions[i];
+ rtl::OString aOption = pSaveOptions[i];
int nOption = mrSane.GetOptionByName( pSaveOptions[i] );
if( nOption > -1 )
{
@@ -1292,19 +1296,19 @@ void SaneDlg::SaveState()
break;
case SANE_TYPE_STRING:
{
- ByteString aString( "STRING=" );
- ByteString aValue;
+ rtl::OString aValue;
if( mrSane.GetOptionValue( nOption, aValue ) )
{
- aString += aValue;
- aConfig.WriteKey( aOption, aString );
+ rtl::OStringBuffer aString(RTL_CONSTASCII_STRINGPARAM("STRING="));
+ aString.append(aValue);
+ aConfig.WriteKey( aOption, aString.makeStringAndClear() );
}
}
break;
case SANE_TYPE_FIXED:
case SANE_TYPE_INT:
{
- ByteString aString( "NUMERIC=" );
+ rtl::OStringBuffer aString(RTL_CONSTASCII_STRINGPARAM("NUMERIC="));
double fValue;
char buf[256];
int n;
@@ -1314,12 +1318,12 @@ void SaneDlg::SaveState()
if( ! mrSane.GetOptionValue( nOption, fValue, n ) )
break;
if( n > 0 )
- aString += ":";
+ aString.append(':');
sprintf( buf, "%lg", fValue );
- aString += buf;
+ aString.append(buf);
}
if( n >= mrSane.GetOptionElements( nOption ) )
- aConfig.WriteKey( aOption, aString );
+ aConfig.WriteKey( aOption, aString.makeStringAndClear() );
}
break;
default: