[Libreoffice-commits] .: 4 commits - comphelper/inc comphelper/qa comphelper/source l10ntools/inc l10ntools/source svl/source tools/inc tools/source unotools/inc unotools/source unusedcode.easy vcl/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Nov 17 15:31:02 PST 2011
comphelper/inc/comphelper/string.hxx | 20 ++++
comphelper/qa/string/test_string.cxx | 16 +++
comphelper/source/misc/string.cxx | 31 ++++++
l10ntools/inc/export.hxx | 4
l10ntools/source/export2.cxx | 54 ++++++-----
l10ntools/source/lngmerge.cxx | 15 ++-
svl/source/misc/lngmisc.cxx | 11 --
tools/inc/tools/inetmsg.hxx | 12 --
tools/source/inet/inetmsg.cxx | 117 +++++++++++-------------
tools/source/ref/errinf.cxx | 72 +++++++-------
unotools/inc/unotools/confignode.hxx | 14 --
unotools/inc/unotools/configvaluecontainer.hxx | 24 ----
unotools/source/config/confignode.cxx | 22 ----
unotools/source/config/configvaluecontainer.cxx | 8 -
unusedcode.easy | 3
vcl/source/gdi/animate.cxx | 5 -
vcl/source/gdi/cvtsvm.cxx | 8 -
vcl/source/gdi/metaact.cxx | 7 -
vcl/source/gdi/print.cxx | 1
19 files changed, 217 insertions(+), 227 deletions(-)
New commits:
commit 9d2807cc9df0a71fd367aaf44c8467cc4c72caca
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 16 23:15:14 2011 +0000
ditch ENABLE_BYTESTRING_STREAM_OPERATORS
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 9dcbce0..b4de8f9 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define ENABLE_BYTESTRING_STREAM_OPERATORS
#include <vcl/animate.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
@@ -836,7 +835,7 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation )
rOStm << nDummy32; // unbenutzt
rOStm << nDummy32; // unbenutzt
rOStm << nDummy32; // unbenutzt
- rOStm << aDummyStr; // unbenutzt
+ rOStm.WriteByteString(aDummyStr); // unbenutzt
rOStm << nRest; // Anzahl der Strukturen, die noch _folgen_
}
}
@@ -901,7 +900,7 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation )
rIStm >> nTmp32; // unbenutzt
rIStm >> nTmp32; // unbenutzt
rIStm >> nTmp32; // unbenutzt
- rIStm >> aDummyStr; // unbenutzt
+ rIStm.ReadByteString(aDummyStr); // unbenutzt
rIStm >> nTmp16; // Rest zu lesen
rAnimation.Insert( aAnimBmp );
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index e3d027e..2fe6a96 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -29,8 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define ENABLE_BYTESTRING_STREAM_OPERATORS
-
#include <algorithm>
#include <string.h>
#include <tools/stack.hxx>
@@ -1326,7 +1324,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_uInt8* pData;
sal_Int32 nFollowingActionCount;
- rIStm >> aComment >> nValue >> nDataSize;
+ rIStm.ReadByteString(aComment);
+ rIStm >> nValue >> nDataSize;
if( nDataSize )
{
@@ -2397,7 +2396,8 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
rOStm.SeekRel( 4 );
// write data
- rOStm << pA->GetComment() << pA->GetValue() << nDataSize;
+ rOStm.WriteByteString(pA->GetComment());
+ rOStm << pA->GetValue() << nDataSize;
if( nDataSize )
rOStm.Write( pA->GetData(), nDataSize );
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 03c5390..5f86ff2 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -29,8 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define ENABLE_BYTESTRING_STREAM_OPERATORS
-
#include <algorithm>
#include <string.h>
#include <tools/stream.hxx>
@@ -4202,7 +4200,8 @@ sal_Bool MetaCommentAction::Compare( const MetaAction& rMetaAction ) const
void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
WRITE_BASE_COMPAT( rOStm, 1, pData );
- rOStm << maComment << mnValue << mnDataSize;
+ rOStm.WriteByteString(maComment);
+ rOStm << mnValue << mnDataSize;
if ( mnDataSize )
rOStm.Write( mpData, mnDataSize );
@@ -4214,7 +4213,7 @@ void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
COMPAT( rIStm );
ByteString sTmp;
- rIStm >> sTmp;
+ rIStm.ReadByteString(sTmp);
maComment = sTmp;
rIStm >> mnValue >> mnDataSize;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 7812032..3dfe041 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -29,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#define ENABLE_BYTESTRING_STREAM_OPERATORS
#include <list>
#include <tools/debug.hxx>
commit cee0d7a26a5098f6c39ac3ce634632a432402379
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 16 22:36:26 2011 +0000
callcatcher: some unused methods
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index baa812d..f1567a6 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -248,12 +248,6 @@ namespace utl
::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >
m_xCommitter;
protected:
- /** ctor<p/>
- */
- OConfigurationTreeRoot(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode
- );
-
/** ctor for a readonly node
*/
OConfigurationTreeRoot(
@@ -280,14 +274,6 @@ namespace utl
*/
OConfigurationTreeRoot(
const ::comphelper::ComponentContext& i_rContext,
- const sal_Char* i_pAsciiNodePath,
- const bool i_bUpdatable
- );
-
- /** creates a configuration tree for the given path in the given mode
- */
- OConfigurationTreeRoot(
- const ::comphelper::ComponentContext& i_rContext,
const ::rtl::OUString& i_rNodePath,
const bool i_bUpdatable
);
diff --git a/unotools/inc/unotools/configvaluecontainer.hxx b/unotools/inc/unotools/configvaluecontainer.hxx
index 99d9ff0..589de07 100644
--- a/unotools/inc/unotools/configvaluecontainer.hxx
+++ b/unotools/inc/unotools/configvaluecontainer.hxx
@@ -104,30 +104,6 @@ namespace utl
const sal_Int32 _nLevels = -1
);
- /** constructs the object
-
- @param _rxORB
- specifies the service factory which should be used to access the configuration
- @param _rAccessSafety
- As this class is intented to manipulate objects it does not hold itself (see the various
- registerXXX methods), it needs to guard these access for muti threading safety.<br/>
- The mutex given here is locked whenever such an access occurs.
- @param _rConfigLocation
- describes the configurations node path
- @param _nAccessFlags
- specifies different aspects of the configuration aspect to be created, e.g. it's update mode etc.<br/>
- See the CVC_xxx constants for what you can use here.
- @param _nLevels
- specifies the number of levels to access under the node given by <arg>_pConfigLocation</arg>
- */
- OConfigurationValueContainer(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- ::osl::Mutex& _rAccessSafety,
- const ::rtl::OUString& _rConfigLocation,
- const sal_uInt16 _nAccessFlags = CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE,
- const sal_Int32 _nLevels = -1
- );
-
/// dtor
~OConfigurationValueContainer();
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 264eda0..b4c574b 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -547,15 +547,6 @@ namespace utl
return NULL;
}
}
- //========================================================================
- //= OConfigurationTreeRoot
- //========================================================================
- //------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode )
- :OConfigurationNode( _rxRootNode.get() )
- ,m_xCommitter(_rxRootNode)
- {
- }
//------------------------------------------------------------------------
OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode )
@@ -565,19 +556,6 @@ namespace utl
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable )
- :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
- ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() )
- ,m_xCommitter()
- {
- if ( i_bUpdatable )
- {
- m_xCommitter.set( getUNONode(), UNO_QUERY );
- OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
- }
- }
-
- //------------------------------------------------------------------------
OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
:OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
i_rNodePath, i_bUpdatable, -1, false ).get() )
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index 999d3a6..ad1f196 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -258,14 +258,6 @@ namespace utl
implConstruct( ::rtl::OUString::createFromAscii( _pConfigLocation ), _nAccessFlags, _nLevels );
}
- OConfigurationValueContainer::OConfigurationValueContainer(
- const Reference< XMultiServiceFactory >& _rxORB, ::osl::Mutex& _rAccessSafety,
- const ::rtl::OUString& _rConfigLocation, const sal_uInt16 _nAccessFlags, const sal_Int32 _nLevels )
- :m_pImpl( new OConfigurationValueContainerImpl( _rxORB, _rAccessSafety ) )
- {
- implConstruct( _rConfigLocation, _nAccessFlags, _nLevels );
- }
-
OConfigurationValueContainer::~OConfigurationValueContainer()
{
delete m_pImpl;
diff --git a/unusedcode.easy b/unusedcode.easy
index c148242..176e334 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -2343,9 +2343,6 @@ utl::MultiAtomProvider::insertAtomClass(int)
utl::MultiAtomProvider::overrideAtom(int, int, rtl::OUString const&)
utl::NodeValueAccessor::bind(com::sun::star::uno::Any*)
utl::OConfigurationNode::appendNode(rtl::OUString const&, utl::OConfigurationNode const&) const
-utl::OConfigurationTreeRoot::OConfigurationTreeRoot(com::sun::star::uno::Reference<com::sun::star::util::XChangesBatch> const&)
-utl::OConfigurationTreeRoot::OConfigurationTreeRoot(comphelper::ComponentContext const&, char const*, bool)
-utl::OConfigurationValueContainer::OConfigurationValueContainer(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&, osl::Mutex&, rtl::OUString const&, unsigned short, int)
utl::OConfigurationValueContainer::getServiceFactory() const
utl::TransliterationWrapper::compareSubstring(String const&, int, int, String const&, int, int) const
vcl::Clipboard_getSupportedServiceNames()
commit dca04e236193db7de908aad746fd4539e78eb428
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 16 22:19:58 2011 +0000
add a StringUtils-alike remove (can replace EraseAllChars)
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 620db1b..31414e5 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -200,6 +200,26 @@ COMPHELPER_DLLPUBLIC rtl::OString replace(const rtl::OString &rIn,
COMPHELPER_DLLPUBLIC rtl::OUString replace(const rtl::OUString &rIn,
const rtl::OUString &rSearch, const rtl::OUString &rReplace);
+/** Removes all occurrences of a character from within the source string
+
+ @param rIn The input OString
+ @param c The character to be removed
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC rtl::OString remove(const rtl::OString &rIn,
+ sal_Char c);
+
+/** Removes all occurrences of a character from within the source string
+
+ @param rIn The input OUString
+ @param c The character to be removed
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC rtl::OUString remove(const rtl::OUString &rIn,
+ sal_Unicode c);
+
/** Returns a token in the OString
@param token the number of the token to return
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index a290cb7..1106381 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -48,6 +48,7 @@ public:
void testSearchAndReplaceAsciiL();
void testNatural();
void testReplace();
+ void testRemove();
void testToken();
void testDecimalStringToNumber();
void testIsdigitAsciiString();
@@ -59,6 +60,7 @@ public:
CPPUNIT_TEST(testSearchAndReplaceAsciiL);
CPPUNIT_TEST(testNatural);
CPPUNIT_TEST(testReplace);
+ CPPUNIT_TEST(testRemove);
CPPUNIT_TEST(testToken);
CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString);
@@ -395,6 +397,20 @@ void TestString::testReplace()
RTL_CONSTASCII_STRINGPARAM("aaafooaaafoobbb")));
}
+void TestString::testRemove()
+{
+ ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc"));
+ ::rtl::OString aOut;
+
+ aOut = ::comphelper::string::remove(aIn, 'b');
+ CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ac")));
+
+ aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa"));
+
+ aOut = ::comphelper::string::remove(aIn, 'a');
+ CPPUNIT_ASSERT(aOut.isEmpty());
+}
+
void TestString::testToken()
{
::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12"));
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 6f59564..8525e79 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -138,6 +138,37 @@ rtl::OUString replace(const rtl::OUString &rIn, const rtl::OUString &rSearch,
rReplace);
}
+namespace
+{
+ template <typename T, typename C, typename O> T tmpl_remove(const T &rIn,
+ const C cRemove)
+ {
+ if (rIn.isEmpty())
+ return rIn;
+
+ O aRet;
+
+ for (sal_Int32 i = 0; i < rIn.getLength(); ++i)
+ {
+ C cChar = rIn[i];
+ if (cChar != cRemove)
+ aRet.append(cChar);
+ }
+
+ return aRet.makeStringAndClear();
+ }
+}
+
+rtl::OString remove(const rtl::OString &rIn, sal_Char c)
+{
+ return tmpl_remove<rtl::OString, sal_Char, rtl::OStringBuffer>(rIn, c);
+}
+
+rtl::OUString remove(const rtl::OUString &rIn, sal_Unicode c)
+{
+ return tmpl_remove<rtl::OUString, sal_Unicode, rtl::OUStringBuffer>(rIn, c);
+}
+
sal_uInt32 decimalStringToNumber(
::rtl::OUString const & str )
{
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 0058cf1..94d5925 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -329,8 +329,8 @@ public:
static std::vector<ByteString> GetForcedLanguages();
static void SetLanguages( std::vector<ByteString> val );
- static void RemoveUTF8ByteOrderMarker( ByteString &rString );
- static bool hasUTF8ByteOrderMarker( const ByteString &rString );
+ static void RemoveUTF8ByteOrderMarker( rtl::OString &rString );
+ static bool hasUTF8ByteOrderMarker( const rtl::OString &rString );
static void RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename );
static bool fileHasUTF8ByteOrderMarker( const ByteString &rString );
static void QuotHTML( ByteString &rString );
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 26f99b5..72ffde0 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -192,35 +192,43 @@ void Export::QuotHTML( ByteString &rString )
rString = sReturn.makeStringAndClear();
}
-void Export::RemoveUTF8ByteOrderMarker( ByteString &rString ){
+void Export::RemoveUTF8ByteOrderMarker( rtl::OString &rString )
+{
if( hasUTF8ByteOrderMarker( rString ) )
- rString.Erase( 0 , 3 );
+ rString = rString.copy(3);
}
-bool Export::hasUTF8ByteOrderMarker( const ByteString &rString ){
- return rString.Len() >= 3 &&
- rString.GetChar( 0 ) == '\xEF' &&
- rString.GetChar( 1 ) == '\xBB' &&
- rString.GetChar( 2 ) == '\xBF' ;
+bool Export::hasUTF8ByteOrderMarker( const rtl::OString &rString )
+{
+ return rString.getLength() >= 3 && rString[0] == '\xEF' &&
+ rString[1] == '\xBB' && rString[2] == '\xBF' ;
}
-bool Export::fileHasUTF8ByteOrderMarker( const ByteString &rString ){
+
+bool Export::fileHasUTF8ByteOrderMarker( const ByteString &rString )
+{
SvFileStream aFileIn( String( rString , RTL_TEXTENCODING_ASCII_US ) , STREAM_READ );
- ByteString sLine;
- if( !aFileIn.IsEof() ) {
+ rtl::OString sLine;
+ if( !aFileIn.IsEof() )
+ {
aFileIn.ReadLine( sLine );
- if( aFileIn.IsOpen() ) aFileIn.Close();
+ if( aFileIn.IsOpen() )
+ aFileIn.Close();
return hasUTF8ByteOrderMarker( sLine );
}
if( aFileIn.IsOpen() ) aFileIn.Close();
return false;
}
-void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
+
+void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename )
+{
SvFileStream aFileIn( String( rFilename , RTL_TEXTENCODING_ASCII_US ) , STREAM_READ );
- ByteString sLine;
- if( !aFileIn.IsEof() ) {
+ rtl::OString sLine;
+ if( !aFileIn.IsEof() )
+ {
aFileIn.ReadLine( sLine );
// Test header
- if( hasUTF8ByteOrderMarker( sLine ) ){
+ if( hasUTF8ByteOrderMarker( sLine ) )
+ {
DirEntry aTempFile = Export::GetTempFile();
ByteString sTempFile = ByteString( aTempFile.GetFull() , RTL_TEXTENCODING_ASCII_US );
SvFileStream aNewFile( String( sTempFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_WRITE );
@@ -228,7 +236,8 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
RemoveUTF8ByteOrderMarker( sLine );
aNewFile.WriteLine( sLine );
// Copy the rest
- while( !aFileIn.IsEof() ){
+ while( !aFileIn.IsEof() )
+ {
aFileIn.ReadLine( sLine );
aNewFile.WriteLine( sLine );
}
@@ -239,7 +248,8 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
DirEntry( sTempFile ).MoveTo( DirEntry( rFilename.GetBuffer() ) );
}
}
- if( aFileIn.IsOpen() ) aFileIn.Close();
+ if( aFileIn.IsOpen() )
+ aFileIn.Close();
}
bool Export::CopyFile( const ByteString& source , const ByteString& dest )
@@ -398,12 +408,14 @@ sal_Bool Export::ConvertLineEnds(
return sal_False;
}
- ByteString sLine;
+ rtl::OString sLine;
- while ( !aSource.IsEof()) {
+ while ( !aSource.IsEof())
+ {
aSource.ReadLine( sLine );
- if ( !aSource.IsEof()) {
- sLine.EraseAllChars( '\r' );
+ if ( !aSource.IsEof())
+ {
+ sLine = comphelper::string::remove(sLine, '\r');
aDestination.WriteLine( sLine );
}
else
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index f166595..7592d49 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -52,15 +52,20 @@ LngParser::LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFF
{
pLines = new LngLineList();
DirEntry aEntry( String( sSource, RTL_TEXTENCODING_ASCII_US ));
- if ( aEntry.Exists()) {
+ if ( aEntry.Exists())
+ {
SvFileStream aStream( String( sSource, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
- if ( aStream.IsOpen()) {
- ByteString sLine;
+ if ( aStream.IsOpen())
+ {
+ rtl::OString sLine;
bool bFirstLine = true;
- while ( !aStream.IsEof()) {
+ while ( !aStream.IsEof())
+ {
aStream.ReadLine( sLine );
- if( bFirstLine ){ // Always remove UTF8 BOM from the first line
+ if( bFirstLine )
+ {
+ // Always remove UTF8 BOM from the first line
Export::RemoveUTF8ByteOrderMarker( sLine );
bFirstLine = false;
}
diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx
index 2eba00e..768dc4c 100644
--- a/svl/source/misc/lngmisc.cxx
+++ b/svl/source/misc/lngmisc.cxx
@@ -28,6 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svl.hxx"
+#include <comphelper/string.hxx>
#include <svl/lngmisc.hxx>
#include <tools/solar.h>
#include <tools/string.hxx>
@@ -55,22 +56,18 @@ sal_Int32 GetNumControlChars( const OUString &rTxt )
return nCnt;
}
-
sal_Bool RemoveHyphens( OUString &rTxt )
{
sal_Bool bModified = sal_False;
- if (HasHyphens( rTxt ))
+ if (HasHyphens(rTxt))
{
- String aTmp( rTxt );
- aTmp.EraseAllChars( SVT_SOFT_HYPHEN );
- aTmp.EraseAllChars( SVT_HARD_HYPHEN );
- rTxt = aTmp;
+ rTxt = comphelper::string::remove(rTxt, SVT_SOFT_HYPHEN);
+ rTxt = comphelper::string::remove(rTxt, SVT_HARD_HYPHEN);
bModified = sal_True;
}
return bModified;
}
-
sal_Bool RemoveControlChars( OUString &rTxt )
{
sal_Bool bModified = sal_False;
commit c4927a1b76b728b2208c29d09dbf54e70bb26e13
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 16 21:20:20 2011 +0000
ByteString->rtl::OString[Buffer]
diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx
index b06541a..610b804 100644
--- a/tools/inc/tools/inetmsg.hxx
+++ b/tools/inc/tools/inetmsg.hxx
@@ -80,26 +80,16 @@ public:
friend SvStream& operator<< (
SvStream& rStrm, const INetMessageHeader& rHdr)
{
-#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
- rStrm << rHdr.m_aName;
- rStrm << rHdr.m_aValue;
-#else
rStrm.WriteByteString (rHdr.m_aName);
rStrm.WriteByteString (rHdr.m_aValue);
-#endif
return rStrm;
}
friend SvStream& operator>> (
SvStream& rStrm, INetMessageHeader& rHdr)
{
-#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
- rStrm >> rHdr.m_aName;
- rStrm >> rHdr.m_aValue;
-#else
rStrm.ReadByteString (rHdr.m_aName);
rStrm.ReadByteString (rHdr.m_aValue);
-#endif
return rStrm;
}
};
@@ -160,7 +150,7 @@ protected:
void SetHeaderField_Impl (
INetMIME::HeaderFieldType eType,
- const ByteString &rName,
+ const rtl::OString &rName,
const UniString &rValue,
sal_uIntPtr &rnIndex);
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index 11bd5db..6cbbb20 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -110,7 +110,7 @@ void INetMessage::ListCopy (const INetMessage &rMsg)
*/
void INetMessage::SetHeaderField_Impl (
INetMIME::HeaderFieldType eType,
- const ByteString &rName,
+ const rtl::OString &rName,
const UniString &rValue,
sal_uIntPtr &rnIndex)
{
@@ -194,33 +194,33 @@ namespace
{
struct ImplINetRFC822MessageHeaderDataImpl
{
- const ByteString* operator()()
+ const rtl::OString* operator()()
{
- static const ByteString _ImplINetRFC822MessageHeaderData[] =
+ static const rtl::OString _ImplINetRFC822MessageHeaderData[] =
{
- ByteString ("BCC"),
- ByteString ("CC"),
- ByteString ("Comments"),
- ByteString ("Date"),
- ByteString ("From"),
- ByteString ("In-Reply-To"),
- ByteString ("Keywords"),
- ByteString ("Message-ID"),
- ByteString ("References"),
- ByteString ("Reply-To"),
- ByteString ("Return-Path"),
- ByteString ("Subject"),
- ByteString ("Sender"),
- ByteString ("To"),
- ByteString ("X-Mailer"),
- ByteString ("Return-Receipt-To")
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("BCC")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("CC")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Comments")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Date")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("From")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("In-Reply-To")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Keywords")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Message-ID")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("References")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Reply-To")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Return-Path")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Subject")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Sender")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("To")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("X-Mailer")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Return-Receipt-To"))
};
return &_ImplINetRFC822MessageHeaderData[0];
}
};
struct ImplINetRFC822MessageHeaderData
- : public rtl::StaticAggregate< const ByteString, ImplINetRFC822MessageHeaderDataImpl > {};
+ : public rtl::StaticAggregate< const rtl::OString, ImplINetRFC822MessageHeaderDataImpl > {};
}
#define HDR(n) ImplINetRFC822MessageHeaderData::get()[(n)]
@@ -305,28 +305,28 @@ static const sal_Char *months[12] =
/*
* ParseDateField and local helper functions.
*/
-static sal_uInt16 ParseNumber (const ByteString& rStr, sal_uInt16& nIndex)
+static sal_uInt16 ParseNumber(const rtl::OString& rStr, sal_uInt16& nIndex)
{
sal_uInt16 n = nIndex;
- while ((n < rStr.Len()) && ascii_isDigit(rStr.GetChar(n))) n++;
+ while ((n < rStr.getLength()) && ascii_isDigit(rStr[n])) n++;
- rtl::OString aNum (rStr.Copy (nIndex, (n - nIndex)));
+ rtl::OString aNum(rStr.copy(nIndex, (n - nIndex)));
nIndex = n;
return (sal_uInt16)(aNum.toInt32());
}
-static sal_uInt16 ParseMonth (const ByteString& rStr, sal_uInt16& nIndex)
+static sal_uInt16 ParseMonth(const rtl::OString& rStr, sal_uInt16& nIndex)
{
sal_uInt16 n = nIndex;
- while ((n < rStr.Len()) && ascii_isLetter(rStr.GetChar(n))) n++;
+ while ((n < rStr.getLength()) && ascii_isLetter(rStr[n])) n++;
- ByteString aMonth (rStr.Copy (nIndex, 3));
+ rtl::OString aMonth(rStr.copy(nIndex, 3));
nIndex = n;
sal_uInt16 i;
for (i = 0; i < 12; i++)
- if (aMonth.CompareIgnoreCaseToAscii (months[i]) == 0) break;
+ if (aMonth.equalsIgnoreAsciiCase(months[i])) break;
return (i + 1);
}
@@ -446,9 +446,9 @@ sal_Bool INetRFC822Message::ParseDateField (
sal_uIntPtr INetRFC822Message::SetHeaderField (
const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex)
{
- ByteString aName (rHeader.GetName());
- const sal_Char *pData = aName.GetBuffer();
- const sal_Char *pStop = pData + aName.Len() + 1;
+ rtl::OString aName (rHeader.GetName());
+ const sal_Char *pData = aName.getStr();
+ const sal_Char *pStop = pData + aName.getLength() + 1;
const sal_Char *check = "";
sal_uIntPtr nIdx = LIST_APPEND;
@@ -716,23 +716,23 @@ namespace
{
struct ImplINetMIMEMessageHeaderDataImpl
{
- const ByteString* operator()()
+ const rtl::OString* operator()()
{
- static const ByteString _ImplINetMIMEMessageHeaderData[] =
+ static const rtl::OString _ImplINetMIMEMessageHeaderData[] =
{
- ByteString ("MIME-Version"),
- ByteString ("Content-Description"),
- ByteString ("Content-Disposition"),
- ByteString ("Content-ID"),
- ByteString ("Content-Type"),
- ByteString ("Content-Transfer-Encoding")
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("MIME-Version")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Description")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Disposition")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-ID")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Type")),
+ rtl::OString(RTL_CONSTASCII_STRINGPARAM("Content-Transfer-Encoding"))
};
return &_ImplINetMIMEMessageHeaderData[0];
}
};
struct ImplINetMIMEMessageHeaderData
- : public rtl::StaticAggregate< const ByteString, ImplINetMIMEMessageHeaderDataImpl > {};
+ : public rtl::StaticAggregate< const rtl::OString, ImplINetMIMEMessageHeaderDataImpl > {};
}
#define MIMEHDR(n) ImplINetMIMEMessageHeaderData::get()[(n)]
@@ -853,9 +853,9 @@ INetMIMEMessage *INetMIMEMessage::CreateMessage (
sal_uIntPtr INetMIMEMessage::SetHeaderField (
const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex)
{
- ByteString aName (rHeader.GetName());
- const sal_Char *pData = aName.GetBuffer();
- const sal_Char *pStop = pData + aName.Len() + 1;
+ rtl::OString aName (rHeader.GetName());
+ const sal_Char *pData = aName.getStr();
+ const sal_Char *pStop = pData + aName.getLength() + 1;
const sal_Char *check = "";
sal_uIntPtr nIdx = LIST_APPEND;
@@ -1077,40 +1077,40 @@ sal_Bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType)
return sal_False;
// Setup Content-Type header field.
- ByteString aContentType;
+ rtl::OStringBuffer aContentType;
switch (eType)
{
case INETMSG_MESSAGE_RFC822:
- aContentType = "message/rfc822";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("message/rfc822"));
break;
case INETMSG_MULTIPART_ALTERNATIVE:
- aContentType = "multipart/alternative";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/alternative"));
break;
case INETMSG_MULTIPART_DIGEST:
- aContentType = "multipart/digest";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/digest"));
break;
case INETMSG_MULTIPART_PARALLEL:
- aContentType = "multipart/parallel";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/parallel"));
break;
case INETMSG_MULTIPART_RELATED:
- aContentType = "multipart/related";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/related"));
break;
case INETMSG_MULTIPART_FORM_DATA:
- aContentType = "multipart/form-data";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/form-data"));
break;
default:
- aContentType = "multipart/mixed";
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("multipart/mixed"));
break;
}
// Setup boundary for multipart types.
- if (aContentType.CompareIgnoreCaseToAscii ("multipart/", 10) == 0)
+ if (aContentType.toString().equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("multipart/")))
{
// Generate a unique boundary from current time.
sal_Char sTail[16 + 1];
@@ -1124,13 +1124,13 @@ sal_Bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType)
m_aBoundary += sTail;
// Append boundary as ContentType parameter.
- aContentType += "; boundary=";
- aContentType += m_aBoundary;
+ aContentType.append(RTL_CONSTASCII_STRINGPARAM("; boundary="));
+ aContentType.append(m_aBoundary);
}
// Set header fields.
SetMIMEVersion (String (CONSTASCII_STRINGPARAM("1.0")));
- SetContentType (String (aContentType, RTL_TEXTENCODING_ASCII_US));
+ SetContentType (rtl::OStringToOUString(aContentType.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US));
SetContentTransferEncoding (String (CONSTASCII_STRINGPARAM("7bit")));
// Done.
@@ -1163,11 +1163,7 @@ SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const
for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++)
rStrm << static_cast<sal_uInt32>(m_nIndex[i]);
-#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
- rStrm << m_aBoundary;
-#else
rStrm.WriteByteString (m_aBoundary);
-#endif
rStrm << static_cast<sal_uInt32>(aChildren.size());
return rStrm;
@@ -1187,11 +1183,8 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm)
m_nIndex[i] = nTemp;
}
-#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
- rStrm >> m_aBoundary;
-#else
rStrm.ReadByteString (m_aBoundary);
-#endif
+
rStrm >> nTemp;
return rStrm;
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index cc8a18c..c2921ea 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -203,17 +203,15 @@ class ErrHdl_Impl
const ErrorInfo*, String&, sal_uInt16&);
};
-
static void aDspFunc(const String &rErr, const String &rAction)
{
- ByteString aErr("Aktion: ");
- aErr+= ByteString( rAction, RTL_TEXTENCODING_ASCII_US );
- aErr+=" Fehler: ";
- aErr+= ByteString( rErr, RTL_TEXTENCODING_ASCII_US );
- OSL_FAIL(aErr.GetBuffer());
+ rtl::OStringBuffer aErr(RTL_CONSTASCII_STRINGPARAM("Aktion: "));
+ aErr.append(rtl::OUStringToOString(rAction, RTL_TEXTENCODING_ASCII_US));
+ aErr.append(RTL_CONSTASCII_STRINGPARAM(" Fehler: "));
+ aErr.append(rtl::OUStringToOString(rErr, RTL_TEXTENCODING_ASCII_US));
+ OSL_FAIL(aErr.getStr());
}
-
ErrorContext::ErrorContext(Window *pWinP)
{
EDcrData *pData=EDcrData::GetData();
@@ -327,45 +325,47 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
if(ErrHdl_Impl::CreateString(pData->pFirstHdl,pInfo,aErr,nErrFlags))
{
- if (bJustCreateString)
- {
- rError = aErr;
- return 1;
- }
- else
- {
- if(!pData->pDsp)
+ if (bJustCreateString)
{
- ByteString aStr("Action: ");
- aStr += ByteString( aAction, RTL_TEXTENCODING_ASCII_US );
- aStr += ByteString("\nFehler: ");
- aStr += ByteString( aErr, RTL_TEXTENCODING_ASCII_US );
- OSL_FAIL( aStr.GetBuffer() );
+ rError = aErr;
+ return 1;
}
else
{
- delete pInfo;
- if(!pData->bIsWindowDsp)
- {
- (*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction);
- return 0;
+ if(!pData->pDsp)
+ {
+ rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Action: "));
+ aStr.append(rtl::OUStringToOString(aAction, RTL_TEXTENCODING_ASCII_US));
+ aStr.append(RTL_CONSTASCII_STRINGPARAM("\nFehler: "));
+ aStr.append(rtl::OUStringToOString(aErr, RTL_TEXTENCODING_ASCII_US));
+ OSL_FAIL(aStr.getStr());
+ }
+ else
+ {
+ delete pInfo;
+ if(!pData->bIsWindowDsp)
+ {
+ (*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction);
+ return 0;
+ }
+ else
+ {
+ if( nFlags != USHRT_MAX )
+ nErrFlags = nFlags;
+ return (*(WindowDisplayErrorFunc*)pData->pDsp)(
+ pParent, nErrFlags, aErr, aAction);
+ }
+ }
}
- else
- {
- if( nFlags != USHRT_MAX )
- nErrFlags = nFlags;
- return (*(WindowDisplayErrorFunc*)pData->pDsp)(
- pParent, nErrFlags, aErr, aAction);
- }
- }
- }
}
OSL_FAIL("Error nicht behandelt");
// Error 1 ist General Error im Sfx
- if(pInfo->GetErrorCode()!=1) {
+ if(pInfo->GetErrorCode()!=1)
+ {
HandleError_Impl(1, USHRT_MAX, bJustCreateString, rError);
}
- else {
+ else
+ {
OSL_FAIL("Error 1 nicht gehandeled");
}
delete pInfo;
More information about the Libreoffice-commits
mailing list