summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-15 10:33:10 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-15 10:33:26 +0200
commit458c5a0f475890edcd15a0b2309500203913e7b2 (patch)
tree6692528995a8bffb5518bfbe33095611457c9f1a /basic
parente4fbcc549a143992f72333404adb0180afa69e1a (diff)
Defer OUString -> OString conversion
...to avoid converting back OString -> OUString in SbiIoSystem::WriteCon. Change-Id: I17024891d0babaa589f2c65f1123f1905c4338bb
Diffstat (limited to 'basic')
-rw-r--r--basic/source/inc/iosys.hxx6
-rw-r--r--basic/source/runtime/iosys.cxx18
-rw-r--r--basic/source/runtime/runtime.cxx11
3 files changed, 15 insertions, 20 deletions
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
index d6d6c6aab6bf..9304dba32c75 100644
--- a/basic/source/inc/iosys.hxx
+++ b/basic/source/inc/iosys.hxx
@@ -75,11 +75,11 @@ class SbiIoSystem
SbiStream* pChan[ CHANNELS ];
OString aPrompt;
OString aIn;
- OString aOut;
+ OUString aOut;
short nChan;
SbError nError;
void ReadCon(OString&);
- void WriteCon(const OString&);
+ void WriteCon(const OUString&);
public:
SbiIoSystem();
~SbiIoSystem();
@@ -93,7 +93,7 @@ public:
void Close();
void Read(OString&, short = 0);
char Read();
- void Write(const OString&, short = 0);
+ void Write(const OUString&, short = 0);
// 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1)
SbiStream* GetStream( short nChannel ) const;
void CloseAll(); // JSM
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index c4a6d649c011..511eb1176986 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -842,15 +842,14 @@ void SbiIoSystem::Shutdown()
// anything left to PRINT?
if( !aOut.isEmpty() )
{
- OUString aOutStr(OStringToOUString(aOut, osl_getThreadTextEncoding()));
#if defined __GNUC__
Window* pParent = Application::GetDefDialogParent();
- MessBox( pParent, WinBits( WB_OK ), OUString(), aOutStr ).Execute();
+ MessBox( pParent, WinBits( WB_OK ), OUString(), aOut ).Execute();
#else
- MessBox( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOutStr ).Execute();
+ MessBox( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut ).Execute();
#endif
}
- aOut = OString();
+ aOut = OUString();
}
@@ -894,7 +893,7 @@ char SbiIoSystem::Read()
return ch;
}
-void SbiIoSystem::Write(const OString& rBuf, short n)
+void SbiIoSystem::Write(const OUString& rBuf, short n)
{
if( !nChan )
{
@@ -906,7 +905,7 @@ void SbiIoSystem::Write(const OString& rBuf, short n)
}
else
{
- nError = pChan[ nChan ]->Write( rBuf, n );
+ nError = pChan[ nChan ]->Write( OUStringToOString(rBuf, osl_getThreadTextEncoding()), n );
}
}
@@ -963,7 +962,7 @@ void SbiIoSystem::ReadCon(OString& rIn)
// output of a MessageBox, if theres a CR in the console-buffer
-void SbiIoSystem::WriteCon(const OString& rText)
+void SbiIoSystem::WriteCon(const OUString& rText)
{
aOut += rText;
sal_Int32 n1 = aOut.indexOf('\n');
@@ -982,18 +981,17 @@ void SbiIoSystem::WriteCon(const OString& rText)
{
n1 = n2;
}
- OString s(aOut.copy(0, n1));
+ OUString s(aOut.copy(0, n1));
aOut = aOut.copy(n1);
while (aOut[0] == '\n' || aOut[0] == '\r')
{
aOut = aOut.copy(1);
}
- OUString aStr(OStringToOUString(s, osl_getThreadTextEncoding()));
{
SolarMutexGuard aSolarGuard;
if( !MessBox( GetpApp()->GetDefDialogParent(),
WinBits( WB_OK_CANCEL | WB_DEF_OK ),
- OUString(), aStr ).Execute() )
+ OUString(), s ).Execute() )
{
nError = SbERR_USER_ABORT;
}
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 047c25cf5f5e..a2c55a811aaf 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2706,8 +2706,7 @@ void SbiRuntime::StepPRINT() // print TOS
s = " "; // one blank before
}
s += s1;
- OString aByteStr(OUStringToOString(s, osl_getThreadTextEncoding()));
- pIosys->Write( aByteStr );
+ pIosys->Write( s );
Error( pIosys->GetError() );
}
@@ -2722,8 +2721,7 @@ void SbiRuntime::StepPRINTF() // print TOS in field
}
s.append(s1);
comphelper::string::padToLength(s, 14, ' ');
- OString aByteStr(OUStringToOString(s.makeStringAndClear(), osl_getThreadTextEncoding()));
- pIosys->Write( aByteStr );
+ pIosys->Write( s.makeStringAndClear() );
Error( pIosys->GetError() );
}
@@ -2750,8 +2748,7 @@ void SbiRuntime::StepWRITE() // write TOS
{
s += OUString(ch);
}
- OString aByteStr(OUStringToOString(s, osl_getThreadTextEncoding()));
- pIosys->Write( aByteStr );
+ pIosys->Write( s );
Error( pIosys->GetError() );
}
@@ -3206,7 +3203,7 @@ void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
{
- OString s(static_cast<sal_Char>(nOp1));
+ OUString s(static_cast<sal_Unicode>(nOp1));
pIosys->Write( s );
Error( pIosys->GetError() );
}