summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-10 11:54:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-10 18:50:52 +0200
commit241bee7e4be6a205fae0d3f5508e084462c7ca55 (patch)
tree7d8771a5cbbe7021106852f1a54496faeea6ad4e /basic
parent36567d58115e21c111b45c011524ddbae540fd91 (diff)
convert WriteCharPtr..getStr to WriteOString
and improve the WriteOString method, we can avoid the strlen here, we already have the length One change in behaviour to be noted - if the string contains trailing zero bytes, which ARE INCLUDED IN THE STRING LENGTH, i.e. I'm not talking about the normal terminating zero, then this patch changes behaviour because we will now write those zeros to the stream. Change-Id: I4668b9b9eb877f820b1dc70d6cd10ba2623bc0a2 Reviewed-on: https://gerrit.libreoffice.org/80597 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods1.cxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx22
-rw-r--r--basic/source/sbx/sbxvar.cxx6
3 files changed, 15 insertions, 15 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 01ba74852f3d..2af16a5a712e 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -967,7 +967,7 @@ static 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...
OString aByteStr(OUStringToOString(rStr, osl_getThreadTextEncoding()));
- pStrm->WriteCharPtr( aByteStr.getStr() );
+ pStrm->WriteOString( aByteStr );
}
}
break;
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index c3810feb0ebc..f9ad3b24f816 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -696,17 +696,17 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
OString aNameStr(OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
OString aClassNameStr(OUStringToOString(aClassName, RTL_TEXTENCODING_ASCII_US));
rStrm.WriteCharPtr( "Object( " )
- .WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(this)).getStr() ).WriteCharPtr( "=='" )
+ .WriteOString( OString::number(reinterpret_cast<sal_Int64>(this)) ).WriteCharPtr( "=='" )
.WriteCharPtr( aNameStr.isEmpty() ? "<unnamed>" : aNameStr.getStr() ).WriteCharPtr( "', " )
- .WriteCharPtr( "of class '" ).WriteCharPtr( aClassNameStr.getStr() ).WriteCharPtr( "', " )
+ .WriteCharPtr( "of class '" ).WriteOString( aClassNameStr ).WriteCharPtr( "', " )
.WriteCharPtr( "counts " )
- .WriteCharPtr( OString::number(GetRefCount()).getStr() )
+ .WriteOString( OString::number(GetRefCount()) )
.WriteCharPtr( " refs, " );
if ( GetParent() )
{
OString aParentNameStr(OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
rStrm.WriteCharPtr( "in parent " )
- .WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(GetParent())).getStr() )
+ .WriteOString( OString::number(reinterpret_cast<sal_Int64>(GetParent())) )
.WriteCharPtr( "=='" ).WriteCharPtr( aParentNameStr.isEmpty() ? "<unnamed>" : aParentNameStr.getStr() ).WriteCharPtr( "'" );
}
else
@@ -715,18 +715,18 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
}
rStrm.WriteCharPtr( " )" ) << endl;
OString aIndentNameStr(OUStringToOString(aIndent, RTL_TEXTENCODING_ASCII_US));
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "{" ) << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "{" ) << endl;
// Flags
OUString aAttrs;
if( CollectAttrs( this, aAttrs ) )
{
OString aAttrStr(OUStringToOString(aAttrs, RTL_TEXTENCODING_ASCII_US));
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "- Flags: " ).WriteCharPtr( aAttrStr.getStr() ) << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Flags: " ).WriteOString( aAttrStr ) << endl;
}
// Methods
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "- Methods:" ) << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Methods:" ) << endl;
for( sal_uInt16 i = 0; i < pMethods->Count(); i++ )
{
SbxVariableRef& r = pMethods->GetRef( i );
@@ -762,7 +762,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
}
// Properties
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "- Properties:" ) << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Properties:" ) << endl;
{
for( sal_uInt16 i = 0; i < pProps->Count(); i++ )
{
@@ -800,7 +800,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
}
// Objects
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "- Objects:" ) << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Objects:" ) << endl;
{
for( sal_uInt16 i = 0; i < pObjs->Count(); i++ )
{
@@ -808,7 +808,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
SbxVariable* pVar = r.get();
if ( pVar )
{
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( " - Sub" );
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( " - Sub" );
if (SbxObject *pSbxObj = dynamic_cast<SbxObject*>(pVar))
{
pSbxObj->Dump(rStrm, bFill);
@@ -821,7 +821,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
}
}
- rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( "}" ) << endl << endl;
+ rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "}" ) << endl << endl;
--nLevel;
}
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index bab30af36989..85aa19816af0 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -621,12 +621,12 @@ void SbxVariable::Dump( SvStream& rStrm, bool bFill )
{
OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), RTL_TEXTENCODING_ASCII_US));
rStrm.WriteCharPtr( "Variable( " )
- .WriteCharPtr( OString::number(reinterpret_cast<sal_Int64>(this)).getStr() ).WriteCharPtr( "==" )
- .WriteCharPtr( aBNameStr.getStr() );
+ .WriteOString( OString::number(reinterpret_cast<sal_Int64>(this)) ).WriteCharPtr( "==" )
+ .WriteOString( aBNameStr );
OString aBParentNameStr(OUStringToOString(GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US));
if ( GetParent() )
{
- rStrm.WriteCharPtr( " in parent '" ).WriteCharPtr( aBParentNameStr.getStr() ).WriteCharPtr( "'" );
+ rStrm.WriteCharPtr( " in parent '" ).WriteOString( aBParentNameStr ).WriteCharPtr( "'" );
}
else
{