From 6f33482f8f4329b6c9874397bdb67c1b958b69c2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 27 Nov 2011 20:37:42 +0000 Subject: ByteString->rtl::OUStringToOString --- basic/source/app/app.cxx | 14 +++++----- basic/source/app/appwin.cxx | 2 +- basic/source/app/brkpnts.cxx | 4 +-- basic/source/app/dialogs.cxx | 34 +++++++++++------------ basic/source/app/msgedit.cxx | 12 ++++---- basic/source/app/textedit.cxx | 2 +- basic/source/classes/disas.cxx | 10 +++---- basic/source/classes/image.cxx | 4 +-- basic/source/comp/buffer.cxx | 4 +-- basic/source/runtime/iosys.cxx | 2 +- basic/source/runtime/methods.cxx | 9 +++--- basic/source/runtime/methods1.cxx | 9 +++--- basic/source/runtime/step0.cxx | 8 +++--- basic/source/runtime/step2.cxx | 2 +- basic/source/sbx/sbxobj.cxx | 58 +++++++++++++++++++-------------------- basic/source/sbx/sbxvar.cxx | 16 +++++------ 16 files changed, 96 insertions(+), 94 deletions(-) (limited to 'basic') diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 14f96338faef..ac6d801004e9 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -326,9 +326,9 @@ int BasicApp::Main( ) RemoveAccel( pMainAccel ); } - catch(const class Exception & rEx) + catch (const class Exception & rEx) { - printf( "Exception not caught: %s\n", ByteString( String(rEx.Message), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + printf( "Exception not caught: %s\n", rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); String aMsg( String::CreateFromAscii( "Exception not caught: " ) ); aMsg.Append( String( rEx.Message ) ); InfoBox( NULL, aMsg ).Execute(); @@ -1078,7 +1078,7 @@ void BasicFrame::AddToLRU(String const& aFile) pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, MENU2FILENAME( pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1) ) )); } } - aConfig.WriteKey(LRUNr(1), ByteString( aFile, RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey(LRUNr(1), rtl::OUStringToOString(aFile, RTL_TEXTENCODING_UTF8) ); if ( pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND ) pPopup->InsertItem(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile)); else @@ -1657,7 +1657,7 @@ class NewFileDialog : public FileDialog private: String aLastPath; public: - ByteString aFilterType; + rtl::OString aFilterType; NewFileDialog( Window* pParent, WinBits nWinStyle ):FileDialog( pParent, nWinStyle ){}; virtual short Execute(); virtual void FilterSelect(); @@ -1677,7 +1677,7 @@ void NewFileDialog::FilterSelect() { nFilterNr++; } - aFilterType = ByteString( GetFilterType( nFilterNr ), RTL_TEXTENCODING_UTF8 ); + aFilterType = rtl::OUStringToOString(GetFilterType(nFilterNr), RTL_TEXTENCODING_UTF8); Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup( "Misc" ); @@ -1696,8 +1696,8 @@ short NewFileDialog::Execute() aConf.SetGroup( "Misc" ); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aFilterType, ByteString( DirEntry( GetPath() ).GetPath().GetFull(), RTL_TEXTENCODING_UTF8 ) ); - aConf.WriteKey( "LastFilterName", ByteString( GetCurFilter(), RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( aFilterType, rtl::OUStringToOString(DirEntry(GetPath()).GetPath().GetFull(), RTL_TEXTENCODING_UTF8) ); + aConf.WriteKey( "LastFilterName", rtl::OUStringToOString(GetCurFilter(), RTL_TEXTENCODING_UTF8) ); } return bRet; } diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx index 4a612a0880ce..d19da42822f0 100644 --- a/basic/source/app/appwin.cxx +++ b/basic/source/app/appwin.cxx @@ -459,7 +459,7 @@ sal_Bool AppWin::Load( const String& aName ) aMsg.AppendAscii("\""); if ( pFrame->IsAutoRun() ) { - printf( "%s\n", ByteString( aMsg, osl_getThreadTextEncoding() ).GetBuffer() ); + printf( "%s\n", rtl::OUStringToOString(aMsg, osl_getThreadTextEncoding()).getStr() ); } else { diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index fba13a28c8bb..bb9b3a0aa15d 100644 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -225,9 +225,9 @@ void BreakpointWindow::SaveBreakpoints( String aFilename ) aConfig.SetGroup("Breakpoints"); if (aBreakpoints.getLength()) - aConfig.WriteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ), aBreakpoints.makeStringAndClear() ); + aConfig.WriteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8), aBreakpoints.makeStringAndClear() ); else - aConfig.DeleteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ) ); + aConfig.DeleteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8) ); } diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index 8b0ec2192002..ef59b25dda88 100644 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -172,7 +172,7 @@ void ConfEdit::Save( Config &aConf ) aConf.SetGroup("Misc"); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aKeyName, ByteString( aEdit.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( aKeyName, rtl::OUStringToOString(aEdit.GetText(), RTL_TEXTENCODING_UTF8) ); } void ConfEdit::Reload( Config &aConf ) @@ -408,7 +408,7 @@ IMPL_LINK( ProfileOptions, Select, ComboBox*, EMPTYARG ) if ( aCbProfile.GetEntryPos( aCbProfile.GetText() ) == LISTBOX_ENTRY_NOTFOUND ) return 1; Save(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aCbProfile.GetText(), RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); ReloadProfile(); @@ -439,7 +439,7 @@ void ProfileOptions::ReloadProfile() IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) { String aProfile = aCbProfile.GetText(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aProfile, RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ) ); if ( aCbProfile.GetEntryPos( aProfile ) != COMBOBOX_ENTRY_NOTFOUND ) { aCbProfile.RemoveEntry( aProfile ); @@ -448,7 +448,7 @@ IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) // Set first remaining profile as current profile aCbProfile.SetText( aCbProfile.GetEntry( 0 ) ); aProfile = aCbProfile.GetText(); - aProfileKey = ByteString( ProfilePrefix ).Append( ByteString( aProfile, RTL_TEXTENCODING_UTF8 ) ); + aProfileKey = ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); ReloadProfile(); @@ -460,7 +460,7 @@ IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) IMPL_LINK( ProfileOptions, NewProfile, Button*, EMPTYARG ) { aCbProfile.InsertEntry( aCbProfile.GetText() ); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aCbProfile.GetText(), RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); // save last profile as new data for new profile @@ -553,7 +553,7 @@ void CrashreportOptions::Save( Config &aConfig ) else aConfig.WriteKey( "UseProxy", "false" ); - aConfig.WriteKey( "ProxyServer", ByteString( aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "ProxyServer", rtl::OUStringToOString(aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey("ProxyPort", rtl::OString::valueOf(static_cast(aNFCRPort.GetValue()))); @@ -562,7 +562,7 @@ void CrashreportOptions::Save( Config &aConfig ) else aConfig.WriteKey( "AllowContact", "false" ); - aConfig.WriteKey( "ReturnAddress", ByteString( aEDEMail.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "ReturnAddress", rtl::OUStringToOString(aEDEMail.GetText(), RTL_TEXTENCODING_UTF8) ); } IMPL_LINK( CrashreportOptions, CheckProxy, void*, EMPTYARG ) @@ -644,7 +644,7 @@ IMPL_LINK( MiscOptions, Click, void*, EMPTYARG ) void MiscOptions::Save( Config &aConfig ) { aConfig.SetGroup("Communication"); - aConfig.WriteKey( "Host", ByteString( aEDHost.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "Host", rtl::OUStringToOString(aEDHost.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey("TTPort", rtl::OString::valueOf(static_cast(aNFTTPort.GetValue()))); aConfig.WriteKey("UnoPort", @@ -668,7 +668,7 @@ void MiscOptions::Save( Config &aConfig ) rtl::OString::valueOf(static_cast(aTFMaxLRU.GetValue()))); aConfig.SetGroup("OOoProgramDir"); - aConfig.WriteKey( C_KEY_AKTUELL, ByteString( aEDProgDir.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aEDProgDir.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey( C_KEY_TYPE, ByteString( "PATH" ) ); } @@ -743,9 +743,9 @@ void FontOptions::UpdatePreview() void FontOptions::Save( Config &aConfig ) { aConfig.SetGroup("Misc"); - aConfig.WriteKey( "ScriptFontName", ByteString(aFontName.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontStyle", ByteString(aFontStyle.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontSize", ByteString(aFontSize.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontName", rtl::OUStringToOString(aFontName.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontStyle", rtl::OUStringToOString(aFontStyle.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontSize", rtl::OUStringToOString(aFontSize.GetText(), RTL_TEXTENCODING_UTF8) ); } @@ -812,7 +812,7 @@ void GenericOptions::LoadData() for ( size_t i = 0, n = pGroups->size(); i < n; ++i ) { String* pGroup = pGroups->at( i ); - aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) ); + aConf.SetGroup( rtl::OUStringToOString(*pGroup, RTL_TEXTENCODING_UTF8) ); if ( aConf.ReadKey( C_KEY_AKTUELL ).getLength() > 0 ) aCbArea.InsertEntry( *pGroup ); delete pGroup; @@ -896,7 +896,7 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) } aConf.SetGroup( aLastGroupName ); - aConf.WriteKey( C_KEY_AKTUELL, ByteString( aCurrentValue, RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aCurrentValue, RTL_TEXTENCODING_UTF8) ); sal_uInt16 i; for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) { @@ -904,12 +904,12 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) aAllValues += ';'; aAllValues += aCbValue.GetEntry( i ); } - aConf.WriteKey( C_KEY_ALLE, ByteString( aAllValues, RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( C_KEY_ALLE, rtl::OUStringToOString(aAllValues, RTL_TEXTENCODING_UTF8) ); } aCbValue.Clear(); - ByteString aGroupName = ByteString( aCbArea.GetText(), RTL_TEXTENCODING_UTF8 ); + rtl::OString aGroupName = rtl::OUStringToOString(aCbArea.GetText(), RTL_TEXTENCODING_UTF8); aCurrentValue = ReadKey( aGroupName, C_KEY_AKTUELL ); aAllValues = ReadKey( aGroupName, C_KEY_ALLE ); aType = ReadKey( aGroupName, C_KEY_TYPE ); @@ -934,7 +934,7 @@ IMPL_LINK( GenericOptions, DelGroup, Button*, EMPTYARG ) if ( aCbArea.GetEntryPos( aGroup ) != COMBOBOX_ENTRY_NOTFOUND ) { aCbArea.RemoveEntry( aGroup ); - ByteString aByteGroup( aGroup, RTL_TEXTENCODING_UTF8 ); + rtl::OString aByteGroup(rtl::OUStringToOString(aGroup, RTL_TEXTENCODING_UTF8)); aConf.DeleteGroup( aByteGroup ); } diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 22badf679354..06e68bf7fa45 100644 --- a/basic/source/app/msgedit.cxx +++ b/basic/source/app/msgedit.cxx @@ -165,7 +165,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) { String aSave = VERSION_STRING.Append( UniString::CreateFromInt32( 3 ) ).AppendAscii("\n"); // Version 3 aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); } String aLogMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n"); @@ -174,7 +174,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) { aLogMsg.ConvertLineEnd(LINEEND_CRLF); aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << ByteString( aLogMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aLogMsg, RTL_TEXTENCODING_UTF8).getStr(); aStrm.Close(); } if ( !bFileWasChanged ) @@ -195,7 +195,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) // restore Original Msg LogMsg->aDebugData.aMsg = aOriginalMsg; - printf( "%s", ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + printf( "%s", rtl::OUStringToOString(aPrintMsg, RTL_TEXTENCODING_UTF8).getStr() ); } } } @@ -676,7 +676,7 @@ sal_Bool MsgEdit::Save( const String& aName ) { String aSave = GetText(); aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); } else { @@ -687,7 +687,7 @@ sal_Bool MsgEdit::Save( const String& aName ) pRun = aEditTree.NextSibling( pRun ); aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); SvLBoxEntry *pEntry; while ( pRun ) @@ -698,7 +698,7 @@ sal_Bool MsgEdit::Save( const String& aName ) aSave = Impl_MakeSaveText( pEntry ); aSave += '\n'; aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); pEntry = aEditTree.Next( pEntry ); } pRun = aEditTree.PrevSibling( pRun ); diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx index 294b12e656be..ad66db90d856 100644 --- a/basic/source/app/textedit.cxx +++ b/basic/source/app/textedit.cxx @@ -818,7 +818,7 @@ DBG_CHKTHIS(TextEdit,0); } String aSave = GetText(); aSave.ConvertLineEnd(LINEEND_LF); - aStrm << ByteString( aSave, aFileEncoding ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, aFileEncoding).getStr(); if( aStrm.GetError() != SVSTREAM_OK ) bOk = sal_False; else diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx index 155720d036aa..2f31c59e6488 100644 --- a/basic/source/classes/disas.cxx +++ b/basic/source/classes/disas.cxx @@ -388,16 +388,16 @@ sal_Bool SbiDisas::DisasLine( String& rText ) if( cLabels[ nPC >> 3 ] & ( 1 << ( nPC & 7 ) ) ) { // Public? - ByteString aByteMethName; + rtl::OString aByteMethName; for( sal_uInt16 i = 0; i < pMod->GetMethods()->Count(); i++ ) { SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); if( pMeth ) { - aByteMethName = ByteString( pMeth->GetName(), osl_getThreadTextEncoding() ); + aByteMethName = rtl::OUStringToOString(pMeth->GetName(), osl_getThreadTextEncoding()); if( pMeth->GetId() == nPC ) { - p = aByteMethName.GetBuffer(); + p = aByteMethName.getStr(); break; } if( pMeth->GetId() >= nPC ) @@ -446,8 +446,8 @@ sal_Bool SbiDisas::DisasLine( String& rText ) void SbiDisas::StrOp( String& rText ) { String aStr = rImg.GetString( (sal_uInt16)nOp1 ); - ByteString aByteString( aStr, RTL_TEXTENCODING_ASCII_US ); - const char* p = aByteString.GetBuffer(); + rtl::OString aByteString(rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US)); + const char* p = aByteString.getStr(); if( p ) { rText += '"'; diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index a797b3dab00a..08145f557ba4 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -358,8 +358,8 @@ sal_Bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) for( i = 0; i < nStrings; i++ ) { sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ]; - ByteString aStr( pStrings + nOff, eCharSet ); - memcpy( pByteStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( char ) ); + rtl::OString aStr(rtl::OUStringToOString(rtl::OUString(pStrings + nOff), eCharSet)); + memcpy( pByteStrings + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) ); } r << (sal_uInt32) nStringSize; r.Write( pByteStrings, nStringSize ); diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx index 42646320804a..4512dbf063ef 100644 --- a/basic/source/comp/buffer.cxx +++ b/basic/source/comp/buffer.cxx @@ -224,8 +224,8 @@ sal_Bool SbiBuffer::operator +=( const String& n ) sal_uInt16 l = n.Len() + 1; if( Check( l ) ) { - ByteString aByteStr( n, osl_getThreadTextEncoding() ); - memcpy( pCur, aByteStr.GetBuffer(), l ); + rtl::OString aByteStr(rtl::OUStringToOString(n, osl_getThreadTextEncoding())); + memcpy( pCur, aByteStr.getStr(), l ); pCur += l; nOff = nOff + l; return sal_True; diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index cbdc27f15a23..2b14640a0d43 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -913,7 +913,7 @@ void SbiIoSystem::ReadCon( ByteString& rIn ) String aPromptStr( aPrompt, osl_getThreadTextEncoding() ); SbiInputDialog aDlg( NULL, aPromptStr ); if( aDlg.Execute() ) - rIn = ByteString( aDlg.GetInput(), osl_getThreadTextEncoding() ); + rIn = rtl::OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding()); else nError = SbERR_USER_ABORT; aPrompt.Erase(); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 37c690609bd5..251454b2583b 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1714,8 +1714,8 @@ RTLFUNC(Val) nRadix = 8; if ( nRadix != 10 ) { - ByteString aByteStr( aStr, osl_getThreadTextEncoding() ); - sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); + rtl::OString aByteStr(rtl::OUStringToOString(aStr, osl_getThreadTextEncoding())); + sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.getStr()+2, &pEndPtr, nRadix); nResult = (double)nlResult; } } @@ -2838,8 +2838,9 @@ RTLFUNC(GetAttr) aEntry.ToAbs(); // #57064 extract the real-path for virtual URLs - ByteString aByteStrFullPath( aEntry.GetFull(), osl_getThreadTextEncoding() ); - DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.GetBuffer()); + rtl::OString aByteStrFullPath(rtl::OUStringToOString(aEntry.GetFull(), + osl_getThreadTextEncoding())); + DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.getStr()); if (nRealFlags != 0xffffffff) { if (nRealFlags == FILE_ATTRIBUTE_NORMAL) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 23431c9c1cfa..f4bc91f44661 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -997,8 +997,8 @@ sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, { // without any length information! without end-identifier! // What does that mean for Unicode?! Choosing conversion to ByteString... - ByteString aByteStr( rStr, osl_getThreadTextEncoding() ); - *pStrm << (const char*)aByteStr.GetBuffer(); + rtl::OString aByteStr(rtl::OUStringToOString(rStr, osl_getThreadTextEncoding())); + *pStrm << (const char*)aByteStr.getStr(); } } break; @@ -1252,8 +1252,9 @@ RTLFUNC(Environ) } String aResult; // should be ANSI but that's not possible under Win16 in the DLL - ByteString aByteStr( rPar.Get(1)->GetString(), osl_getThreadTextEncoding() ); - const char* pEnvStr = getenv( aByteStr.GetBuffer() ); + rtl::OString aByteStr(rtl::OUStringToOString(rPar.Get(1)->GetString(), + osl_getThreadTextEncoding())); + const char* pEnvStr = getenv(aByteStr.getStr()); if ( pEnvStr ) aResult = String::CreateFromAscii( pEnvStr ); rPar.Get(0)->PutString( aResult ); diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index f96364a54026..4467322d0827 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -1285,7 +1285,7 @@ void SbiRuntime::StepPRINT() // print TOS if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE ) s = ' '; // one blank before s += s1; - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1299,7 +1299,7 @@ void SbiRuntime::StepPRINTF() // print TOS in field s = ' '; s += s1; s.Expand( 14, ' ' ); - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1323,7 +1323,7 @@ void SbiRuntime::StepWRITE() // write TOS s += p->GetString(); if( ch ) s += ch; - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1350,7 +1350,7 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos void SbiRuntime::StepPROMPT() { SbxVariableRef p = PopVar(); - ByteString aStr( p->GetString(), osl_getThreadTextEncoding() ); + rtl::OString aStr(rtl::OUStringToOString(p->GetString(), osl_getThreadTextEncoding())); pIosys->SetPrompt( aStr ); } diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index b18347dc3937..b3dcb6f1b27a 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -899,7 +899,7 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 ) SbxVariableRef pLen = PopVar(); short nBlkLen = pLen->GetInteger(); short nChan = pChan->GetInteger(); - ByteString aName( pName->GetString(), osl_getThreadTextEncoding() ); + rtl::OString aName(rtl::OUStringToOString(pName->GetString(), osl_getThreadTextEncoding())); pIosys->Open( nChan, aName, static_cast( nOp1 ), static_cast( nOp2 ), nBlkLen ); Error( pIosys->GetError() ); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 7ad9727e52d3..10d24262569d 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -214,12 +214,12 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) static sal_uInt16 nLvl = 0; static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" }; - ByteString aNameStr1( (const UniString&)rName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Search %.*s %s %s in %s", nLvl++, " ", ( t >= SbxCLASS_DONTCARE && t <= SbxCLASS_OBJECT ) - ? pCls[ t-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ t-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif if( !GetAll( t ) ) @@ -276,10 +276,10 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) nLvl--; if( pRes ) { - ByteString aNameStr3( (const UniString&)rName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr4( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr3(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr4(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Found %.*s %s in %s", - nLvl, " ", aNameStr3.GetBuffer(), aNameStr4.GetBuffer() ); + nLvl, " ", aNameStr3.getStr(), aNameStr4.getStr() ); } #endif return pRes; @@ -489,12 +489,12 @@ void SbxObject::Insert( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Insert %s %s in %s", ( pVar->GetClass() >= SbxCLASS_DONTCARE && pVar->GetClass() <= SbxCLASS_OBJECT ) - ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif } } @@ -529,12 +529,12 @@ void SbxObject::QuickInsert( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Insert %s %s in %s", ( pVar->GetClass() >= SbxCLASS_DONTCARE && pVar->GetClass() <= SbxCLASS_OBJECT ) - ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif } } @@ -554,8 +554,8 @@ void SbxObject::Remove( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); #endif SbxVariableRef pVar_ = pArray->Get( nIdx ); if( pVar_->IsBroadcaster() ) @@ -766,38 +766,38 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) GetAll( SbxCLASS_DONTCARE ); // Output the data of the object itself - ByteString aNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); - ByteString aClassNameStr( (const UniString&)aClassName, RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US)); + rtl::OString aClassNameStr(rtl::OUStringToOString(aClassName, RTL_TEXTENCODING_ASCII_US)); rStrm << "Object( " << rtl::OString::valueOf(reinterpret_cast(this)).getStr()<< "=='" - << ( aNameStr.Len() ? aNameStr.GetBuffer() : "" ) << "', " - << "of class '" << aClassNameStr.GetBuffer() << "', " + << ( aNameStr.getLength() ? aNameStr.getStr() : "" ) << "', " + << "of class '" << aClassNameStr.getStr() << "', " << "counts " << rtl::OString::valueOf(static_cast(GetRefCount())).getStr() << " refs, "; if ( GetParent() ) { - ByteString aParentNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aParentNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US)); rStrm << "in parent " << rtl::OString::valueOf(reinterpret_cast(GetParent())).getStr() - << "=='" << ( aParentNameStr.Len() ? aParentNameStr.GetBuffer() : "" ) << "'"; + << "=='" << ( aParentNameStr.getLength() ? aParentNameStr.getStr() : "" ) << "'"; } else rStrm << "no parent "; rStrm << " )" << endl; - ByteString aIndentNameStr( (const UniString&)aIndent, RTL_TEXTENCODING_ASCII_US ); - rStrm << aIndentNameStr.GetBuffer() << "{" << endl; + rtl::OString aIndentNameStr(rtl::OUStringToOString(aIndent, RTL_TEXTENCODING_ASCII_US)); + rStrm << aIndentNameStr.getStr() << "{" << endl; // Flags XubString aAttrs; if( CollectAttrs( this, aAttrs ) ) { - ByteString aAttrStr( (const UniString&)aAttrs, RTL_TEXTENCODING_ASCII_US ); - rStrm << aIndentNameStr.GetBuffer() << "- Flags: " << aAttrStr.GetBuffer() << endl; + rtl::OString aAttrStr(rtl::OUStringToOString(aAttrs, RTL_TEXTENCODING_ASCII_US)); + rStrm << aIndentNameStr.getStr() << "- Flags: " << aAttrStr.getStr() << endl; } // Methods - rStrm << aIndentNameStr.GetBuffer() << "- Methods:" << endl; + rStrm << aIndentNameStr.getStr() << "- Methods:" << endl; for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) { SbxVariableRef& r = pMethods->GetRef( i ); @@ -829,7 +829,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } // Properties - rStrm << aIndentNameStr.GetBuffer() << "- Properties:" << endl; + rStrm << aIndentNameStr.getStr() << "- Properties:" << endl; { for( sal_uInt16 i = 0; i < pProps->Count(); i++ ) { @@ -863,7 +863,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } // Objects - rStrm << aIndentNameStr.GetBuffer() << "- Objects:" << endl; + rStrm << aIndentNameStr.getStr() << "- Objects:" << endl; { for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) { @@ -871,7 +871,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) SbxVariable* pVar = r; if ( pVar ) { - rStrm << aIndentNameStr.GetBuffer() << " - Sub"; + rStrm << aIndentNameStr.getStr() << " - Sub"; if ( pVar->ISA(SbxObject) ) ((SbxObject*) pVar)->Dump( rStrm, bFill ); else if ( pVar->ISA(SbxVariable) ) @@ -880,7 +880,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } } - rStrm << aIndentNameStr.GetBuffer() << "}" << endl << endl; + rStrm << aIndentNameStr.getStr() << "}" << endl << endl; --nLevel; } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index d2332a5c275b..b73532bd5bb9 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -136,8 +136,8 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar ); SbxVariable::~SbxVariable() { #ifdef DBG_UTIL - ByteString aBStr( (const UniString&)maName, RTL_TEXTENCODING_ASCII_US ); - DbgOutf( "SbxVariable::Dtor %lx (%s)", (void*)this, aBStr.GetBuffer() ); + rtl::OString aBStr(rtl::OUStringToOString(maName, RTL_TEXTENCODING_ASCII_US)); + DbgOutf( "SbxVariable::Dtor %lx (%s)", (void*)this, aBStr.getStr() ); static sal_Char const aCellsStr[] = "Cells"; if ( maName.EqualsAscii( aCellsStr ) ) maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); @@ -390,8 +390,8 @@ void SbxVariable::SetParent( SbxObject* p ) aMsg.AppendAscii( "].SetParent([" ); aMsg += p->GetName(); aMsg.AppendAscii( "])" ); - ByteString aBStr( (const UniString&)aMsg, RTL_TEXTENCODING_ASCII_US ); - DbgOut( aBStr.GetBuffer(), DBG_OUT_WARNING, __FILE__, __LINE__); + rtl::OString aBStr(rtl::OUStringToOString(aMsg, RTL_TEXTENCODING_ASCII_US)); + DbgOut( aBStr.getStr(), DBG_OUT_WARNING, __FILE__, __LINE__); } } #endif @@ -637,13 +637,13 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill ) { - ByteString aBNameStr( (const UniString&)GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aBNameStr(rtl::OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US)); rStrm << "Variable( " << rtl::OString::valueOf(reinterpret_cast(this)).getStr() << "==" - << aBNameStr.GetBuffer(); - ByteString aBParentNameStr( (const UniString&)GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US ); + << aBNameStr.getStr(); + rtl::OString aBParentNameStr(rtl::OUStringToOString(GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US)); if ( GetParent() ) - rStrm << " in parent '" << aBParentNameStr.GetBuffer() << "'"; + rStrm << " in parent '" << aBParentNameStr.getStr() << "'"; else rStrm << " no parent"; rStrm << " ) "; -- cgit