diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-06-29 23:57:38 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-06-30 04:58:49 +0000 |
commit | 710f41b7aec8e7d35a0da8be332aa289f98942af (patch) | |
tree | b894ef2d3f06a63a85f423b2713a654ea57f9c69 | |
parent | remove all my debug code (diff) | |
download | core-710f41b7aec8e7d35a0da8be332aa289f98942af.tar.gz core-710f41b7aec8e7d35a0da8be332aa289f98942af.zip |
Clean String and sal_Bool in tools
Change-Id: I6a92196f33d7a5278c7dcc426112e9c56d582655
Reviewed-on: https://gerrit.libreoffice.org/4627
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
97 files changed, 1304 insertions, 1288 deletions
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index 316ad2fdc0e7..f69230dce008 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -18,6 +18,7 @@ */ #include "file/quotedstring.hxx" +#include <rtl/ustrbuf.hxx> namespace connectivity { @@ -25,28 +26,28 @@ namespace connectivity //= QuotedTokenizedString //================================================================== //------------------------------------------------------------------ - xub_StrLen QuotedTokenizedString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const + sal_Int32 QuotedTokenizedString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) const { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com QuotedTokenizedString::GetTokenCount" ); - const xub_StrLen nLen = m_sString.Len(); + const sal_Int32 nLen = m_sString.getLength(); if ( !nLen ) return 0; - xub_StrLen nTokCount = 1; - sal_Bool bStart = sal_True; // Are we on the first character in the Token? - sal_Bool bInString = sal_False; // Are we WITHIN a (cStrDel delimited) String? + sal_Int32 nTokCount = 1; + bool bStart = true; // Are we on the first character in the Token? + bool bInString = false; // Are we WITHIN a (cStrDel delimited) String? // Search for String-end after the first not matching character - for( xub_StrLen i = 0; i < nLen; ++i ) + for( sal_Int32 i = 0; i < nLen; ++i ) { - const sal_Unicode cChar = m_sString.GetChar(i); + const sal_Unicode cChar = m_sString[i]; if (bStart) { - bStart = sal_False; + bStart = false; // First character a String-Delimiter? if ( cChar == cStrDel ) { - bInString = sal_True; // then we are now WITHIN the string! + bInString = true; // then we are now WITHIN the string! continue; // skip this character! } } @@ -56,7 +57,7 @@ namespace connectivity // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { - if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) + if ((i+1 < nLen) && (m_sString[i+1] == cStrDel)) { // double String-Delimter-character: ++i; // no string-end, skip next character. @@ -64,7 +65,7 @@ namespace connectivity else { // String-End - bInString = sal_False; + bInString = false; } } } // if (bInString) @@ -74,7 +75,7 @@ namespace connectivity if ( cChar == cTok ) { ++nTokCount; - bStart = sal_True; + bStart = true; } } } @@ -84,51 +85,48 @@ namespace connectivity } //------------------------------------------------------------------ - String QuotedTokenizedString::GetTokenSpecial(xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel) const + OUString QuotedTokenizedString::GetTokenSpecial(sal_Int32& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel) const { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com QuotedTokenizedString::GetTokenCount" ); - String aStr; - const xub_StrLen nLen = m_sString.Len(); + const sal_Int32 nLen = m_sString.getLength(); if ( nLen ) { - sal_Bool bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // are we WITHIN a (cStrDel delimited) String? + bool bInString = (nStartPos < nLen) && (m_sString[nStartPos] == cStrDel); // are we WITHIN a (cStrDel delimited) String? // First character a String-Delimiter? if (bInString ) ++nStartPos; // skip this character! if ( nStartPos >= nLen ) - return aStr; + return OUString(); + + OUStringBuffer sBuff( nLen - nStartPos + 1 ); - sal_Unicode* pData = aStr.AllocBuffer( nLen - nStartPos + 1 ); - const sal_Unicode* pStart = pData; // Search until end of string for the first not matching character - for( xub_StrLen i = nStartPos; i < nLen; ++i ) + for( sal_Int32 i = nStartPos; i < nLen; ++i ) { - const sal_Unicode cChar = m_sString.GetChar(i); + const sal_Unicode cChar = m_sString[i]; if (bInString) { // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { - if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) + if ((i+1 < nLen) && (m_sString[i+1] == cStrDel)) { // double String Delimiter-character // no end of string, skip next character. ++i; - *pData++ = m_sString.GetChar(i); // character belongs to Result-String + sBuff.append(m_sString[i]); // character belongs to Result-String } else { //end of String - bInString = sal_False; - *pData = 0; + bInString = false; } } else { - *pData++ = cChar; // character belongs to Result-String + sBuff.append(cChar); } - } else { @@ -141,14 +139,13 @@ namespace connectivity } else { - *pData++ = cChar; // character belongs to Result-String + sBuff.append(cChar); } } } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) - *pData = 0; - aStr.ReleaseBufferAccess(xub_StrLen(pData - pStart)); + return sBuff.makeStringAndClear(); } - return aStr; + return OUString(); } } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index b2788e6107c1..8f4e2c365e6d 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -137,9 +137,9 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) do { - xub_StrLen nStartPosHeaderLine = 0; // use for efficient way to get the tokens - xub_StrLen nStartPosFirstLine = 0; // use for efficient way to get the tokens - xub_StrLen nStartPosFirstLine2 = 0; + sal_Int32 nStartPosHeaderLine = 0; // use for efficient way to get the tokens + sal_Int32 nStartPosFirstLine = 0; // use for efficient way to get the tokens + sal_Int32 nStartPosFirstLine2 = 0; for (xub_StrLen i = 0; i < nFieldCount; i++) { if ( nRowCount == 0) @@ -160,7 +160,11 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) aColumnNames.push_back(aColumnName); } if(bRead) - impl_fillColumnInfo_nothrow(m_aCurrentLine,nStartPosFirstLine,nStartPosFirstLine2,m_aTypes[i],m_aPrecisions[i],m_aScales[i],m_aTypeNames[i],cDecimalDelimiter,cThousandDelimiter,aCharClass); + { + impl_fillColumnInfo_nothrow(m_aCurrentLine, nStartPosFirstLine, nStartPosFirstLine2, + m_aTypes[i], m_aPrecisions[i], m_aScales[i], m_aTypeNames[i], + cDecimalDelimiter, cThousandDelimiter, aCharClass); + } } ++nRowCount; bRead = readLine(&rowPos.second, &rowPos.first, false); @@ -197,9 +201,10 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_pFileStream->Seek(m_aRowPosToFilePos[0].second); } -void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2 - ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName - ,const sal_Unicode cDecimalDelimiter,const sal_Unicode cThousandDelimiter,const CharClass& aCharClass) + +void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2, + sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, String& o_sTypeName, + const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass) { if ( io_nType != DataType::VARCHAR ) { @@ -630,7 +635,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, s const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); // Fields: - xub_StrLen nStartPos = 0; + sal_Int32 nStartPos = 0; OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); const OValueRefVector::Vector::size_type nCount = _rRow->get().size(); @@ -935,7 +940,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos { if (pStartPos) *pStartPos = m_pFileStream->Tell(); - m_pFileStream->ReadByteStringLine(m_aCurrentLine,nEncoding); + m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding); if (m_pFileStream->IsEof()) return false; @@ -945,8 +950,8 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos m_pFileStream->ReadByteStringLine(sLine,nEncoding); if ( !m_pFileStream->IsEof() ) { - m_aCurrentLine.GetString().Append('\n'); - m_aCurrentLine.GetString() += sLine.GetString(); + OUString aStr = m_aCurrentLine.GetString() + "\n" + sLine.GetString(); + m_aCurrentLine.SetString(aStr); sLine = m_aCurrentLine; } else diff --git a/connectivity/source/inc/file/quotedstring.hxx b/connectivity/source/inc/file/quotedstring.hxx index b7b13d7d8bcc..6c39e7cdda9b 100644 --- a/connectivity/source/inc/file/quotedstring.hxx +++ b/connectivity/source/inc/file/quotedstring.hxx @@ -31,16 +31,17 @@ namespace connectivity //================================================================== class OOO_DLLPUBLIC_FILE QuotedTokenizedString { - String m_sString; + OUString m_sString; public: QuotedTokenizedString() {} - QuotedTokenizedString(const String& _sString) : m_sString(_sString){} + QuotedTokenizedString(const OUString& _sString) : m_sString(_sString){} - xub_StrLen GetTokenCount( sal_Unicode cTok , sal_Unicode cStrDel ) const; - String GetTokenSpecial(xub_StrLen& nStartPos, sal_Unicode cTok = ';', sal_Unicode cStrDel = '\0') const; - inline String& GetString() { return m_sString; } - inline xub_StrLen Len() const { return m_sString.Len(); } - inline operator String&() { return m_sString; } + sal_Int32 GetTokenCount( sal_Unicode cTok , sal_Unicode cStrDel ) const; + OUString GetTokenSpecial(sal_Int32& nStartPos, sal_Unicode cTok = ';', sal_Unicode cStrDel = '\0') const; + inline OUString& GetString() { return m_sString; } + inline void SetString(OUString aStr) { m_sString = aStr;} + inline sal_Int32 Len() const { return m_sString.getLength(); } + inline operator OUString&() { return m_sString; } }; } diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index c5b3608597e2..f283647d909c 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -60,9 +60,9 @@ namespace connectivity sal_Bool CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo); bool readLine(sal_Int32 *pEndPos = NULL, sal_Int32 *pStartPos = NULL, bool nonEmpty = false); void setRowPos(::std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos); - void impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2 - ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName - ,const sal_Unicode cDecimalDelimiter,const sal_Unicode cThousandDelimiter,const CharClass& aCharClass); + void impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2, + sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, String& o_sTypeName, + const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass); OFlatConnection* getFlatConnection() { #if OSL_DEBUG_LEVEL>1 diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx index da1e61b3c0c3..fc2ee354d1f5 100644 --- a/dbaccess/source/ui/tabledesign/TableRow.cxx +++ b/dbaccess/source/ui/tabledesign/TableRow.cxx @@ -22,6 +22,7 @@ #include "FieldDescriptions.hxx" #include <algorithm> #include <comphelper/types.hxx> +#include <tools/string.hxx> using namespace dbaui; using namespace ::com::sun::star::sdbc; diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index fd3a33511a68..5abe441c72ec 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -19,6 +19,7 @@ #include "wordbookmigration.hxx" #include <cppuhelper/supportsservice.hxx> +#include <tools/string.hxx> #include <tools/urlobj.hxx> #include <unotools/bootstrap.hxx> #include <unotools/ucbstreamhelper.hxx> diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 39e8156f114e..7572014e54d8 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -123,11 +123,11 @@ EditPaM ImpEditEngine::ReadText( SvStream& rInput, EditSelection aSel ) aSel = ImpDeleteSelection( aSel ); EditPaM aPaM = aSel.Max(); - XubString aTmpStr; - sal_Bool bDone = rInput.ReadByteStringLine( aTmpStr, rInput.GetStreamCharSet() ); + OUString aTmpStr; + bool bDone = rInput.ReadByteStringLine( aTmpStr, rInput.GetStreamCharSet() ); while ( bDone ) { - aTmpStr.Erase( MAXCHARSINPARA ); + aTmpStr = aTmpStr.copy(0, MAXCHARSINPARA ); aPaM = ImpInsertText( EditSelection( aPaM, aPaM ), aTmpStr ); aPaM = ImpInsertParaBreak( aPaM ); bDone = rInput.ReadByteStringLine( aTmpStr, rInput.GetStreamCharSet() ); diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx index 28e3b695c561..6255442ec3ff 100644 --- a/fileaccess/source/FileAccess.cxx +++ b/fileaccess/source/FileAccess.cxx @@ -29,6 +29,7 @@ #include <ucbhelper/content.hxx> #include <unotools/streamwrap.hxx> #include <tools/stream.hxx> +#include <tools/string.hxx> #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/container/XChild.hpp> diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx index cc6f6b8c1971..5b23b7192c82 100644 --- a/include/sfx2/docfilt.hxx +++ b/include/sfx2/docfilt.hxx @@ -19,9 +19,11 @@ #ifndef _SFX_DOCFILT_HACK_HXX #define _SFX_DOCFILT_HACK_HXX -#include "sal/config.h" -#include "sfx2/dllapi.h" -#include "sal/types.h" +#include <sal/config.h> +#include <sfx2/dllapi.h> +#include <sal/types.h> +#include <tools/solar.h> +#include <tools/string.hxx> #include <com/sun/star/plugin/PluginDescription.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/beans/UnknownPropertyException.hpp> diff --git a/include/sot/factory.hxx b/include/sot/factory.hxx index 726b24382756..406333df6f5a 100644 --- a/include/sot/factory.hxx +++ b/include/sot/factory.hxx @@ -21,6 +21,7 @@ #define _SOT_FACTORY_HXX #include <tools/globname.hxx> +#include <tools/string.hxx> #include <tools/rtti.hxx> #include "sot/sotdllapi.h" #include <vector> diff --git a/include/sot/storinfo.hxx b/include/sot/storinfo.hxx index 5518d618bf36..08fc5ea7f6f6 100644 --- a/include/sot/storinfo.hxx +++ b/include/sot/storinfo.hxx @@ -21,6 +21,7 @@ #define _SOT_STORINFO_HXX #include <tools/globname.hxx> +#include <tools/string.hxx> #include <vector> #include "sot/sotdllapi.h" diff --git a/include/svl/sfontitm.hxx b/include/svl/sfontitm.hxx index f9bcbdc7f917..068eb93816c7 100644 --- a/include/svl/sfontitm.hxx +++ b/include/svl/sfontitm.hxx @@ -22,6 +22,7 @@ #include <tools/color.hxx> #include <tools/gen.hxx> +#include <tools/string.hxx> #include <i18nlangtag/lang.h> #include <svl/poolitem.hxx> diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx index 4b06a6e9d781..6958eaf82f08 100644 --- a/include/svtools/ehdl.hxx +++ b/include/svtools/ehdl.hxx @@ -25,6 +25,7 @@ #include "svtools/svtdllapi.h" #include <tools/errinf.hxx> +#include <tools/string.hxx> class Window; class ResMgr; @@ -38,7 +39,7 @@ public: SfxErrorContext( sal_uInt16 nCtxIdP, const String &aArg1, Window *pWin=0, sal_uInt16 nResIdP=USHRT_MAX, ResMgr *pMgrP=0); - virtual sal_Bool GetString(sal_uLong nErrId, OUString &rStr); + virtual bool GetString(sal_uLong nErrId, OUString &rStr); private: sal_uInt16 nCtxId; @@ -66,8 +67,7 @@ private: ResMgr *pFreeMgr; SVT_DLLPRIVATE sal_Bool GetClassString(sal_uLong lErrId, String &) const; - virtual sal_Bool CreateString( - const ErrorInfo *, OUString &, sal_uInt16 &) const; + virtual bool CreateString( const ErrorInfo *, OUString &, sal_uInt16 &) const; }; #endif diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index c4924d016fbb..ae32d08dd22f 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -24,6 +24,7 @@ #include <typeinfo> #include <cppuhelper/weakref.hxx> #include <vcl/mapmod.hxx> +#include <tools/string.hxx> #include <tools/weakbase.hxx> #include <svl/lstner.hxx> #include <vcl/timer.hxx> diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx index b43db7da37ed..2a485be7a8fc 100644 --- a/include/svx/svdpagv.hxx +++ b/include/svx/svdpagv.hxx @@ -21,6 +21,7 @@ #define _SVDPAGV_HXX #include <com/sun/star/awt/XControlContainer.hpp> +#include <tools/string.hxx> #include <svl/lstner.hxx> #include <svx/svdhlpln.hxx> #include <cppuhelper/implbase4.hxx> diff --git a/include/tools/b3dtrans.hxx b/include/tools/b3dtrans.hxx index c9e65950b1b6..5dace979b820 100644 --- a/include/tools/b3dtrans.hxx +++ b/include/tools/b3dtrans.hxx @@ -145,13 +145,13 @@ public: // Parameters of ViewportTransformation void SetDeviceRectangle(double fL=-1.0, double fR=1.0, double fB=-1.0, double fT=1.0, - sal_Bool bBroadCastChange=sal_True); + bool bBroadCastChange=true); double GetDeviceRectangleWidth() const { return mfRightBound - mfLeftBound; } double GetDeviceRectangleHeight() const { return mfTopBound - mfBottomBound; } double GetFrontClippingPlane() { return mfNearBound; } double GetBackClippingPlane() { return mfFarBound; } - void SetPerspective(sal_Bool bNew); - sal_Bool GetPerspective() { return mbPerspective; } + void SetPerspective(bool bNew); + bool GetPerspective() { return mbPerspective; } void SetViewportRectangle(Rectangle& rRect, Rectangle& rVisible); void SetViewportRectangle(Rectangle& rRect) { SetViewportRectangle(rRect, rRect); } const Rectangle& GetViewportRectangle() { return maViewportRectangle; } @@ -234,7 +234,7 @@ public: const basegfx::B3DPoint& rPos = basegfx::B3DPoint(0.0, 0.0, 1.0), const basegfx::B3DVector& rLkAt = basegfx::B3DVector(0.0, 0.0, 0.0), double fFocLen = 35.0, double fBnkAng = 0.0, - sal_Bool bUseFocLen = sal_False); + bool bUseFocLen = false); virtual ~B3dCamera(); const basegfx::B3DPoint& GetPosition() const { return aPosition; } @@ -245,11 +245,11 @@ public: double GetBankAngle() const { return fBankAngle; } - sal_Bool GetUseFocalLength() const { return (sal_Bool)bUseFocalLength; } + bool GetUseFocalLength() const { return (bool)bUseFocalLength; } protected: void CalcNewViewportValues(); - sal_Bool CalcFocalLength(); + bool CalcFocalLength(); virtual void DeviceRectangleChange(); }; diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx index 0cf47ad4aaa0..95cd395ae912 100644 --- a/include/tools/bigint.hxx +++ b/include/tools/bigint.hxx @@ -49,13 +49,13 @@ private: TOOLS_DLLPRIVATE void Normalize(); TOOLS_DLLPRIVATE void Mult(BigInt const &, sal_uInt16); TOOLS_DLLPRIVATE void Div(sal_uInt16, sal_uInt16 &); - TOOLS_DLLPRIVATE sal_Bool IsLess(BigInt const &) const; + TOOLS_DLLPRIVATE bool IsLess(BigInt const &) const; TOOLS_DLLPRIVATE void AddLong(BigInt &, BigInt &); TOOLS_DLLPRIVATE void SubLong(BigInt &, BigInt &); TOOLS_DLLPRIVATE void MultLong(BigInt const &, BigInt &) const; TOOLS_DLLPRIVATE void DivLong(BigInt const &, BigInt &) const; TOOLS_DLLPRIVATE void ModLong(BigInt const &, BigInt &) const; - TOOLS_DLLPRIVATE sal_Bool ABS_IsLess(BigInt const &) const; + TOOLS_DLLPRIVATE bool ABS_IsLess(BigInt const &) const; public: BigInt(); @@ -79,18 +79,18 @@ public: operator sal_uInt16() const; operator sal_uIntPtr() const; - void Set( sal_Bool bSet ) { bIsSet = bSet; } - OUString GetString() const; + void Set( bool bSet ) { bIsSet = bSet ? sal_True : sal_False; } + OUString GetString() const; - sal_Bool IsSet() const { return bIsSet; } - sal_Bool IsNeg() const; - sal_Bool IsZero() const; - sal_Bool IsOne() const; - sal_Bool IsLong() const { return !bIsBig; } + bool IsSet() const { return (bool)bIsSet; } + bool IsNeg() const; + bool IsZero() const; + bool IsOne() const; + bool IsLong() const { return !((bool)bIsBig); } void Abs(); #ifdef _TLBIGINT_INT64 - sal_Bool INT64 ( SbxINT64 *p ) const; - sal_Bool UINT64( SbxUINT64 *p ) const; + bool INT64 ( SbxINT64 *p ) const; + bool UINT64( SbxUINT64 *p ) const; #endif BigInt& operator =( const BigInt& rVal ); @@ -111,12 +111,12 @@ public: friend inline BigInt operator /( const BigInt& rVal1, const BigInt& rVal2 ); friend inline BigInt operator %( const BigInt& rVal1, const BigInt& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator==( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator< ( const BigInt& rVal1, const BigInt& rVal2 ); - TOOLS_DLLPUBLIC friend sal_Bool operator> ( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ); - friend inline sal_Bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator==( const BigInt& rVal1, const BigInt& rVal2 ); + friend inline bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator< ( const BigInt& rVal1, const BigInt& rVal2 ); + TOOLS_DLLPUBLIC friend bool operator> ( const BigInt& rVal1, const BigInt& rVal2 ); + friend inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ); + friend inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ); friend class Fraction; }; @@ -224,15 +224,15 @@ inline BigInt& BigInt::operator =( const sal_uInt16 nValue ) return *this; } -inline sal_Bool BigInt::IsNeg() const +inline bool BigInt::IsNeg() const { if ( !bIsBig ) return (nVal < 0); else - return (sal_Bool)bIsNeg; + return (bool)bIsNeg; } -inline sal_Bool BigInt::IsZero() const +inline bool BigInt::IsZero() const { if ( bIsBig ) return sal_False; @@ -240,7 +240,7 @@ inline sal_Bool BigInt::IsZero() const return (nVal == 0); } -inline sal_Bool BigInt::IsOne() const +inline bool BigInt::IsOne() const { if ( bIsBig ) return sal_False; @@ -291,17 +291,17 @@ inline BigInt operator%( const BigInt &rVal1, const BigInt &rVal2 ) return aErg; } -inline sal_Bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ) +inline bool operator!=( const BigInt& rVal1, const BigInt& rVal2 ) { return !(rVal1 == rVal2); } -inline sal_Bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ) +inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 ) { return !( rVal1 > rVal2); } -inline sal_Bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ) +inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 ) { return !(rVal1 < rVal2); } diff --git a/include/tools/cachestr.hxx b/include/tools/cachestr.hxx index 60c31e298cf8..6d980566a96a 100644 --- a/include/tools/cachestr.hxx +++ b/include/tools/cachestr.hxx @@ -20,7 +20,6 @@ #define _CACHESTR_HXX #include <tools/stream.hxx> -#include <tools/string.hxx> #include "tools/toolsdllapi.h" class TempFile; @@ -28,9 +27,9 @@ class TempFile; class TOOLS_DLLPUBLIC SvCacheStream : public SvStream { private: - String aFileName; + OUString aFileName; sal_uIntPtr nMaxSize; - int bPersistent; + bool bPersistent; SvStream* pSwapStream; SvStream* pCurrentStream; @@ -48,18 +47,16 @@ public: SvCacheStream( sal_uIntPtr nMaxMemSize = 0 ); ~SvCacheStream(); - void SetFilename( const String& rFN ) - { aFileName = rFN; } // call only from FilenameHdl - const String& GetFilename() const { return aFileName; } + void SetFilename( const OUString& rFN ) { aFileName = rFN; } // call only from FilenameHdl + const OUString& GetFilename() const { return aFileName; } void SwapOut(); const void* GetBuffer(); sal_uIntPtr GetSize(); - sal_Bool IsPersistent() { return bPersistent != 0; } - void SetPersistence( sal_Bool b = sal_True ) { bPersistent = b; } - void SetSwapStream( SvStream *p ) - { pSwapStream = p; } // call only from FilenameHdl + bool IsPersistent() { return bPersistent; } + void SetPersistence( bool b = true ) { bPersistent = b; } + void SetSwapStream( SvStream *p ) { pSwapStream = p; } // call only from FilenameHdl }; #endif diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 911088b9cad1..f992c32f01d7 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -138,11 +138,11 @@ public: void Merge( const Color& rMergeColor, sal_uInt8 cTransparency ); - sal_Bool IsRGBEqual( const Color& rColor ) const; + bool IsRGBEqual( const Color& rColor ) const; // comparison with luminance thresholds - sal_Bool IsDark() const; - sal_Bool IsBright() const; + bool IsDark() const; + bool IsBright() const; // color space conversion tools // the range for h/s/b is: @@ -152,13 +152,13 @@ public: static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ); void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const; - sal_Bool operator==( const Color& rColor ) const - { return (mnColor == rColor.mnColor); } - sal_Bool operator!=( const Color& rColor ) const - { return !(Color::operator==( rColor )); } + bool operator==( const Color& rColor ) const + { return (mnColor == rColor.mnColor); } + bool operator!=( const Color& rColor ) const + { return !(Color::operator==( rColor )); } - SvStream& Read( SvStream& rIStm, sal_Bool bNewFormat = sal_True ); - SvStream& Write( SvStream& rOStm, sal_Bool bNewFormat = sal_True ); + SvStream& Read( SvStream& rIStm, bool bNewFormat = true ); + SvStream& Write( SvStream& rOStm, bool bNewFormat = true ); TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Color& rColor ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Color& rColor ); @@ -191,7 +191,7 @@ inline void Color::SetTransparency( sal_uInt8 nTransparency ) mnColor |= ((sal_uInt32)nTransparency)<<24; } -inline sal_Bool Color::IsRGBEqual( const Color& rColor ) const +inline bool Color::IsRGBEqual( const Color& rColor ) const { return (COLORDATA_RGB( mnColor ) == COLORDATA_RGB( rColor.mnColor )); } diff --git a/include/tools/config.hxx b/include/tools/config.hxx index 64b690fda742..d19cc0dbbb55 100644 --- a/include/tools/config.hxx +++ b/include/tools/config.hxx @@ -28,17 +28,17 @@ struct ImplGroupData; class TOOLS_DLLPUBLIC Config { private: - OUString maFileName; - OString maGroupName; + OUString maFileName; + OString maGroupName; ImplConfigData* mpData; ImplGroupData* mpActGroup; sal_uIntPtr mnDataUpdateId; sal_uInt16 mnLockCount; - sal_Bool mbPersistence; - sal_Bool mbDummy1; + bool mbPersistence; + bool mbDummy1; - TOOLS_DLLPRIVATE sal_Bool ImplUpdateConfig() const; - TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const; + TOOLS_DLLPRIVATE bool ImplUpdateConfig() const; + TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const; public: Config( const OUString& rFileName ); @@ -51,7 +51,7 @@ public: void DeleteGroup(const OString& rGroup); OString GetGroupName(sal_uInt16 nGroup) const; sal_uInt16 GetGroupCount() const; - sal_Bool HasGroup(const OString& rGroup) const; + bool HasGroup(const OString& rGroup) const; OString ReadKey(const OString& rKey) const; OUString ReadKey(const OString& rKey, rtl_TextEncoding eEncoding) const; @@ -62,12 +62,12 @@ public: OString ReadKey(sal_uInt16 nKey) const; sal_uInt16 GetKeyCount() const; - sal_Bool IsLocked() const { return (mnLockCount != 0); } + bool IsLocked() const { return (mnLockCount != 0); } void Flush(); - void EnablePersistence( sal_Bool bPersistence = sal_True ) + void EnablePersistence( bool bPersistence = true ) { mbPersistence = bPersistence; } - sal_Bool IsPersistenceEnabled() const { return mbPersistence; } + bool IsPersistenceEnabled() const { return mbPersistence; } private: TOOLS_DLLPRIVATE Config( const Config& rConfig ); diff --git a/include/tools/date.hxx b/include/tools/date.hxx index 714a97b85727..5b451a39b002 100644 --- a/include/tools/date.hxx +++ b/include/tools/date.hxx @@ -110,13 +110,13 @@ public: sal_uInt16 GetDaysInMonth() const; sal_uInt16 GetDaysInYear() const { return (IsLeapYear()) ? 366 : 365; } - sal_Bool IsLeapYear() const; + bool IsLeapYear() const; /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31) depending on month/year) AND is of the Gregorian calendar (1582-10-15 <= date) (AND implicitly date <= 9999-12-31 due to internal representation) */ - sal_Bool IsValidAndGregorian() const; + bool IsValidAndGregorian() const; /** If the represented date is valid (1<=month<=12, 1<=day<=(28,29,30,31) depending on month/year) */ @@ -136,21 +136,21 @@ public: */ bool Normalize(); - sal_Bool IsBetween( const Date& rFrom, const Date& rTo ) const + bool IsBetween( const Date& rFrom, const Date& rTo ) const { return ((nDate >= rFrom.nDate) && (nDate <= rTo.nDate)); } - sal_Bool operator ==( const Date& rDate ) const + bool operator ==( const Date& rDate ) const { return (nDate == rDate.nDate); } - sal_Bool operator !=( const Date& rDate ) const + bool operator !=( const Date& rDate ) const { return (nDate != rDate.nDate); } - sal_Bool operator >( const Date& rDate ) const + bool operator >( const Date& rDate ) const { return (nDate > rDate.nDate); } - sal_Bool operator <( const Date& rDate ) const + bool operator <( const Date& rDate ) const { return (nDate < rDate.nDate); } - sal_Bool operator >=( const Date& rDate ) const + bool operator >=( const Date& rDate ) const { return (nDate >= rDate.nDate); } - sal_Bool operator <=( const Date& rDate ) const + bool operator <=( const Date& rDate ) const { return (nDate <= rDate.nDate); } Date& operator =( const Date& rDate ) diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 1de0f3d6432c..a8d732efc510 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -47,26 +47,26 @@ public: DateTime( const Date& rDate, const Time& rTime ) : Date( rDate ), Time( rTime ) {} - sal_Bool IsBetween( const DateTime& rFrom, + bool IsBetween( const DateTime& rFrom, const DateTime& rTo ) const; - sal_Bool IsEqualIgnoreNanoSec( const DateTime& rDateTime ) const + bool IsEqualIgnoreNanoSec( const DateTime& rDateTime ) const { if ( Date::operator!=( rDateTime ) ) - return sal_False; + return false; return Time::IsEqualIgnoreNanoSec( rDateTime ); } - sal_Bool operator ==( const DateTime& rDateTime ) const + bool operator ==( const DateTime& rDateTime ) const { return (Date::operator==( rDateTime ) && Time::operator==( rDateTime )); } - sal_Bool operator !=( const DateTime& rDateTime ) const + bool operator !=( const DateTime& rDateTime ) const { return (Date::operator!=( rDateTime ) || Time::operator!=( rDateTime )); } - sal_Bool operator >( const DateTime& rDateTime ) const; - sal_Bool operator <( const DateTime& rDateTime ) const; - sal_Bool operator >=( const DateTime& rDateTime ) const; - sal_Bool operator <=( const DateTime& rDateTime ) const; + bool operator >( const DateTime& rDateTime ) const; + bool operator <( const DateTime& rDateTime ) const; + bool operator >=( const DateTime& rDateTime ) const; + bool operator <=( const DateTime& rDateTime ) const; long GetSecFromDateTime( const Date& rDate ) const; diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx index 54160502257a..44be8f055a1b 100644 --- a/include/tools/debug.hxx +++ b/include/tools/debug.hxx @@ -182,9 +182,9 @@ typedef sal_uInt16 DbgChannelId; */ TOOLS_DLLPUBLIC DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc ); -inline sal_Bool DbgFilterMessage( const char* pMsg ) +inline bool DbgFilterMessage( const char* pMsg ) { - return (sal_Bool)(long) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg ); + return (bool)(long) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg ); } inline int DbgIsAllErrorOut() diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx index 815447b7372f..04f03671194b 100644 --- a/include/tools/errinf.hxx +++ b/include/tools/errinf.hxx @@ -23,9 +23,9 @@ #define _EINF_HXX #include <limits.h> +#include <rtl/ustring.hxx> #include <tools/rtti.hxx> #include <tools/errcode.hxx> -#include <tools/string.hxx> #include "tools/toolsdllapi.h" class EDcr_Impl; @@ -127,7 +127,7 @@ public: ErrorContext(Window *pWin=0); virtual ~ErrorContext(); - virtual sal_Bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0; + virtual bool GetString( sal_uIntPtr nErrId, OUString& rCtxStr ) = 0; Window* GetParent() { return pWin; } static ErrorContext* GetContext(); @@ -148,10 +148,10 @@ private: static sal_uInt16 HandleError_Impl( sal_uIntPtr lId, sal_uInt16 nFlags, - sal_Bool bJustCreateString, + bool bJustCreateString, OUString & rError); protected: - virtual sal_Bool CreateString( const ErrorInfo *, + virtual bool CreateString( const ErrorInfo *, OUString &, sal_uInt16& nMask ) const = 0; public: @@ -159,7 +159,7 @@ public: virtual ~ErrorHandler(); static sal_uInt16 HandleError ( sal_uIntPtr lId, sal_uInt16 nMask = USHRT_MAX ); - static sal_Bool GetErrorString( sal_uIntPtr lId, OUString& rStr ); + static bool GetErrorString( sal_uIntPtr lId, OUString& rStr ); static void RegisterDisplay( BasicDisplayErrorFunc* ); static void RegisterDisplay( WindowDisplayErrorFunc* ); @@ -168,7 +168,7 @@ public: class TOOLS_DLLPUBLIC SimpleErrorHandler : private ErrorHandler { protected: - virtual sal_Bool CreateString( const ErrorInfo*, OUString &, + virtual bool CreateString( const ErrorInfo*, OUString &, sal_uInt16 &nMask ) const; public: diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index c1a1e359bccc..fbfac95ec323 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -42,8 +42,8 @@ public: long& A() { return nA; } long& B() { return nB; } - sal_Bool operator == ( const Pair& rPair ) const; - sal_Bool operator != ( const Pair& rPair ) const; + bool operator == ( const Pair& rPair ) const; + bool operator != ( const Pair& rPair ) const; TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, Pair& rPair ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const Pair& rPair ); @@ -64,12 +64,12 @@ inline Pair::Pair( long _nA, long _nB ) Pair::nB = _nB; } -inline sal_Bool Pair::operator == ( const Pair& rPair ) const +inline bool Pair::operator == ( const Pair& rPair ) const { return ((nA == rPair.nA) && (nB == rPair.nB)); } -inline sal_Bool Pair::operator != ( const Pair& rPair ) const +inline bool Pair::operator != ( const Pair& rPair ) const { return ((nA != rPair.nA) || (nB != rPair.nB)); } @@ -89,10 +89,10 @@ public: long& Y() { return nB; } void Move( long nHorzMove, long nVertMove ); - sal_Bool IsAbove( const Point& rPoint ) const; - sal_Bool IsBelow( const Point& rPoint ) const; - sal_Bool IsLeft( const Point& rPoint ) const; - sal_Bool IsRight( const Point& rPoint ) const; + bool IsAbove( const Point& rPoint ) const; + bool IsBelow( const Point& rPoint ) const; + bool IsLeft( const Point& rPoint ) const; + bool IsRight( const Point& rPoint ) const; Point& operator += ( const Point& rPoint ); Point& operator -= ( const Point& rPoint ); @@ -124,22 +124,22 @@ inline void Point::Move( long nHorzMove, long nVertMove ) nB += nVertMove; } -inline sal_Bool Point::IsAbove( const Point& rPoint ) const +inline bool Point::IsAbove( const Point& rPoint ) const { return (nB > rPoint.nB); } -inline sal_Bool Point::IsBelow( const Point& rPoint ) const +inline bool Point::IsBelow( const Point& rPoint ) const { return (nB < rPoint.nB); } -inline sal_Bool Point::IsLeft( const Point& rPoint ) const +inline bool Point::IsLeft( const Point& rPoint ) const { return (nA < rPoint.nA); } -inline sal_Bool Point::IsRight( const Point& rPoint ) const +inline bool Point::IsRight( const Point& rPoint ) const { return (nA > rPoint.nA); } @@ -252,7 +252,7 @@ public: long& Min() { return nA; } long& Max() { return nB; } - sal_Bool IsInside( long nIs ) const; + bool IsInside( long nIs ) const; void Justify(); }; @@ -265,7 +265,7 @@ inline Range::Range( long nMin, long nMax ) : Pair( nMin, nMax ) { } -inline sal_Bool Range::IsInside( long nIs ) const +inline bool Range::IsInside( long nIs ) const { return ((nA <= nIs) && (nIs <= nB )); } @@ -306,11 +306,11 @@ public: long& Min() { return nA; } long& Max() { return nB; } - sal_Bool IsInside( long nIs ) const; + bool IsInside( long nIs ) const; void Justify(); - sal_Bool operator !() const { return !Len(); } + bool operator !() const { return !Len(); } long getMin() const { return Min(); } long getMax() const { return Max(); } @@ -331,7 +331,7 @@ inline Selection::Selection( long nMin, long nMax ) : { } -inline sal_Bool Selection::IsInside( long nIs ) const +inline bool Selection::IsInside( long nIs ) const { return ((nA <= nIs) && (nIs < nB )); } @@ -401,15 +401,15 @@ public: void Justify(); - sal_Bool IsInside( const Point& rPOINT ) const; - sal_Bool IsInside( const Rectangle& rRect ) const; - sal_Bool IsOver( const Rectangle& rRect ) const; + bool IsInside( const Point& rPOINT ) const; + bool IsInside( const Rectangle& rRect ) const; + bool IsOver( const Rectangle& rRect ) const; void SetEmpty() { nRight = nBottom = RECT_EMPTY; } - inline sal_Bool IsEmpty() const; + inline bool IsEmpty() const; - inline sal_Bool operator == ( const Rectangle& rRect ) const; - inline sal_Bool operator != ( const Rectangle& rRect ) const; + inline bool operator == ( const Rectangle& rRect ) const; + inline bool operator != ( const Rectangle& rRect ) const; inline Rectangle& operator += ( const Point& rPt ); inline Rectangle& operator -= ( const Point& rPt ); @@ -468,7 +468,7 @@ inline Rectangle::Rectangle( const Point& rLT, const Size& rSize ) nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY; } -inline sal_Bool Rectangle::IsEmpty() const +inline bool Rectangle::IsEmpty() const { return ((nRight == RECT_EMPTY) || (nBottom == RECT_EMPTY)); } @@ -621,7 +621,7 @@ inline Rectangle Rectangle::GetIntersection( const Rectangle& rRect ) const return aTmpRect.Intersection( rRect ); } -inline sal_Bool Rectangle::operator == ( const Rectangle& rRect ) const +inline bool Rectangle::operator == ( const Rectangle& rRect ) const { return ((nLeft == rRect.nLeft ) && (nTop == rRect.nTop ) && @@ -629,7 +629,7 @@ inline sal_Bool Rectangle::operator == ( const Rectangle& rRect ) const (nBottom == rRect.nBottom )); } -inline sal_Bool Rectangle::operator != ( const Rectangle& rRect ) const +inline bool Rectangle::operator != ( const Rectangle& rRect ) const { return ((nLeft != rRect.nLeft ) || (nTop != rRect.nTop ) || diff --git a/include/tools/globname.hxx b/include/tools/globname.hxx index 2ea6850801d1..eb7b7e91bee2 100644 --- a/include/tools/globname.hxx +++ b/include/tools/globname.hxx @@ -23,7 +23,6 @@ #include "tools/toolsdllapi.h" #include <com/sun/star/uno/Sequence.hxx> -#include <tools/string.hxx> struct ImpSvGlobalName { @@ -39,7 +38,7 @@ struct ImpSvGlobalName ImpSvGlobalName( const ImpSvGlobalName & rObj ); ImpSvGlobalName( Empty ); - sal_Bool operator == ( const ImpSvGlobalName & rObj ) const; + bool operator == ( const ImpSvGlobalName & rObj ) const; }; #ifdef WNT @@ -82,17 +81,17 @@ public: TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); TOOLS_DLLPUBLIC friend SvStream & operator << ( SvStream &, const SvGlobalName & ); - sal_Bool operator < ( const SvGlobalName & rObj ) const; - SvGlobalName & operator += ( sal_uInt32 ); - SvGlobalName & operator ++ () { return operator += ( 1 ); } + bool operator < ( const SvGlobalName & rObj ) const; + SvGlobalName& operator += ( sal_uInt32 ); + SvGlobalName& operator ++ () { return operator += ( 1 ); } - sal_Bool operator == ( const SvGlobalName & rObj ) const; - sal_Bool operator != ( const SvGlobalName & rObj ) const - { return !(*this == rObj); } + bool operator == ( const SvGlobalName & rObj ) const; + bool operator != ( const SvGlobalName & rObj ) const + { return !(*this == rObj); } - void MakeFromMemory( void * pData ); - sal_Bool MakeId( const String & rId ); - String GetHexName() const; + void MakeFromMemory( void * pData ); + bool MakeId( const OUString & rId ); + OUString GetHexName() const; SvGlobalName( const CLSID & rId ); const CLSID & GetCLSID() const { return *(CLSID *)pImp->szData; } diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx index afe4247c6612..347bb78861fd 100644 --- a/include/tools/inetmime.hxx +++ b/include/tools/inetmime.hxx @@ -26,6 +26,7 @@ #include <rtl/character.hxx> #include <rtl/string.hxx> #include <rtl/strbuf.hxx> +#include <rtl/ustring.hxx> #include <rtl/tencinfo.h> #include <tools/debug.hxx> #include <tools/errcode.hxx> diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx index 395286a04db2..fe05d635f4bc 100644 --- a/include/tools/inetmsg.hxx +++ b/include/tools/inetmsg.hxx @@ -408,7 +408,7 @@ class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message void CleanupImp(); void CopyImp (const INetMIMEMessage& rMsg); - void SetHeaderParsed() { bHeaderParsed = sal_True; } + void SetHeaderParsed() { bHeaderParsed = true; } protected: virtual SvStream& operator<< (SvStream& rStrm) const; diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx index d7b4e149d798..dcf1ecd9fd97 100644 --- a/include/tools/inetstrm.hxx +++ b/include/tools/inetstrm.hxx @@ -21,7 +21,7 @@ #include "tools/toolsdllapi.h" #include <sal/types.h> -#include <tools/string.hxx> +#include <rtl/ustring.hxx> class INetMessage; class INetMIMEMessage; @@ -84,7 +84,7 @@ enum INetMessageStreamState class INetMessageIStream : public INetIStream { INetMessage *pSourceMsg; - sal_Bool bHeaderGenerated; + bool bHeaderGenerated; sal_uIntPtr nBufSiz; sal_Char *pBuffer; @@ -112,15 +112,15 @@ public: INetMessage *GetSourceMessage (void) const { return pSourceMsg; } void SetSourceMessage (INetMessage *pMsg) { pSourceMsg = pMsg; } - void GenerateHeader (sal_Bool bGen = sal_True) { bHeaderGenerated = !bGen; } - sal_Bool IsHeaderGenerated (void) const { return bHeaderGenerated; } + void GenerateHeader (bool bGen = true) { bHeaderGenerated = !bGen; } + bool IsHeaderGenerated (void) const { return bHeaderGenerated; } }; /// Message Parser Interface. class INetMessageOStream : public INetOStream { INetMessage *pTargetMsg; - sal_Bool bHeaderParsed; + bool bHeaderParsed; INetMessageStreamState eOState; @@ -142,8 +142,8 @@ public: INetMessage *GetTargetMessage (void) const { return pTargetMsg; } void SetTargetMessage (INetMessage *pMsg) { pTargetMsg = pMsg; } - void ParseHeader (sal_Bool bParse = sal_True) { bHeaderParsed = !bParse; } - sal_Bool IsHeaderParsed (void) const { return bHeaderParsed; } + void ParseHeader (bool bParse = true) { bHeaderParsed = !bParse; } + bool IsHeaderParsed (void) const { return bHeaderParsed; } }; class INetMessageIOStream @@ -182,7 +182,7 @@ class TOOLS_DLLPUBLIC INetMIMEMessageStream : public INetMessageIOStream SvMemoryStream *pMsgBuffer; static INetMessageEncoding GetMsgEncoding ( - const String& rContentType); + const OUString& rContentType); // Not implemented. INetMIMEMessageStream (const INetMIMEMessageStream& rStrm); diff --git a/include/tools/line.hxx b/include/tools/line.hxx index e1b62ffd00f8..eb3f3219aa2e 100644 --- a/include/tools/line.hxx +++ b/include/tools/line.hxx @@ -47,8 +47,8 @@ public: double GetLength() const; - sal_Bool Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const; - sal_Bool Intersection( const Line& rLine, Point& rIntersection ) const; + bool Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const; + bool Intersection( const Line& rLine, Point& rIntersection ) const; double GetDistance( const double& rPtX, const double& rPtY ) const; double GetDistance( const Point& rPoint ) const { return( GetDistance( rPoint.X(), rPoint.Y() ) ); } diff --git a/include/tools/link.hxx b/include/tools/link.hxx index a06e8b9cdc08..279c7b7fed16 100644 --- a/include/tools/link.hxx +++ b/include/tools/link.hxx @@ -96,13 +96,13 @@ public: sal_IntPtr Call( void* pCaller ) const; - sal_Bool IsSet() const; - sal_Bool operator !() const; + bool IsSet() const; + bool operator !() const; - sal_Bool operator==( const Link& rLink ) const; - sal_Bool operator!=( const Link& rLink ) const + bool operator==( const Link& rLink ) const; + bool operator!=( const Link& rLink ) const { return !(Link::operator==( rLink )); } - sal_Bool operator<( const Link& rLink ) const + bool operator<( const Link& rLink ) const { return ((sal_uIntPtr)rLink.pFunc < (sal_uIntPtr)pFunc); } }; @@ -123,20 +123,20 @@ inline sal_IntPtr Link::Call(void *pCaller) const return pFunc ? (*pFunc)(pInst, pCaller) : 0; } -inline sal_Bool Link::IsSet() const +inline bool Link::IsSet() const { if ( pFunc ) - return sal_True; + return true; else - return sal_False; + return false; } -inline sal_Bool Link::operator !() const +inline bool Link::operator !() const { if ( !pFunc ) - return sal_True; + return true; else - return sal_False; + return false; } #endif diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx index 8b5d434130fa..7e3d46325629 100644 --- a/include/tools/multisel.hxx +++ b/include/tools/multisel.hxx @@ -38,13 +38,13 @@ private: sal_uIntPtr nCurSubSel; // index in aSels of current selected index long nCurIndex; // current selected entry sal_uIntPtr nSelCount; // number of selected indexes - sal_Bool bInverseCur;// inverse cursor - sal_Bool bCurValid; // are nCurIndex and nCurSubSel valid - sal_Bool bSelectNew; // auto-select newly inserted indexes + bool bInverseCur;// inverse cursor + bool bCurValid; // are nCurIndex and nCurSubSel valid + bool bSelectNew; // auto-select newly inserted indexes TOOLS_DLLPRIVATE void ImplClear(); TOOLS_DLLPRIVATE size_t ImplFindSubSelection( long nIndex ) const; - TOOLS_DLLPRIVATE sal_Bool ImplMergeSubSelections( size_t nPos1, size_t nPos2 ); + TOOLS_DLLPRIVATE bool ImplMergeSubSelections( size_t nPos1, size_t nPos2 ); TOOLS_DLLPRIVATE long ImplFwdUnselected(); public: @@ -54,17 +54,17 @@ public: ~MultiSelection(); MultiSelection& operator= ( const MultiSelection& rOrig ); - sal_Bool operator== ( MultiSelection& rOrig ); - sal_Bool operator!= ( MultiSelection& rOrig ) + bool operator== ( MultiSelection& rOrig ); + bool operator!= ( MultiSelection& rOrig ) { return !operator==( rOrig ); } - sal_Bool operator !() const + bool operator !() const { return nSelCount == 0; } - void SelectAll( sal_Bool bSelect = sal_True ); - sal_Bool Select( long nIndex, sal_Bool bSelect = sal_True ); - void Select( const Range& rIndexRange, sal_Bool bSelect = sal_True ); - sal_Bool IsSelected( long nIndex ) const; - sal_Bool IsAllSelected() const + void SelectAll( bool bSelect = true ); + bool Select( long nIndex, bool bSelect = true ); + void Select( const Range& rIndexRange, bool bSelect = true ); + bool IsSelected( long nIndex ) const; + bool IsAllSelected() const { return nSelCount == sal_uIntPtr(aTotRange.Len()); } long GetSelectCount() const { return nSelCount; } @@ -73,9 +73,9 @@ public: void Remove( long nIndex ); const Range& GetTotalRange() const { return aTotRange; } - sal_Bool IsCurValid() const { return bCurValid; } + bool IsCurValid() const { return bCurValid; } long GetCurSelected() const { return nCurIndex; } - long FirstSelected( sal_Bool bInverse = sal_False ); + long FirstSelected( bool bInverse = false ); long LastSelected(); long NextSelected(); diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 4229195dc98a..b2d9b7112e2d 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -107,7 +107,7 @@ public: Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEnd, PolyStyle ePolyStyle = POLY_ARC, - sal_Bool bWholeCircle = sal_False ); + bool bWholeCircle = false ); Polygon( const Point& rBezPt1, const Point& rCtrlPt1, const Point& rBezPt2, const Point& rCtrlPt2, sal_uInt16 nPoints = 0 ); @@ -120,9 +120,9 @@ public: void SetFlags( sal_uInt16 nPos, PolyFlags eFlags ); PolyFlags GetFlags( sal_uInt16 nPos ) const; - sal_Bool HasFlags() const; + bool HasFlags() const; - sal_Bool IsRect() const; + bool IsRect() const; void SetSize( sal_uInt16 nNewSize ); sal_uInt16 GetSize() const; @@ -131,10 +131,10 @@ public: Rectangle GetBoundRect() const; double GetSignedArea() const; - sal_Bool IsInside( const Point& rPt ) const; - sal_Bool IsRightOrientated() const; + bool IsInside( const Point& rPt ) const; + bool IsRightOrientated() const; double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ); - void Clip( const Rectangle& rRect, sal_Bool bPolygon = sal_True ); + void Clip( const Rectangle& rRect, bool bPolygon = true ); void Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pData = NULL ); /** Adaptive subdivision of polygons with curves @@ -170,10 +170,10 @@ public: Point& operator[]( sal_uInt16 nPos ); Polygon& operator=( const Polygon& rPoly ); - sal_Bool operator==( const Polygon& rPoly ) const; - sal_Bool operator!=( const Polygon& rPoly ) const + bool operator==( const Polygon& rPoly ) const; + bool operator!=( const Polygon& rPoly ) const { return !(Polygon::operator==( rPoly )); } - sal_Bool IsEqual( const Polygon& rPoly ) const; + bool IsEqual( const Polygon& rPoly ) const; // streaming a Polygon does ignore PolyFlags, so use the Write Or Read // method to take care of PolyFlags @@ -214,7 +214,7 @@ public: void Replace( const Polygon& rPoly, sal_uInt16 nPos ); const Polygon& GetObject( sal_uInt16 nPos ) const; - sal_Bool IsRect() const; + bool IsRect() const; void Clear(); @@ -256,11 +256,11 @@ public: Polygon& operator[]( sal_uInt16 nPos ); PolyPolygon& operator=( const PolyPolygon& rPolyPoly ); - sal_Bool operator==( const PolyPolygon& rPolyPoly ) const; - sal_Bool operator!=( const PolyPolygon& rPolyPoly ) const + bool operator==( const PolyPolygon& rPolyPoly ) const; + bool operator!=( const PolyPolygon& rPolyPoly ) const { return !(PolyPolygon::operator==( rPolyPoly )); } - sal_Bool IsEqual( const PolyPolygon& rPolyPoly ) const; + bool IsEqual( const PolyPolygon& rPolyPoly ) const; TOOLS_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStream, PolyPolygon& rPolyPoly ); TOOLS_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStream, const PolyPolygon& rPolyPoly ); diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx index 6f971ca7014a..bb608a11867b 100644 --- a/include/tools/pstm.hxx +++ b/include/tools/pstm.hxx @@ -202,11 +202,11 @@ class TOOLS_DLLPUBLIC SvPersistStream : public SvStream protected: void WriteObj( sal_uInt8 nHdr, SvPersistBase * pObj ); - sal_uInt32 ReadObj( SvPersistBase * & rpObj, sal_Bool bRegister ); + sal_uInt32 ReadObj( SvPersistBase * & rpObj, bool bRegister ); public: - sal_Bool IsStreamed( SvPersistBase * pObj ) const - { return 0 != GetIndex( pObj ); } + bool IsStreamed( SvPersistBase * pObj ) const + { return 0 != GetIndex( pObj ); } virtual void ResetError(); SvPersistStream( SvClassManager &, SvStream * pStream, diff --git a/include/tools/rc.hxx b/include/tools/rc.hxx index a043db47d4d5..e89b91104849 100644 --- a/include/tools/rc.hxx +++ b/include/tools/rc.hxx @@ -30,8 +30,8 @@ protected: ResMgr* m_pResMgr; // check availability of Resource - sal_Bool IsAvailableRes( const ResId& rId ) const - { return m_pResMgr->IsAvailable( rId, this ); } + bool IsAvailableRes( const ResId& rId ) const + { return m_pResMgr->IsAvailable( rId, this ); } // Load a Resource void GetRes( const ResId& rResId ); diff --git a/include/tools/resid.hxx b/include/tools/resid.hxx index 14c0a11915f7..89606c824658 100644 --- a/include/tools/resid.hxx +++ b/include/tools/resid.hxx @@ -132,7 +132,7 @@ public: return *this; } - const ResId & SetAutoRelease(sal_Bool bRelease) const + const ResId & SetAutoRelease(bool bRelease) const { if( bRelease ) m_nResId &= ~RSC_DONTRELEASE; @@ -141,8 +141,8 @@ public: return *this; } - sal_Bool IsAutoRelease() const - { return !(m_nResId & RSC_DONTRELEASE); } + bool IsAutoRelease() const + { return !(m_nResId & RSC_DONTRELEASE); } sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; } RSHEADER_TYPE* GetpResource() const { return m_pResource; } diff --git a/include/tools/resmgr.hxx b/include/tools/resmgr.hxx index 603a2c7a2eb5..9f6b2d246534 100644 --- a/include/tools/resmgr.hxx +++ b/include/tools/resmgr.hxx @@ -143,11 +143,11 @@ public: void TestStack( const Resource * ); /// Check whether resource is available - sal_Bool IsAvailable( const ResId& rId, + bool IsAvailable( const ResId& rId, const Resource* = NULL) const; /// Search and load resource, given its ID - sal_Bool GetResource( const ResId& rId, const Resource * = NULL ); + bool GetResource( const ResId& rId, const Resource * = NULL ); static void * GetResourceSkipHeader( const ResId& rResId, ResMgr ** ppResMgr ); /// Free resource context void PopContext( const Resource* = NULL ); diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 78a0bc3df96f..3d9f36323920 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -22,7 +22,7 @@ #include <limits> #include "tools/toolsdllapi.h" #include <tools/solar.h> -#include <tools/string.hxx> +#include <tools/lineend.hxx> #include <tools/errinf.hxx> #include <tools/ref.hxx> #include <tools/rtti.hxx> @@ -79,10 +79,6 @@ typedef sal_uInt16 StreamMode; #define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001 #define COMPRESSMODE_NATIVE (sal_uInt16)0x0010 -#define STREAM_IO_DONTKNOW 0 -#define STREAM_IO_READ 1 -#define STREAM_IO_WRITE 2 - #define ID_STREAM 1 #define ID_FILESTREAM 2 #define ID_MEMORYSTREAM 3 @@ -112,8 +108,8 @@ enum SvLockBytesStatFlag { SVSTATFLAG_DEFAULT }; class TOOLS_DLLPUBLIC SvLockBytes: public virtual SvRefBase { SvStream * m_pStream; - sal_Bool m_bOwner; - sal_Bool m_bSync; + bool m_bOwner; + bool m_bSync; protected: void close(); @@ -121,17 +117,17 @@ protected: public: TYPEINFO(); - SvLockBytes() : m_pStream(0), m_bOwner(sal_False), m_bSync(sal_False) {} + SvLockBytes() : m_pStream(0), m_bOwner(false), m_bSync(false) {} - SvLockBytes(SvStream * pTheStream, sal_Bool bTheOwner = sal_False) : - m_pStream(pTheStream), m_bOwner(bTheOwner), m_bSync(sal_False) {} + SvLockBytes(SvStream * pTheStream, bool bTheOwner = false) : + m_pStream(pTheStream), m_bOwner(bTheOwner), m_bSync(false) {} virtual ~SvLockBytes() { close(); } virtual const SvStream * GetStream() const { return m_pStream; } - virtual void SetSynchronMode(sal_Bool bTheSync = sal_True) { m_bSync = bTheSync; } - virtual sal_Bool IsSynchronMode() const { return m_bSync; } + virtual void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; } + virtual bool IsSynchronMode() const { return m_bSync; } virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const; @@ -154,8 +150,8 @@ class TOOLS_DLLPUBLIC SvOpenLockBytes: public SvLockBytes public: TYPEINFO(); - SvOpenLockBytes() : SvLockBytes(0, sal_False) {} - SvOpenLockBytes(SvStream * pStream, sal_Bool bOwner): + SvOpenLockBytes() : SvLockBytes(0, false) {} + SvOpenLockBytes(SvStream * pStream, bool bOwner): SvLockBytes(pStream, bOwner) {} virtual ErrCode FillAppend(const void * pBuffer, sal_Size nCount, @@ -165,7 +161,7 @@ public: virtual sal_Size Seek(sal_Size nPos) = 0; - virtual void Terminate() = 0; + virtual void Terminate() = 0; }; SV_DECL_IMPL_REF(SvOpenLockBytes); @@ -175,13 +171,13 @@ SV_DECL_IMPL_REF(SvOpenLockBytes); class SvAsyncLockBytes: public SvOpenLockBytes { sal_Size m_nSize; - sal_Bool m_bTerminated; + bool m_bTerminated; public: TYPEINFO(); - SvAsyncLockBytes(SvStream * pStream, sal_Bool bOwner): - SvOpenLockBytes(pStream, bOwner), m_nSize(0), m_bTerminated(sal_False) {} + SvAsyncLockBytes(SvStream * pStream, bool bOwner): + SvOpenLockBytes(pStream, bOwner), m_nSize(0), m_bTerminated(false) {} virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const; @@ -195,7 +191,7 @@ public: virtual sal_Size Seek(sal_Size nPos); - virtual void Terminate() { m_bTerminated = sal_True; } + virtual void Terminate() { m_bTerminated = true; } }; SV_DECL_IMPL_REF(SvAsyncLockBytes); @@ -206,32 +202,33 @@ class TOOLS_DLLPUBLIC SvStream { private: // LockBytes Interface - void* pImp; // unused - SvLockBytesRef xLockBytes; // Default implementation - sal_Size nActPos; + void* pImp; // unused + SvLockBytesRef xLockBytes; // Default implementation + sal_Size nActPos; // Puffer-Verwaltung - sal_uInt8* pRWBuf; // Points to read/write buffer - sal_uInt8* pBufPos; // pRWBuf + nBufActualPos - sal_uInt16 nBufSize; // Allocated size of buffer - sal_uInt16 nBufActualLen; // Length of used segment of puffer + sal_uInt8* pRWBuf; // Points to read/write buffer + sal_uInt8* pBufPos; // pRWBuf + nBufActualPos + sal_uInt16 nBufSize; // Allocated size of buffer + sal_uInt16 nBufActualLen; // Length of used segment of puffer // = nBufSize, if EOF did not occur - sal_uInt16 nBufActualPos; // current position in buffer (0..nBufSize-1) - sal_uInt16 nBufFree; // number of free slots in buffer to IO of type eIOMode - unsigned int eIOMode : 2;// STREAM_IO_* + sal_uInt16 nBufActualPos; // current position in buffer (0..nBufSize-1) + sal_uInt16 nBufFree; // number of free slots in buffer to IO of type eIOMode + bool bIoRead; + bool bIoWrite; // Error codes, conversion, compression, ... - int bIsDirty : 1; // sal_True: Stream != buffer content - int bIsConsistent : 1;// sal_False: Buffer contains data, which were + bool bIsDirty; // true: Stream != buffer content + bool bIsConsistent;// false: Buffer contains data, which were // NOT allowed to be written by PutData // into the derived stream (cf. PutBack) - int bSwap : 1; - int bIsEof : 1; - sal_uInt32 nError; - sal_uInt16 nNumberFormatInt; - sal_uInt16 nCompressMode; - LineEnd eLineDelimiter; - CharSet eStreamCharSet; + bool bSwap; + bool bIsEof; + sal_uInt32 nError; + sal_uInt16 nNumberFormatInt; + sal_uInt16 nCompressMode; + LineEnd eLineDelimiter; + rtl_TextEncoding eStreamCharSet; // Encryption OString m_aCryptMaskKey;// aCryptMaskKey.getLength != 0 -> Encryption used @@ -249,7 +246,7 @@ private: protected: sal_Size nBufFilePos;///< File position of pBuf[0] sal_uInt16 eStreamMode; - sal_Bool bIsWritable; + bool bIsWritable; virtual sal_Size GetData( void* pData, sal_Size nSize ); virtual sal_Size PutData( const void* pData, sal_Size nSize ); @@ -262,7 +259,7 @@ protected: // encrypt and write in blocks sal_Size CryptAndWriteBuffer( const void* pStart, sal_Size nLen ); - sal_Bool EncryptBuffer( void* pStart, sal_Size nLen ); + bool EncryptBuffer( void* pStart, sal_Size nLen ); void SyncSvStream( sal_Size nNewStreamPos ); ///< SvStream <- Medium void SyncSysStream(); ///< SvStream -> Medium @@ -274,8 +271,8 @@ public: SvLockBytes* GetLockBytes() const { return xLockBytes; } - sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); } - sal_uInt32 GetErrorCode() const { return nError; } + sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); } + sal_uInt32 GetErrorCode() const { return nError; } void SetError( sal_uInt32 nErrorCode ); virtual void ResetError(); @@ -283,9 +280,9 @@ public: void SetNumberFormatInt( sal_uInt16 nNewFormat ); sal_uInt16 GetNumberFormatInt() const { return nNumberFormatInt; } /// Enable/disable swapping of endians, may be needed for Unicode import/export - inline void SetEndianSwap( sal_Bool bVal ); + inline void SetEndianSwap( bool bVal ); /// returns status of endian swap flag - sal_Bool IsEndianSwap() const { return 0 != bSwap; } + bool IsEndianSwap() const { return 0 != bSwap; } void SetCompressMode( sal_uInt16 nNewMode ) { nCompressMode = nNewMode; } @@ -294,9 +291,9 @@ public: void SetCryptMaskKey(const OString& rCryptMaskKey); const OString& GetCryptMaskKey() const { return m_aCryptMaskKey; } - void SetStreamCharSet( CharSet eCharSet ) + void SetStreamCharSet( rtl_TextEncoding eCharSet ) { eStreamCharSet = eCharSet; } - CharSet GetStreamCharSet() const { return eStreamCharSet; } + rtl_TextEncoding GetStreamCharSet() const { return eStreamCharSet; } void SetLineDelimiter( LineEnd eLineEnd ) { eLineDelimiter = eLineEnd; } @@ -324,7 +321,7 @@ public: SvStream& operator<<( sal_Int64 nInt64 ); SvStream& operator<<( bool b ) - { return operator<<(static_cast< sal_Bool >(b)); } + { return operator<<(static_cast< sal_Bool >(b)); } SvStream& operator<<( signed char nChar ); SvStream& operator<<( char nChar ); SvStream& operator<<( unsigned char nChar ); @@ -345,9 +342,9 @@ public: // length between current (Tell()) pos and end of stream virtual sal_Size remainingSize(); void Flush(); - sal_Bool IsEof() const { return bIsEof; } + bool IsEof() const { return bIsEof; } // next Tell() <= nSize - sal_Bool SetStreamSize( sal_Size nSize ); + bool SetStreamSize( sal_Size nSize ); /** Read a line of bytes. @@ -363,8 +360,8 @@ public: @endcode causing endless loops ... */ - sal_Bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE ); - sal_Bool WriteLine( const OString& rStr ); + bool ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE ); + bool WriteLine( const OString& rStr ); /** Read a line of bytes. @@ -380,13 +377,12 @@ public: @endcode causing endless loops ... */ - sal_Bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, + bool ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxBytesToRead = 0xFFFE ); - sal_Bool ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet ); - sal_Bool WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ); + bool WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDestCharSet ); /// Switch to no endian swapping and write 0xfeff - sal_Bool StartWritingUnicodeText(); + bool StartWritingUnicodeText(); /** If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb @@ -397,7 +393,7 @@ public: If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a BOM of that encoding and switch endian swapping if UTF-16 and 0xfffe. */ - sal_Bool StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ); + bool StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ); /** Read a line of Unicode. @@ -413,11 +409,11 @@ public: @endcode causing endless loops ... */ - sal_Bool ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead = 0xFFFE ); + bool ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead = 0xFFFE ); /** Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet */ - OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet); + OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet); /** Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes */ @@ -438,13 +434,13 @@ public: @endcode causing endless loops ... */ - sal_Bool ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, + bool ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxCodepointsToRead = 0xFFFE ); /** Write a sequence of Unicode characters if eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of Bytecodes converted to eDestCharSet */ - sal_Bool WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUnicodeOrByteText( const String& rStr ) + bool WriteUnicodeOrByteText( const OUString& rStr, rtl_TextEncoding eDestCharSet ); + bool WriteUnicodeOrByteText( const OUString& rStr ) { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); } /** Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, @@ -452,19 +448,19 @@ public: This may result in more than one byte being written if a multi byte encoding (e.g. UTF7, UTF8) is chosen. */ - sal_Bool WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet ); - sal_Bool WriteUniOrByteChar( sal_Unicode ch ) + bool WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet ); + bool WriteUniOrByteChar( sal_Unicode ch ) { return WriteUniOrByteChar( ch, GetStreamCharSet() ); } void SetBufferSize( sal_uInt16 nBufSize ); - sal_uInt16 GetBufferSize() const { return nBufSize; } + sal_uInt16 GetBufferSize() const { return nBufSize; } void RefreshBuffer(); SvStream& PutBack( char aCh ); - sal_Bool IsWritable() const { return bIsWritable; } + bool IsWritable() const { return bIsWritable; } StreamMode GetStreamMode() const { return eStreamMode; } - virtual sal_uInt16 IsA() const; + virtual sal_uInt16 IsA() const; long GetVersion() { return nVersion; } void SetVersion( long n ) { nVersion = n; } @@ -472,10 +468,10 @@ public: friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips /// end of input seen during previous i/o operation - bool eof() const { return bIsEof; } + bool eof() const { return bIsEof; } /// stream is broken - bool bad() const { return GetError() != 0; } + bool bad() const { return GetError() != 0; } /** Get state @@ -499,7 +495,7 @@ inline SvStream& operator<<( SvStream& rStr, SvStrPtr f ) return rStr; } -inline void SvStream::SetEndianSwap( sal_Bool bVal ) +inline void SvStream::SetEndianSwap( bool bVal ) { #ifdef OSL_BIGENDIAN SetNumberFormatInt( bVal ? NUMBERFORMAT_INT_LITTLEENDIAN : NUMBERFORMAT_INT_BIGENDIAN ); @@ -579,8 +575,9 @@ namespace streamdetail /// Attempt to write a pascal-style length (of type prefix) prefixed sequence /// of 16bit units from an OUString, returned value is number of bytes written /// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm, - const OUString &rStr) +template<typename prefix> +sal_Size write_lenPrefixed_uInt16s_FromOUString(SvStream& rStrm, + const OUString &rStr) { return streamdetail::write_lenPrefixed_seq_From_str<prefix, OUString, write_uInt16s_FromOUString>(rStrm, rStr); } @@ -611,7 +608,7 @@ OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) /// 8bit units to an OUString template<typename prefix> OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, - rtl_TextEncoding eEnc) + rtl_TextEncoding eEnc) { return OStringToOUString(read_lenPrefixed_uInt8s_ToOString<prefix>(rStrm), eEnc); } @@ -619,7 +616,7 @@ OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, /// Attempt to write a prefixed sequence of nUnits 8bit units from an OString, /// returned value is number of bytes written TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr, - sal_Size nUnits) + sal_Size nUnits) { return rStrm.Write(rStr.getStr(), nUnits); } @@ -632,8 +629,9 @@ TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const /// Attempt to write a pascal-style length (of type prefix) prefixed sequence /// of 8bit units from an OString, returned value is number of bytes written /// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm, - const OString &rStr) +template<typename prefix> +sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm, + const OString &rStr) { return streamdetail::write_lenPrefixed_seq_From_str<prefix, OString, write_uInt8s_FromOString>(rStrm, rStr); } @@ -641,8 +639,10 @@ template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream /// Attempt to write a pascal-style length (of type prefix) prefixed sequence /// of 8bit units from an OUString, returned value is number of bytes written /// (including byte-count of prefix) -template<typename prefix> sal_Size write_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, - const OUString &rStr, rtl_TextEncoding eEnc) +template<typename prefix> +sal_Size write_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, + const OUString &rStr, + rtl_TextEncoding eEnc) { return write_lenPrefixed_uInt8s_FromOString<prefix>(rStrm, OUStringToOString(rStr, eEnc)); } @@ -653,9 +653,9 @@ class TOOLS_DLLPUBLIC SvFileStream : public SvStream { private: StreamData* pInstanceData; - String aFilename; + OUString aFilename; sal_uInt16 nLockCounter; - sal_Bool bIsOpen; + bool bIsOpen; #ifdef UNX sal_uInt32 GetFileHandle() const; #endif @@ -663,10 +663,10 @@ private: SvFileStream (const SvFileStream&); SvFileStream & operator= (const SvFileStream&); - sal_Bool LockRange( sal_Size nByteOffset, sal_Size nBytes ); - sal_Bool UnlockRange( sal_Size nByteOffset, sal_Size nBytes ); - sal_Bool LockFile(); - sal_Bool UnlockFile(); + bool LockRange( sal_Size nByteOffset, sal_Size nBytes ); + bool UnlockRange( sal_Size nByteOffset, sal_Size nBytes ); + bool LockFile(); + bool UnlockFile(); protected: virtual sal_Size GetData( void* pData, sal_Size nSize ); @@ -677,19 +677,19 @@ protected: public: // Switches to Read StreamMode on failed attempt of Write opening - SvFileStream( const String& rFileName, StreamMode eOpenMode ); + SvFileStream( const OUString& rFileName, StreamMode eOpenMode ); SvFileStream(); ~SvFileStream(); virtual void ResetError(); - void Open( const String& rFileName, StreamMode eOpenMode ); + void Open( const OUString& rFileName, StreamMode eOpenMode ); void Close(); - sal_Bool IsOpen() const { return bIsOpen; } - sal_Bool IsLocked() const { return ( nLockCounter!=0 ); } + bool IsOpen() const { return bIsOpen; } + bool IsLocked() const { return ( nLockCounter!=0 ); } virtual sal_uInt16 IsA() const; - const String& GetFileName() const { return aFilename; } + const OUString& GetFileName() const { return aFilename; } }; // MemoryStream @@ -709,7 +709,7 @@ protected: sal_Size nPos; sal_Size nEndOfData; sal_uInt8* pBuf; - sal_Bool bOwnsData; + bool bOwnsData; virtual sal_Size GetData( void* pData, sal_Size nSize ); virtual sal_Size PutData( const void* pData, sal_Size nSize ); @@ -719,7 +719,7 @@ protected: /// AllocateMemory must update pBuf accordingly /// - pBuf: Address of new block - virtual sal_Bool AllocateMemory( sal_Size nSize ); + virtual bool AllocateMemory( sal_Size nSize ); /// ReAllocateMemory must update the following variables: /// - pBuf: Address of new block @@ -727,7 +727,7 @@ protected: /// Set to 0 , if new block size is 0 bytes /// - nSize: New block size /// - nPos: Set to 0 if position outside of block - virtual sal_Bool ReAllocateMemory( long nDiff ); + virtual bool ReAllocateMemory( long nDiff ); /// Is called when this stream allocated the buffer or the buffer is /// resized. FreeMemory may need to NULLify handles in derived classes. @@ -749,10 +749,10 @@ public: void* SwitchBuffer( sal_Size nInitSize=512, sal_Size nResize=64 ); void* SetBuffer( void* pBuf, sal_Size nSize, - sal_Bool bOwnsData=sal_True, sal_Size nEOF=0 ); + bool bOwnsData=true, sal_Size nEOF=0 ); - void ObjectOwnsMemory( sal_Bool bOwn ) { bOwnsData = bOwn; } - sal_Bool IsObjectMemoryOwner() { return bOwnsData; } + void ObjectOwnsMemory( bool bOwn ) { bOwnsData = bOwn; } + bool IsObjectMemoryOwner() { return bOwnsData; } void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; } sal_Size GetResizeOffset() const { return nResize; } virtual sal_Size remainingSize() { return GetSize() - Tell(); } diff --git a/include/tools/svborder.hxx b/include/tools/svborder.hxx index de4a8666cbd8..0fc87a9b7f0f 100644 --- a/include/tools/svborder.hxx +++ b/include/tools/svborder.hxx @@ -44,12 +44,12 @@ public: nRight = nRightP; nBottom = nBottomP; } - sal_Bool operator == ( const SvBorder & rObj ) const + bool operator == ( const SvBorder & rObj ) const { return nTop == rObj.nTop && nRight == rObj.nRight && nBottom == rObj.nBottom && nLeft == rObj.nLeft; } - sal_Bool operator != ( const SvBorder & rObj ) const + bool operator != ( const SvBorder & rObj ) const { return !(*this == rObj); } SvBorder & operator = ( const SvBorder & rBorder ) { @@ -75,7 +75,7 @@ public: Bottom() -= rBorder.Bottom(); return *this; } - sal_Bool IsInside( const SvBorder & rInside ) + bool IsInside( const SvBorder & rInside ) { return nTop >= rInside.nTop && nRight >= rInside.nRight && nBottom >= rInside.nBottom && nLeft >= rInside.nLeft; diff --git a/include/tools/tempfile.hxx b/include/tools/tempfile.hxx index 8ef8c574cf7c..8d43c18a6df9 100644 --- a/include/tools/tempfile.hxx +++ b/include/tools/tempfile.hxx @@ -19,14 +19,14 @@ #ifndef _TOOLS_TEMPFILE_HXX #define _TOOLS_TEMPFILE_HXX -#include <tools/string.hxx> +#include <rtl/ustring.hxx> #include "tools/toolsdllapi.h" struct TempFile_Impl; class TOOLS_DLLPUBLIC TempFile { TempFile_Impl* pImp; - sal_Bool bKillingFileEnabled; + bool bKillingFileEnabled; public: /** Create a temporary file in the default tempfile folder. */ @@ -40,25 +40,25 @@ public: The extension string may be f.e. ".txt" or "", if no extension string is given, ".tmp" is used. */ - TempFile( const String& rLeadingChars, const String* pExtension=NULL ); + TempFile( const OUString& rLeadingChars, const OUString* pExtension=NULL ); /** TempFile will be removed from disk in dtor if EnableKillingTempFile was called before. TempDirs will be removed recursively in that case. */ ~TempFile(); - sal_Bool IsValid() const; + bool IsValid() const; /** Returns the real name of the tempfile in file URL scheme. */ - String GetName() const; + OUString GetName() const; /** If enabled the file will be removed from disk when the dtor is called (default is not enabled) */ - void EnableKillingFile( sal_Bool bEnable=sal_True ) { bKillingFileEnabled = bEnable; } + void EnableKillingFile( bool bEnable=true ) { bKillingFileEnabled = bEnable; } - sal_Bool IsKillingFileEnabled() const { return bKillingFileEnabled; } + bool IsKillingFileEnabled() const { return bKillingFileEnabled; } /** Only create a name for a temporary file that would be valid at that moment. */ - static String CreateTempName(); + static OUString CreateTempName(); }; #endif diff --git a/include/tools/time.hxx b/include/tools/time.hxx index 64751af42284..31a8f94d23b9 100644 --- a/include/tools/time.hxx +++ b/include/tools/time.hxx @@ -98,22 +98,22 @@ public: /// 12 hours == 0.5 days double GetTimeInDays() const; - sal_Bool IsBetween( const Time& rFrom, const Time& rTo ) const + bool IsBetween( const Time& rFrom, const Time& rTo ) const { return ((nTime >= rFrom.nTime) && (nTime <= rTo.nTime)); } - sal_Bool IsEqualIgnoreNanoSec( const Time& rTime ) const; + bool IsEqualIgnoreNanoSec( const Time& rTime ) const; - sal_Bool operator ==( const Time& rTime ) const + bool operator ==( const Time& rTime ) const { return (nTime == rTime.nTime); } - sal_Bool operator !=( const Time& rTime ) const + bool operator !=( const Time& rTime ) const { return (nTime != rTime.nTime); } - sal_Bool operator >( const Time& rTime ) const + bool operator >( const Time& rTime ) const { return (nTime > rTime.nTime); } - sal_Bool operator <( const Time& rTime ) const + bool operator <( const Time& rTime ) const { return (nTime < rTime.nTime); } - sal_Bool operator >=( const Time& rTime ) const + bool operator >=( const Time& rTime ) const { return (nTime >= rTime.nTime); } - sal_Bool operator <=( const Time& rTime ) const + bool operator <=( const Time& rTime ) const { return (nTime <= rTime.nTime); } static Time GetUTCOffset(); diff --git a/include/tools/vcompat.hxx b/include/tools/vcompat.hxx index cb3c29701e36..0f97b583bb5c 100644 --- a/include/tools/vcompat.hxx +++ b/include/tools/vcompat.hxx @@ -41,7 +41,7 @@ class TOOLS_DLLPUBLIC VersionCompat VersionCompat() {} VersionCompat( const VersionCompat& ) {} VersionCompat& operator=( const VersionCompat& ) { return *this; } - sal_Bool operator==( const VersionCompat& ) { return sal_False; } + bool operator==( const VersionCompat& ) { return false; } public: diff --git a/include/tools/vector2d.hxx b/include/tools/vector2d.hxx index d3d1c5c0c805..bd4795cb0319 100644 --- a/include/tools/vector2d.hxx +++ b/include/tools/vector2d.hxx @@ -75,8 +75,8 @@ public: inline Vector2D& operator/=(double t) { mfX /= t; mfY /= t; return *this; } inline Vector2D operator/(double t) const { Vector2D aNew(*this); aNew /= t; return aNew; } - inline sal_Bool operator==( const Vector2D& rVec ) const { return( mfX == rVec.mfX && mfY == rVec.mfY ); } - inline sal_Bool operator!=( const Vector2D& rVec ) const { return !( *this == rVec ); } + inline bool operator==( const Vector2D& rVec ) const { return( mfX == rVec.mfX && mfY == rVec.mfY ); } + inline bool operator!=( const Vector2D& rVec ) const { return !( *this == rVec ); } inline Vector2D& operator=( const Vector2D& rVec ) { mfX = rVec.mfX, mfY = rVec.mfY; return *this; } inline Vector2D& operator=( const Pair& rPair ) { mfX = rPair.A(), mfY = rPair.B(); return *this; } @@ -85,11 +85,11 @@ public: inline Vector2D& operator*=( const Pair& rPair ) { mfX *= rPair.A(), mfY *= rPair.B(); return *this; } inline Vector2D& operator/=( const Pair& rPair ) { mfX /= rPair.A(), mfY /= rPair.B(); return *this; } - inline sal_Bool operator==( const Pair& rPair ) const { return( mfX == rPair.A() && mfY == rPair.B() ); } - inline sal_Bool operator!=( const Pair& rPair ) const { return !( *this == rPair ); } + inline bool operator==( const Pair& rPair ) const { return( mfX == rPair.A() && mfY == rPair.B() ); } + inline bool operator!=( const Pair& rPair ) const { return !( *this == rPair ); } - inline sal_Bool IsPositive( Vector2D& rVec ) const { return( ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0 ); } - inline sal_Bool IsNegative( Vector2D& rVec ) const { return !IsPositive( rVec ); } + inline bool IsPositive( Vector2D& rVec ) const { return( ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0 ); } + inline bool IsNegative( Vector2D& rVec ) const { return !IsPositive( rVec ); } }; inline Vector2D& Vector2D::Normalize() diff --git a/include/tools/weakbase.h b/include/tools/weakbase.h index a4ce1d0962e8..d37a3fd98ce3 100644 --- a/include/tools/weakbase.h +++ b/include/tools/weakbase.h @@ -95,19 +95,19 @@ public: inline reference_type * operator->() const; /** returns true if this instance references pReferenceObject */ - inline sal_Bool operator== (const reference_type * pReferenceObject) const; + inline bool operator== (const reference_type * pReferenceObject) const; /** returns true if this instance and the given weakref reference the same object */ - inline sal_Bool operator== (const WeakReference<reference_type> & handle) const; + inline bool operator== (const WeakReference<reference_type> & handle) const; /** only needed for using this class with stl containers */ - inline sal_Bool operator!= (const WeakReference<reference_type> & handle) const; + inline bool operator!= (const WeakReference<reference_type> & handle) const; /** only needed for using this class with stl containers */ - inline sal_Bool operator< (const WeakReference<reference_type> & handle) const; + inline bool operator< (const WeakReference<reference_type> & handle) const; /** only needed for using this class with stl containers */ - inline sal_Bool operator> (const WeakReference<reference_type> & handle) const; + inline bool operator> (const WeakReference<reference_type> & handle) const; /** the assignment operator */ inline WeakReference<reference_type>& operator= (const WeakReference<reference_type> & handle); diff --git a/include/tools/weakbase.hxx b/include/tools/weakbase.hxx index 08e85e17d69b..05498e50a8fc 100644 --- a/include/tools/weakbase.hxx +++ b/include/tools/weakbase.hxx @@ -91,31 +91,31 @@ inline reference_type * WeakReference< reference_type >::operator->() const } template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const +inline bool WeakReference< reference_type >::operator==(const reference_type * pReferenceObject) const { return mpWeakConnection->mpReference == pReferenceObject; } template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator==(const WeakReference<reference_type> & handle) const +inline bool WeakReference< reference_type >::operator==(const WeakReference<reference_type> & handle) const { return mpWeakConnection == handle.mpWeakConnection; } template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator!=(const WeakReference<reference_type> & handle) const +inline bool WeakReference< reference_type >::operator!=(const WeakReference<reference_type> & handle) const { return mpWeakConnection != handle.mpWeakConnection; } template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator<(const WeakReference<reference_type> & handle) const +inline bool WeakReference< reference_type >::operator<(const WeakReference<reference_type> & handle) const { return mpWeakConnection->mpReference < handle.mpWeakConnection->mpReference; } template< class reference_type > -inline sal_Bool WeakReference< reference_type >::operator>(const WeakReference<reference_type> & handle) const +inline bool WeakReference< reference_type >::operator>(const WeakReference<reference_type> & handle) const { return mpWeakConnection->mpReference > handle.mpWeakConnection->mpReference; } diff --git a/include/tools/wldcrd.hxx b/include/tools/wldcrd.hxx index 8991b8882474..9b143b7ae91b 100644 --- a/include/tools/wldcrd.hxx +++ b/include/tools/wldcrd.hxx @@ -20,8 +20,8 @@ #define _WLDCRD_HXX #include "tools/toolsdllapi.h" -#include <tools/string.hxx> #include <osl/thread.h> +#include <rtl/ustring.hxx> class TOOLS_DLLPUBLIC WildCard { @@ -54,7 +54,7 @@ public: aWildString = OUStringToOString(rString, osl_getThreadTextEncoding()); } - sal_Bool Matches( const String& rStr ) const; + bool Matches( const OUString& rStr ) const; }; #endif diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx index 185cb1d9ecb0..b8b86fea2aa1 100644 --- a/include/tools/zcodec.hxx +++ b/include/tools/zcodec.hxx @@ -56,8 +56,8 @@ class TOOLS_DLLPUBLIC ZCodec { private: sal_uIntPtr mbInit; - sal_Bool mbStatus; - sal_Bool mbFinish; + bool mbStatus; + bool mbFinish; sal_uIntPtr mnMemUsage; SvStream* mpIStm; sal_uInt8* mpInBuf; @@ -71,7 +71,7 @@ private: sal_uIntPtr mnCompressMethod; void* mpsC_Stream; - void ImplInitBuf( sal_Bool nIOFlag ); + void ImplInitBuf( bool nIOFlag ); void ImplWriteBack( void ); public: @@ -81,7 +81,7 @@ public: virtual void BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ); virtual long EndCompression(); - sal_Bool IsFinished () const { return mbFinish; } + bool IsFinished () const { return mbFinish; } long Compress( SvStream& rIStm, SvStream& rOStm ); long Decompress( SvStream& rIStm, SvStream& rOStm ); diff --git a/include/unotools/ucblockbytes.hxx b/include/unotools/ucblockbytes.hxx index cf5d98b93583..acd79928e3a8 100644 --- a/include/unotools/ucblockbytes.hxx +++ b/include/unotools/ucblockbytes.hxx @@ -32,6 +32,7 @@ #include <tools/link.hxx> #include <tools/errcode.hxx> #include <tools/datetime.hxx> +#include <tools/string.hxx> namespace com { @@ -130,7 +131,7 @@ public: static UcbLockBytesRef CreateLockBytes( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xContent ); // SvLockBytes - virtual void SetSynchronMode (sal_Bool bSynchron); + virtual void SetSynchronMode (bool bSynchron); virtual ErrCode ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const; virtual ErrCode WriteAt ( sal_uLong, const void*, sal_uLong, sal_uLong *pWritten); virtual ErrCode Flush (void) const; diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx index 380298b500b8..efc9c0930a01 100644 --- a/include/vcl/gfxlink.hxx +++ b/include/vcl/gfxlink.hxx @@ -23,6 +23,7 @@ #include <vcl/dllapi.h> #include <tools/solar.h> #include <vcl/mapmod.hxx> +#include <tools/string.hxx> #include <tools/stream.hxx> // ------------- diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index 45835f0de6f8..529acc3a9fbf 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -57,10 +57,9 @@ * @file * For LWP filter architecture prototype - cell layouts */ -/************************************************************************* - * Change History - April 2005 Created - ************************************************************************/ + +#include <tools/string.hxx> + #include "lwpcelllayout.hxx" #include "lwpfoundry.hxx" #include "lwpobjfactory.hxx" diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx index 9d978b9b6c35..b01bf7b7ef90 100644 --- a/lotuswordpro/source/filter/lwpdrawobj.cxx +++ b/lotuswordpro/source/filter/lwpdrawobj.cxx @@ -58,6 +58,7 @@ * Implementation file of LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange * and so on. */ +#include <osl/thread.h> #include "lwpglobalmgr.hxx" #include "lwpdrawobj.hxx" #include "lwptools.hxx" diff --git a/lotuswordpro/source/filter/lwptblcell.hxx b/lotuswordpro/source/filter/lwptblcell.hxx index 1ae5b67c7def..bde674e9ea31 100644 --- a/lotuswordpro/source/filter/lwptblcell.hxx +++ b/lotuswordpro/source/filter/lwptblcell.hxx @@ -64,6 +64,8 @@ #ifndef _LWPLAYOUTNUMERICSOVERRIDE_HXX_ #define _LWPLAYOUTNUMERICSOVERRIDE_HXX_ +#include <tools/string.hxx> + #include "lwpobj.hxx" #include "lwpatomholder.hxx" #include "lwpstory.hxx" diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx index 78f606e67c2c..8f02c29bcebd 100644 --- a/sd/source/filter/eppt/pptexsoundcollection.cxx +++ b/sd/source/filter/eppt/pptexsoundcollection.cxx @@ -20,6 +20,7 @@ #include <pptexsoundcollection.hxx> #include "epptdef.hxx" #include <tools/urlobj.hxx> +#include <tools/string.hxx> #include <ucbhelper/content.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/proptypehlp.hxx> @@ -56,9 +57,11 @@ OUString ExSoundEntry::ImplGetName() const OUString ExSoundEntry::ImplGetExtension() const { INetURLObject aTmp( aSoundURL ); - String aExtension( aTmp.GetExtension() ); - if ( aExtension.Len() ) - aExtension.Insert( (sal_Unicode)'.', 0 ); + OUString aExtension( aTmp.GetExtension() ); + if ( !aExtension.isEmpty() ) + { + aExtension = "." + aExtension; + } return aExtension; } diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 5d636b532170..3bbbf63522ef 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -3283,7 +3283,7 @@ HtmlErrorContext::HtmlErrorContext(Window *_pWin) // ===================================================================== -sal_Bool HtmlErrorContext::GetString( sal_uLong, OUString& rCtxStr ) +bool HtmlErrorContext::GetString( sal_uLong, OUString& rCtxStr ) { DBG_ASSERT( mnResId != 0, "No error context set" ); if( mnResId == 0 ) diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index 4bffc1e1718d..248a461e654a 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -70,7 +70,7 @@ public: HtmlErrorContext(Window *pWin=0); ~HtmlErrorContext() {}; - virtual sal_Bool GetString( sal_uLong nErrId, OUString& rCtxStr ); + virtual bool GetString( sal_uLong nErrId, OUString& rCtxStr ); void SetContext( sal_uInt16 nResId, const String& rURL ); void SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 ); diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index b69d2602d356..5c49251a4128 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <tools/string.hxx> #include <sot/object.hxx> #include <sot/factory.hxx> diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 5d5bfefe1616..f42f952b0cac 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -49,6 +49,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <tools/string.hxx> #include <tools/urlobj.hxx> #include <unotools/ucbhelper.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -479,7 +480,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( else { // TODO: test whether it really works for http and fwp - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( String(aFileURL.GetMainURL( INetURLObject::NO_DECODE )), STREAM_STD_WRITE ); if ( pStream ) { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index e6a9eff4184a..b64901d3cc31 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -164,7 +164,7 @@ SfxErrorHandler::~SfxErrorHandler() //------------------------------------------------------------------------- -sal_Bool SfxErrorHandler::CreateString( +bool SfxErrorHandler::CreateString( const ErrorInfo *pErr, OUString &rStr, sal_uInt16& nFlags) const /* [Beschreibung] @@ -176,14 +176,14 @@ sal_Bool SfxErrorHandler::CreateString( { sal_uLong nErrCode = pErr->GetErrorCode() & ERRCODE_ERROR_MASK; if( nErrCode>=lEnd || nErrCode<=lStart ) - return sal_False; + return false; MessageInfo *pMsgInfo=PTR_CAST(MessageInfo,pErr); if(pMsgInfo) { if(GetMessageString(nErrCode, rStr, nFlags)) { rStr = rStr.replaceAll("$(ARG1)", pMsgInfo->GetMessageArg()); - return sal_True; + return true; } } else if(GetErrorString(nErrCode, rStr, nFlags)) @@ -204,9 +204,9 @@ sal_Bool SfxErrorHandler::CreateString( rStr = rStr.replaceAll("$(ARG2)", pTwoStringInfo->GetArg2()); } } - return sal_True; + return true; } - return sal_False; + return false; } //------------------------------------------------------------------------- @@ -393,7 +393,7 @@ SfxErrorContext::SfxErrorContext( //------------------------------------------------------------------------- -sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr) +bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr) /* [Beschreibung] diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 3db7ac0b1625..d1ba6397687e 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -409,17 +409,17 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( String sTempMiddle(sQuote); sTempMiddle += sal_Unicode(9); - String sLine; - sal_Bool bRead = pStream->ReadByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ); + OUString sLine; + bool bRead = pStream->ReadByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ); if(bRead) { //header line - xub_StrLen nHeaders = comphelper::string::getTokenCount(sLine, '\t'); + sal_Int32 nHeaders = comphelper::string::getTokenCount(sLine, '\t'); sal_Int32 nIndex = 0; - for( xub_StrLen nToken = 0; nToken < nHeaders; ++nToken) + for( sal_Int32 nToken = 0; nToken < nHeaders; ++nToken) { - String sHeader = sLine.GetToken( 0, '\t', nIndex ); + String sHeader = sLine.getToken( 0, '\t', nIndex ); OSL_ENSURE(sHeader.Len() > 2 && sHeader.GetChar(0) == '\"' && sHeader.GetChar(sHeader.Len() - 1) == '\"', "Wrong format of header"); @@ -433,11 +433,11 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( { ::std::vector<OUString> aNewData; //analyze data line - xub_StrLen nDataCount = comphelper::string::getTokenCount(sLine, '\t'); + sal_Int32 nDataCount = comphelper::string::getTokenCount(sLine, '\t'); sal_Int32 nIndex = 0; - for( xub_StrLen nToken = 0; nToken < nDataCount; ++nToken) + for( sal_Int32 nToken = 0; nToken < nDataCount; ++nToken) { - String sData = sLine.GetToken( 0, '\t', nIndex ); + String sData = sLine.getToken( 0, '\t', nIndex ); OSL_ENSURE(sData.Len() >= 2 && sData.GetChar(0) == '\"' && sData.GetChar(sData.Len() - 1) == '\"', "Wrong format of line"); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index c5a4d3dae8c8..c2db5e7e91ca 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -4104,32 +4104,32 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) rtl_TextEncoding eTEnc = osl_getThreadTextEncoding(); while( !rInStr.GetError() && !rInStr.IsEof() ) { - String sLine; + OUString sLine; rInStr.ReadByteStringLine( sLine, eTEnc ); // # -> comment // ; -> delimiter between entries -> // Format: TextToSearchFor;AlternativeString;PrimaryKey;SecondaryKey // Leading and trailing blanks are ignored - if( sLine.Len() ) + if( !sLine.isEmpty() ) { //comments are contained in separate lines but are put into the struct of the following data //line (if available) - if( '#' != sLine.GetChar(0) ) + if( '#' != sLine[0] ) { if( !pToInsert ) pToInsert = new AutoMarkEntry; sal_Int32 nSttPos = 0; - pToInsert->sSearch = sLine.GetToken(0, ';', nSttPos ); - pToInsert->sAlternative = sLine.GetToken(0, ';', nSttPos ); - pToInsert->sPrimKey = sLine.GetToken(0, ';', nSttPos ); - pToInsert->sSecKey = sLine.GetToken(0, ';', nSttPos ); + pToInsert->sSearch = sLine.getToken(0, ';', nSttPos ); + pToInsert->sAlternative = sLine.getToken(0, ';', nSttPos ); + pToInsert->sPrimKey = sLine.getToken(0, ';', nSttPos ); + pToInsert->sSecKey = sLine.getToken(0, ';', nSttPos ); - String sStr = sLine.GetToken(0, ';', nSttPos ); + String sStr = sLine.getToken(0, ';', nSttPos ); pToInsert->bCase = sStr.Len() && !comphelper::string::equals(sStr, '0'); - sStr = sLine.GetToken(0, ';', nSttPos ); + sStr = sLine.getToken(0, ';', nSttPos ); pToInsert->bWord = sStr.Len() && !comphelper::string::equals(sStr, '0'); aEntryArr.push_back( pToInsert ); diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index ec5142bc188b..21fffaf1f680 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -754,7 +754,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( OUString( FILTER_XML ), SwDocShell::Factory().GetFilterContainer() ); - String aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); + OUString aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); TempFile aTempFile( OUString("SwMM"), &aExtension ); aTmpFileName = aTempFile.GetName(); diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 9f05dcc2b3e4..93f1096dfc95 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -35,12 +35,12 @@ public: class SAL_WARN_UNUSED ImplPolygon : public ImplPolygonData { public: - ImplPolygon( sal_uInt16 nInitSize, sal_Bool bFlags = sal_False ); + ImplPolygon( sal_uInt16 nInitSize, bool bFlags = false ); ImplPolygon( sal_uInt16 nPoints, const Point* pPtAry, const sal_uInt8* pInitFlags = NULL ); ImplPolygon( const ImplPolygon& rImplPoly ); ~ImplPolygon(); - void ImplSetSize( sal_uInt16 nSize, sal_Bool bResize = sal_True ); + void ImplSetSize( sal_uInt16 nSize, bool bResize = true ); void ImplCreateFlagArray(); void ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL ); }; diff --git a/tools/qa/cppunit/test_inetmime.cxx b/tools/qa/cppunit/test_inetmime.cxx index 5770ff31ba15..ee165750ca5a 100644 --- a/tools/qa/cppunit/test_inetmime.cxx +++ b/tools/qa/cppunit/test_inetmime.cxx @@ -18,6 +18,7 @@ */ #include <sal/types.h> +#include <rtl/ustring.hxx> #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index 3474f4465f8f..e6f410893162 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -219,7 +219,7 @@ namespace SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, STREAM_READ); OString aFoo; - sal_Bool bRet; + bool bRet; bRet = aMemStream.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index 1bf612730bb0..3056bf89947b 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -19,48 +19,48 @@ #include <tools/datetime.hxx> #include <rtl/math.hxx> -sal_Bool DateTime::IsBetween( const DateTime& rFrom, const DateTime& rTo ) const +bool DateTime::IsBetween( const DateTime& rFrom, const DateTime& rTo ) const { if ( (*this >= rFrom) && (*this <= rTo) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool DateTime::operator >( const DateTime& rDateTime ) const +bool DateTime::operator >( const DateTime& rDateTime ) const { if ( (Date::operator>( rDateTime )) || (Date::operator==( rDateTime ) && Time::operator>( rDateTime )) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool DateTime::operator <( const DateTime& rDateTime ) const +bool DateTime::operator <( const DateTime& rDateTime ) const { if ( (Date::operator<( rDateTime )) || (Date::operator==( rDateTime ) && Time::operator<( rDateTime )) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool DateTime::operator >=( const DateTime& rDateTime ) const +bool DateTime::operator >=( const DateTime& rDateTime ) const { if ( (Date::operator>( rDateTime )) || (Date::operator==( rDateTime ) && Time::operator>=( rDateTime )) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool DateTime::operator <=( const DateTime& rDateTime ) const +bool DateTime::operator <=( const DateTime& rDateTime ) const { if ( (Date::operator<( rDateTime )) || (Date::operator==( rDateTime ) && Time::operator<=( rDateTime )) ) - return sal_True; + return true; else - return sal_False; + return false; } long DateTime::GetSecFromDateTime( const Date& rDate ) const diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index a07ee4e9ae31..11f1917c9e8a 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -37,7 +37,7 @@ static sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, #define MAX_DAYS 3636532 -inline sal_Bool ImpIsLeapYear( sal_uInt16 nYear ) +inline bool ImpIsLeapYear( sal_uInt16 nYear ) { return ( ( ((nYear % 4) == 0) && ((nYear % 100) != 0) ) || ( (nYear % 400) == 0 ) ); @@ -87,7 +87,7 @@ static void DaysToDate( long nDays, { long nTempDays; long i = 0; - sal_Bool bCalc; + bool bCalc; do { @@ -95,11 +95,11 @@ static void DaysToDate( long nDays, rYear = (sal_uInt16)((nTempDays / 365) - i); nTempDays -= ((sal_uIntPtr)rYear-1) * 365; nTempDays -= ((rYear-1) / 4) - ((rYear-1) / 100) + ((rYear-1) / 400); - bCalc = sal_False; + bCalc = false; if ( nTempDays < 1 ) { i++; - bCalc = sal_True; + bCalc = true; } else { @@ -108,7 +108,7 @@ static void DaysToDate( long nDays, if ( (nTempDays != 366) || !ImpIsLeapYear( rYear ) ) { i--; - bCalc = sal_True; + bCalc = true; } } } @@ -293,33 +293,33 @@ sal_uInt16 Date::GetDaysInMonth() const return ImplDaysInMonth( nMonth, nYear ); } -sal_Bool Date::IsLeapYear() const +bool Date::IsLeapYear() const { sal_uInt16 nYear = GetYear(); return ImpIsLeapYear( nYear ); } -sal_Bool Date::IsValidAndGregorian() const +bool Date::IsValidAndGregorian() const { sal_uInt16 nDay = GetDay(); sal_uInt16 nMonth = GetMonth(); sal_uInt16 nYear = GetYear(); if ( !nMonth || (nMonth > 12) ) - return sal_False; + return false; if ( !nDay || (nDay > ImplDaysInMonth( nMonth, nYear )) ) - return sal_False; + return false; else if ( nYear <= 1582 ) { if ( nYear < 1582 ) - return sal_False; + return false; else if ( nMonth < 10 ) - return sal_False; + return false; else if ( (nMonth == 10) && (nDay < 15) ) - return sal_False; + return false; } - return sal_True; + return true; } bool Date::IsValidDate() const diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 8b27d1ffa72d..bf25206c0fbc 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -325,7 +325,7 @@ Time operator -( const Time& rTime1, const Time& rTime2 ) TimeToNanoSec( rTime2 ) ); } -sal_Bool Time::IsEqualIgnoreNanoSec( const Time& rTime ) const +bool Time::IsEqualIgnoreNanoSec( const Time& rTime ) const { sal_Int32 n1 = (nTime < 0 ? -static_cast<sal_Int32>(GetNanoSec()) : GetNanoSec() ); sal_Int32 n2 = (rTime.nTime < 0 ? -static_cast<sal_Int32>(rTime.GetNanoSec()) : rTime.GetNanoSec() ); diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 49da3089805f..70230cebee52 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -70,10 +70,10 @@ public: ~PointerList(); void Add( const void* p ); - sal_Bool Remove( const void* p ); + bool Remove( const void* p ); const void* Get( sal_uIntPtr nPos ) const; - sal_Bool IsIn( const void* p ) const; + bool IsIn( const void* p ) const; sal_uIntPtr Count() const { return nCount; } }; @@ -100,7 +100,7 @@ struct XtorType sal_uIntPtr nMaxCount; sal_uIntPtr nStatics; sal_Char aName[DBG_MAXNAME+1]; - sal_Bool bTest; + bool bTest; PointerList aThisList; }; @@ -122,7 +122,7 @@ struct DebugData bool bOslIsHooked; DebugData() - :bInit( sal_False ) + :bInit( false ) ,pDbgPrintMsgBox( NULL ) ,pDbgPrintWindow( NULL ) ,pDbgPrintTestTool( NULL ) @@ -134,7 +134,7 @@ struct DebugData ,bOslIsHooked( false ) { aDbgData.nTestFlags = DBG_TEST_RESOURCE; - aDbgData.bOverwrite = sal_True; + aDbgData.bOverwrite = true; aDbgData.nTraceOut = DBG_OUT_NULL; aDbgData.nWarningOut = DBG_OUT_NULL; #ifdef UNX @@ -142,7 +142,7 @@ struct DebugData #else aDbgData.nErrorOut = DBG_OUT_MSGBOX; #endif - aDbgData.bHookOSLAssert = sal_True; + aDbgData.bHookOSLAssert = true; aDbgData.aDebugName[0] = 0; aDbgData.aInclFilter[0] = 0; aDbgData.aExclFilter[0] = 0; @@ -159,20 +159,20 @@ struct DebugData static DebugData aDebugData; static sal_Char aCurPath[260]; -static int bDbgImplInMain = sal_False; +static int bDbgImplInMain = false; #if defined( WNT ) static CRITICAL_SECTION aImplCritDbgSection; #endif -static sal_Bool bImplCritDbgSectionInit = sal_False; +static bool bImplCritDbgSectionInit = false; void ImplDbgInitLock() { #if defined( WNT ) InitializeCriticalSection( &aImplCritDbgSection ); #endif - bImplCritDbgSectionInit = sal_True; + bImplCritDbgSectionInit = true; } void ImplDbgDeInitLock() @@ -180,7 +180,7 @@ void ImplDbgDeInitLock() #if defined( WNT ) DeleteCriticalSection( &aImplCritDbgSection ); #endif - bImplCritDbgSectionInit = sal_False; + bImplCritDbgSectionInit = false; } void ImplDbgLock() @@ -205,7 +205,7 @@ void ImplDbgUnlock() #define FILE_LINEEND "\n" -static sal_Bool ImplActivateDebugger( const sal_Char* pMsg ) +static bool ImplActivateDebugger( const sal_Char* pMsg ) { #if defined( WNT ) static sal_Char aImplDbgOutBuf[DBG_BUF_MAXLEN]; @@ -213,14 +213,14 @@ static sal_Bool ImplActivateDebugger( const sal_Char* pMsg ) strcat( aImplDbgOutBuf, "\r\n" ); OutputDebugString( aImplDbgOutBuf ); DebugBreak(); - return sal_True; + return true; #else (void) pMsg; // avoid warning about unused parameter - return sal_False; + return false; #endif } -static sal_Bool ImplCoreDump() +static bool ImplCoreDump() { #if defined( WNT ) DebugBreak(); @@ -228,7 +228,7 @@ static sal_Bool ImplCoreDump() long* pTemp = 0; *pTemp = 0xCCCC; #endif - return sal_True; + return true; } static sal_uIntPtr ImplGetPerfTime() @@ -376,7 +376,7 @@ namespace sal_Char aBuf[2]; size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) ); if ( nValueLen ) - *_out_pnValue = strcmp( aBuf, "1" ) == 0 ? sal_True : sal_False; + *_out_pnValue = strcmp( aBuf, "1" ) == 0 ? true : false; } void lcl_matchOutputChannel( sal_Char const * i_buffer, sal_uIntPtr* o_value ) @@ -466,10 +466,10 @@ void PointerList::Add( const void* p ) nCount++; } -sal_Bool PointerList::Remove( const void* p ) +bool PointerList::Remove( const void* p ) { if ( !p ) - return sal_False; + return false; PBlock* pBlock = pFirst; while ( pBlock ) @@ -496,7 +496,7 @@ sal_Bool PointerList::Remove( const void* p ) delete pBlock; } - return sal_True; + return true; } i++; } @@ -504,7 +504,7 @@ sal_Bool PointerList::Remove( const void* p ) pBlock = pBlock->pNext; } - return sal_False; + return false; } const void* PointerList::Get( sal_uIntPtr nPos ) const @@ -535,10 +535,10 @@ const void* PointerList::Get( sal_uIntPtr nPos ) const return NULL; } -sal_Bool PointerList::IsIn( const void* p ) const +bool PointerList::IsIn( const void* p ) const { if ( !p ) - return sal_False; + return false; PBlock* pBlock = pFirst; while ( pBlock ) @@ -547,14 +547,14 @@ sal_Bool PointerList::IsIn( const void* p ) const while ( i < PBLOCKCOUNT ) { if ( ((sal_uIntPtr)p) == ((sal_uIntPtr)pBlock->aData[i]) ) - return sal_True; + return true; i++; } pBlock = pBlock->pNext; } - return sal_False; + return false; } static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) @@ -598,7 +598,7 @@ static DebugData* GetDebugData() { if ( !aDebugData.bInit ) { - aDebugData.bInit = sal_True; + aDebugData.bInit = true; // set default debug names DbgGetLogFileName( aDebugData.aDbgData.aDebugName ); @@ -701,7 +701,7 @@ inline DebugData* ImplGetDebugData() static FILETYPE ImplDbgInitFile() { - static sal_Bool bFileInit = sal_False; + static bool bFileInit = false; sal_Char aBuf[4096]; sal_Char* getcwdResult = getcwd( aBuf, sizeof( aBuf ) ); @@ -721,7 +721,7 @@ static FILETYPE ImplDbgInitFile() if ( !bFileInit ) { - bFileInit = sal_True; + bFileInit = true; if ( pData->aDbgData.bOverwrite ) pDebugFile = FileOpen( pData->aDbgData.aDebugName, "w" ); @@ -798,7 +798,7 @@ static int ImplDbgFilter( const sal_Char* pFilter, const sal_Char* pMsg, if ( pTok[nTok] == ';' ) { if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) ) - return sal_True; + return true; pTok += nTok+1; nTok = 0; @@ -808,9 +808,9 @@ static int ImplDbgFilter( const sal_Char* pFilter, const sal_Char* pMsg, } if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) ) - return sal_True; + return true; else - return sal_False; + return false; } extern "C" @@ -821,7 +821,7 @@ void SAL_CALL dbg_printOslDebugMessage( const sal_Char * pszFileName, sal_Int32 static void DebugInit() { - bDbgImplInMain = sal_True; + bDbgImplInMain = true; ImplDbgInitLock(); DebugData* pData = GetDebugData(); @@ -842,7 +842,7 @@ static void DebugDeInit() if( pData->bOslIsHooked ) { osl_setDetailedDebugMessageFunc( pData->pOldDebugMessageFunc ); - pData->bOslIsHooked = sal_False; + pData->bOslIsHooked = false; } // Output statistics trace data to file @@ -890,7 +890,7 @@ static void DebugDeInit() pData->pXtorList = NULL; } - // Set everything to sal_False, as global variables + // Set everything to false, as global variables // may cause a system crash otherwise. // Maintain memory flags, as otherwise new/delete calls // for global variables will crash, @@ -998,14 +998,14 @@ static void DebugXTorInfo( sal_Char* pBuf ) } } -sal_Bool ImplDbgFilterMessage( const sal_Char* pMsg ) +bool ImplDbgFilterMessage( const sal_Char* pMsg ) { DebugData* pData = GetDebugData(); - if ( !ImplDbgFilter( pData->aDbgData.aInclFilter, pMsg, sal_True ) ) - return sal_True; - if ( ImplDbgFilter( pData->aDbgData.aExclFilter, pMsg, sal_False ) ) - return sal_True; - return sal_False; + if ( !ImplDbgFilter( pData->aDbgData.aInclFilter, pMsg, true ) ) + return true; + if ( ImplDbgFilter( pData->aDbgData.aExclFilter, pMsg, false ) ) + return true; + return false; } void* DbgFunc( sal_uInt16 nAction, void* pParam ) @@ -1129,12 +1129,12 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) if( pDebugData->bOslIsHooked && ! pData->bHookOSLAssert ) { osl_setDetailedDebugMessageFunc( pDebugData->pOldDebugMessageFunc ); - pDebugData->bOslIsHooked = sal_False; + pDebugData->bOslIsHooked = false; } else if( ! pDebugData->bOslIsHooked && pData->bHookOSLAssert ) { pDebugData->pOldDebugMessageFunc = osl_setDetailedDebugMessageFunc( &dbg_printOslDebugMessage ); - pDebugData->bOslIsHooked = sal_True; + pDebugData->bOslIsHooked = true; } } break; @@ -1261,13 +1261,13 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, pXtorData->nDtorCalls = 0; pXtorData->nMaxCount = 0; pXtorData->nStatics = 0; - pXtorData->bTest = sal_True; + pXtorData->bTest = true; pData->pXtorList->Add( (void*)pXtorData ); - if ( !ImplDbgFilter( pData->aDbgData.aInclClassFilter, pXtorData->aName, sal_True ) ) - pXtorData->bTest = sal_False; - if ( ImplDbgFilter( pData->aDbgData.aExclClassFilter, pXtorData->aName, sal_False ) ) - pXtorData->bTest = sal_False; + if ( !ImplDbgFilter( pData->aDbgData.aInclClassFilter, pXtorData->aName, true ) ) + pXtorData->bTest = false; + if ( ImplDbgFilter( pData->aDbgData.aExclClassFilter, pXtorData->aName, false ) ) + pXtorData->bTest = false; } if ( !pXtorData->bTest ) return; @@ -1396,10 +1396,10 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sal_uInt16 nLine ) { - static sal_Bool bIn = sal_False; + static bool bIn = false; if ( bIn ) return; - bIn = sal_True; + bIn = true; DebugData* pData = GetDebugData(); sal_Char const * pStr; @@ -1424,13 +1424,13 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa if ( nOut == DBG_OUT_NULL ) { - bIn = sal_False; + bIn = false; return; } if ( ImplDbgFilterMessage( pMsg ) ) { - bIn = sal_False; + bIn = false; return; } @@ -1539,7 +1539,7 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa ImplDbgUnlock(); - bIn = sal_False; + bIn = false; } void DbgPrintShell(char const * message) { diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx index 1aaac1863681..bfc1a0df5e43 100644 --- a/tools/source/fsys/tempfile.cxx +++ b/tools/source/fsys/tempfile.cxx @@ -19,7 +19,6 @@ #include <tools/tempfile.hxx> -#include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <osl/file.hxx> #include <rtl/instance.hxx> @@ -34,7 +33,7 @@ namespace { struct TempNameBase_Impl : public rtl::Static< OUString, TempNameBas struct TempFile_Impl { - String aName; + OUString aName; }; OUString ConstructTempDir_Impl() @@ -52,16 +51,16 @@ OUString ConstructTempDir_Impl() return aName; } -void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True ) +void CreateTempName_Impl( OUString& rName, bool bKeep, bool bDir = true ) { // add a suitable tempname // Prefix can have 5 chars, leaving 3 for numbers. 26 ** 3 == 17576 // ER 13.07.00 why not radix 36 [0-9A-Z] ?!? const unsigned nRadix = 26; - String aName( rName ); - aName += OUString("sv"); + OUString aName( rName ); + aName += "sv"; - rName.Erase(); + rName = ""; static unsigned long u = Time::GetSystemTicks(); for ( unsigned long nOld = u; ++u != nOld; ) { @@ -107,38 +106,38 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru } } -String TempFile::CreateTempName() +OUString TempFile::CreateTempName() { // get correct directory - String aName = ConstructTempDir_Impl(); + OUString aName = ConstructTempDir_Impl(); // get TempFile name with default naming scheme - CreateTempName_Impl( aName, sal_False ); + CreateTempName_Impl( aName, false ); return aName; } TempFile::TempFile() : pImp( new TempFile_Impl ) - , bKillingFileEnabled( sal_False ) + , bKillingFileEnabled( false ) { // get correct directory pImp->aName = ConstructTempDir_Impl(); // get TempFile with default naming scheme - CreateTempName_Impl( pImp->aName, sal_True, false ); + CreateTempName_Impl( pImp->aName, true, false ); } -TempFile::TempFile( const String& rLeadingChars, const String* pExtension ) +TempFile::TempFile( const OUString& rLeadingChars, const OUString* pExtension ) : pImp( new TempFile_Impl ) - , bKillingFileEnabled( sal_False ) + , bKillingFileEnabled( false ) { // get correct directory - String aName = ConstructTempDir_Impl(); + OUString aName = ConstructTempDir_Impl(); // now use special naming scheme ( name takes leading chars and an index counting up from zero aName += rLeadingChars; - for ( sal_Int32 i=0;; i++ ) + for ( sal_Int32 i=0; ; i++ ) { OUStringBuffer aTmpBuffer(aName); aTmpBuffer.append(i); @@ -172,7 +171,7 @@ TempFile::~TempFile() delete pImp; } -String TempFile::GetName() const +OUString TempFile::GetName() const { OUString aTmp; aTmp = pImp->aName; diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index a38c66eda085..e7311eab38c2 100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -86,7 +86,7 @@ sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const return ( *pStr == '\0' ) && ( *pWild == '\0' ); } -sal_Bool WildCard::Matches( const String& rString ) const +bool WildCard::Matches( const OUString& rString ) const { OString aTmpWild = aWildString; OString aString(OUStringToOString(rString, osl_getThreadTextEncoding())); @@ -99,15 +99,15 @@ sal_Bool WildCard::Matches( const String& rString ) const { // Check all splitted wildcards if ( ImpMatch( aTmpWild.copy( 0, nSepPos ).getStr(), aString.getStr() ) ) - return sal_True; + return true; aTmpWild = aTmpWild.copy(nSepPos + 1); // remove separator } } if ( ImpMatch( aTmpWild.getStr(), aString.getStr() ) ) - return sal_True; + return true; else - return sal_False; + return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index ce4ce26d64c1..dc247990718d 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -149,11 +149,11 @@ void B3dTransformationSet::Reset() maViewportRectangle = Rectangle(-1, -1, 2, 2); maVisibleRectangle = maViewportRectangle; - mbPerspective = sal_True; + mbPerspective = true; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbProjectionValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; CalcViewport(); } @@ -171,9 +171,9 @@ void B3dTransformationSet::SetOrientation( basegfx::B3DPoint aVRP, basegfx::B3DV maOrientation.identity(); Orientation(maOrientation, aVRP, aVPN, aVUP); - mbInvTransObjectToEyeValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbInvTransObjectToEyeValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; PostSetOrientation(); } @@ -206,8 +206,8 @@ void B3dTransformationSet::PostSetProjection() maInvProjection.invert(); // invalidate dependent matrices - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; } /// Transformations for viewport @@ -309,7 +309,7 @@ void B3dTransformationSet::CalcViewport() } // Set to true to guarantee loop termination - mbProjectionValid = sal_True; + mbProjectionValid = true; // set new projection SetProjection(aNewProjection); @@ -334,14 +334,14 @@ void B3dTransformationSet::SetRatio(double fNew) if(mfRatio != fNew) { mfRatio = fNew; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbProjectionValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; } } void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT, - sal_Bool bBroadCastChange) + bool bBroadCastChange) { if(fL != mfLeftBound || fR != mfRightBound || fB != mfBottomBound || fT != mfTopBound) { @@ -350,9 +350,9 @@ void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, d mfBottomBound = fB; mfTopBound = fT; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbProjectionValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; // Broadcast changes if(bBroadCastChange) @@ -364,14 +364,14 @@ void B3dTransformationSet::DeviceRectangleChange() { } -void B3dTransformationSet::SetPerspective(sal_Bool bNew) +void B3dTransformationSet::SetPerspective(bool bNew) { if(mbPerspective != bNew) { mbPerspective = bNew; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbProjectionValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; } } @@ -382,9 +382,9 @@ void B3dTransformationSet::SetViewportRectangle(Rectangle& rRect, Rectangle& rVi maViewportRectangle = rRect; maVisibleRectangle = rVisible; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; + mbProjectionValid = false; + mbObjectToDeviceValid = false; + mbWorldToViewValid = false; } } @@ -449,7 +449,7 @@ void B3dViewport::CalcOrientation() B3dCamera::B3dCamera( const basegfx::B3DPoint& rPos, const basegfx::B3DVector& rLkAt, - double fFocLen, double fBnkAng, sal_Bool bUseFocLen) + double fFocLen, double fBnkAng, bool bUseFocLen) : B3dViewport(), aPosition(rPos), aCorrectedPosition(rPos), @@ -508,17 +508,17 @@ void B3dCamera::CalcNewViewportValues() } } -sal_Bool B3dCamera::CalcFocalLength() +bool B3dCamera::CalcFocalLength() { double fWidth = GetDeviceRectangleWidth(); - sal_Bool bRetval = sal_False; + bool bRetval = false; if(bUseFocalLength) { // Update position if focal length changes aCorrectedPosition = basegfx::B3DPoint(0.0, 0.0, fFocalLength * fWidth / 35.0); aCorrectedPosition = EyeToWorldCoor(aCorrectedPosition); - bRetval = sal_True; + bRetval = true; } else { diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 7104fe2e8657..0c95ae6a29e5 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -19,9 +19,10 @@ #include <math.h> +#include <rtl/ustrbuf.hxx> #include <tools/tools.h> #include <tools/bigint.hxx> -#include <tools/string.hxx> + #include <string.h> #include <ctype.h> @@ -137,12 +138,12 @@ void BigInt::Div( sal_uInt16 nDiv, sal_uInt16& rRem ) nLen -= 1; } -sal_Bool BigInt::IsLess( const BigInt& rVal ) const +bool BigInt::IsLess( const BigInt& rVal ) const { if ( rVal.nLen < nLen) - return sal_True; + return true; if ( rVal.nLen > nLen ) - return sal_False; + return false; int i; for ( i = nLen - 1; i > 0 && nNum[i] == rVal.nNum[i]; i-- ) @@ -441,7 +442,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const rErg.Div( nMult, nQ ); } -sal_Bool BigInt::ABS_IsLess( const BigInt& rB ) const +bool BigInt::ABS_IsLess( const BigInt& rB ) const { if (bIsBig || rB.bIsBig) { @@ -490,11 +491,11 @@ BigInt::BigInt( const OUString& rString ) bIsBig = sal_False; nVal = 0; - sal_Bool bNeg = sal_False; + bool bNeg = false; const sal_Unicode* p = rString.getStr(); if ( *p == '-' ) { - bNeg = sal_True; + bNeg = true; p++; } while( *p >= '0' && *p <= '9' ) @@ -504,7 +505,7 @@ BigInt::BigInt( const OUString& rString ) p++; } if ( bIsBig ) - bIsNeg = bNeg; + bIsNeg = bNeg ? sal_True : sal_False; else if( bNeg ) nVal = -nVal; } @@ -608,43 +609,45 @@ BigInt::operator double() const OUString BigInt::GetString() const { - String aString; if ( !bIsBig ) - aString = OUString::number( nVal ); + { + return OUString::number( nVal ); + } else { BigInt aTmp( *this ); BigInt a1000000000( 1000000000L ); aTmp.Abs(); - + OUStringBuffer sBuff(30); do { BigInt a = aTmp; a %= a1000000000; aTmp /= a1000000000; - - String aStr = aString; if ( a.nVal < 100000000L ) - { // leading 0s - aString = OUString::number( a.nVal + 1000000000L ); - aString.Erase(0,1); + { + // to get leading 0s + OUString aStr(OUString::number( a.nVal + 1000000000L )); + sBuff.insert(0, aStr.getStr() + 1); } else - aString = OUString::number( a.nVal ); - aString += aStr; + { + sBuff.insert(0, OUString::number( a.nVal )); + } } while( aTmp.bIsBig ); - String aStr = aString; if ( bIsNeg ) - aString = OUString::number( -aTmp.nVal ); + { + sBuff.insert(0, OUString::number( -aTmp.nVal )); + } else - aString = OUString::number( aTmp.nVal ); - aString += aStr; + { + sBuff.insert(0, OUString::number( aTmp.nVal )); + } + return sBuff.makeStringAndClear(); } - - return aString; } BigInt& BigInt::operator=( const BigInt& rBigInt ) @@ -838,7 +841,7 @@ BigInt& BigInt::operator%=( const BigInt& rVal ) return *this; } -sal_Bool operator==( const BigInt& rVal1, const BigInt& rVal2 ) +bool operator==( const BigInt& rVal1, const BigInt& rVal2 ) { if ( rVal1.bIsBig || rVal2.bIsBig ) { @@ -856,14 +859,14 @@ sal_Bool operator==( const BigInt& rVal1, const BigInt& rVal2 ) return nA.nNum[i] == nB.nNum[i]; } - return sal_False; + return false; } - return sal_False; + return false; } return rVal1.nVal == rVal2.nVal; } -sal_Bool operator<( const BigInt& rVal1, const BigInt& rVal2 ) +bool operator<( const BigInt& rVal1, const BigInt& rVal2 ) { if ( rVal1.bIsBig || rVal2.bIsBig ) { @@ -894,7 +897,7 @@ sal_Bool operator<( const BigInt& rVal1, const BigInt& rVal2 ) return rVal1.nVal < rVal2.nVal; } -sal_Bool operator >(const BigInt& rVal1, const BigInt& rVal2 ) +bool operator >(const BigInt& rVal1, const BigInt& rVal2 ) { if ( rVal1.bIsBig || rVal2.bIsBig ) { diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index a6a8084147c5..871c4d10b68c 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -100,12 +100,12 @@ void Color::Invert() SetBlue( ~COLORDATA_BLUE( mnColor ) ); } -sal_Bool Color::IsDark() const +bool Color::IsDark() const { return GetLuminance() <= 60; } -sal_Bool Color::IsBright() const +bool Color::IsBright() const { return GetLuminance() >= 245; } @@ -212,7 +212,7 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) return RGB_COLORDATA( cR, cG, cB ); } -SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat ) +SvStream& Color::Read( SvStream& rIStm, bool bNewFormat ) { if ( bNewFormat ) rIStm >> mnColor; @@ -222,7 +222,7 @@ SvStream& Color::Read( SvStream& rIStm, sal_Bool bNewFormat ) return rIStm; } -SvStream& Color::Write( SvStream& rOStm, sal_Bool bNewFormat ) +SvStream& Color::Write( SvStream& rOStm, bool bNewFormat ) { if ( bNewFormat ) rOStm << mnColor; diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 317fe1da8b42..1a179752e9c0 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -37,42 +37,45 @@ struct ImplKeyData { ImplKeyData* mpNext; - OString maKey; - OString maValue; - sal_Bool mbIsComment; + OString maKey; + OString maValue; + bool mbIsComment; }; struct ImplGroupData { ImplGroupData* mpNext; ImplKeyData* mpFirstKey; - OString maGroupName; - sal_uInt16 mnEmptyLines; + OString maGroupName; + sal_uInt16 mnEmptyLines; }; struct ImplConfigData { ImplGroupData* mpFirstGroup; - OUString maFileName; - sal_uIntPtr mnDataUpdateId; - sal_uIntPtr mnTimeStamp; + OUString maFileName; + sal_uIntPtr mnDataUpdateId; + sal_uIntPtr mnTimeStamp; LineEnd meLineEnd; - sal_uInt16 mnRefCount; - sal_Bool mbModified; - sal_Bool mbRead; - sal_Bool mbIsUTF8BOM; + sal_uInt16 mnRefCount; + bool mbModified; + bool mbRead; + bool mbIsUTF8BOM; }; -static String toUncPath( const String& rPath ) +static OUString toUncPath( const OUString& rPath ) { OUString aFileURL; // check if rFileName is already a URL; if not make it so - if( rPath.CompareToAscii( "file://", 7 ) == COMPARE_EQUAL ) + if( rPath.startsWith( "file://")) + { aFileURL = rPath; + } else if( ::osl::FileBase::getFileURLFromSystemPath( rPath, aFileURL ) != ::osl::FileBase::E_None ) + { aFileURL = rPath; - + } return aFileURL; } @@ -92,7 +95,7 @@ static sal_uIntPtr ImplSysGetConfigTimeStamp( const OUString& rFileName ) } static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, - sal_uInt64& rRead, sal_Bool& rbRead, sal_Bool& rbIsUTF8BOM, sal_uIntPtr& rTimeStamp ) + sal_uInt64& rRead, bool& rbRead, bool& rbIsUTF8BOM, sal_uIntPtr& rTimeStamp ) { sal_uInt8* pBuf = NULL; ::osl::File aFile( rFileName ); @@ -116,11 +119,11 @@ static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, { nRead -= 3; memmove(pBuf, pBuf + 3, sal::static_int_cast<sal_Size>(nRead * sizeof(sal_uInt8)) ); - rbIsUTF8BOM = sal_True; + rbIsUTF8BOM = true; } rTimeStamp = ImplSysGetConfigTimeStamp( rFileName ); - rbRead = sal_True; + rbRead = true; rRead = nRead; } else @@ -135,11 +138,11 @@ static sal_uInt8* ImplSysReadConfig( const OUString& rFileName, return pBuf; } -static sal_Bool ImplSysWriteConfig( const OUString& rFileName, - const sal_uInt8* pBuf, sal_uIntPtr nBufLen, sal_Bool rbIsUTF8BOM, sal_uIntPtr& rTimeStamp ) +static bool ImplSysWriteConfig( const OUString& rFileName, + const sal_uInt8* pBuf, sal_uIntPtr nBufLen, bool rbIsUTF8BOM, sal_uIntPtr& rTimeStamp ) { - sal_Bool bSuccess = sal_False; - sal_Bool bUTF8BOMSuccess = sal_False; + bool bSuccess = false; + bool bUTF8BOMSuccess = false; ::osl::File aFile( rFileName ); ::osl::FileBase::RC eError = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); @@ -158,13 +161,13 @@ static sal_Bool ImplSysWriteConfig( const OUString& rFileName, sal_uInt64 nUTF8BOMWritten; if( aFile.write( BOM, 3, nUTF8BOMWritten ) == ::osl::FileBase::E_None && 3 == nUTF8BOMWritten ) { - bUTF8BOMSuccess = sal_True; + bUTF8BOMSuccess = true; } } if( aFile.write( pBuf, nBufLen, nWritten ) == ::osl::FileBase::E_None && nWritten == nBufLen ) { - bSuccess = sal_True; + bSuccess = true; } if ( rbIsUTF8BOM ? bSuccess && bUTF8BOMSuccess : bSuccess ) { @@ -297,7 +300,7 @@ static void ImplMakeConfigList( ImplConfigData* pData, while ( pGroup->mnEmptyLines ) { pKey = new ImplKeyData; - pKey->mbIsComment = sal_True; + pKey->mbIsComment = true; pPrevKey->mpNext = pKey; pPrevKey = pKey; pGroup->mnEmptyLines--; @@ -315,11 +318,11 @@ static void ImplMakeConfigList( ImplConfigData* pData, if ( pLine[0] == ';' ) { pKey->maValue = makeOString(pLine, nLineLen); - pKey->mbIsComment = sal_True; + pKey->mbIsComment = true; } else { - pKey->mbIsComment = sal_False; + pKey->mbIsComment = false; nNameLen = 0; while ( (nNameLen < nLineLen) && (pLine[nNameLen] != '=') ) nNameLen++; @@ -516,8 +519,8 @@ static void ImplReadConfig( ImplConfigData* pData ) { sal_uIntPtr nTimeStamp = 0; sal_uInt64 nRead = 0; - sal_Bool bRead = sal_False; - sal_Bool bIsUTF8BOM =sal_False; + bool bRead = false; + bool bIsUTF8BOM = false; sal_uInt8* pBuf = ImplSysReadConfig( pData->maFileName, nRead, bRead, bIsUTF8BOM, nTimeStamp ); // Read config list from buffer @@ -527,11 +530,11 @@ static void ImplReadConfig( ImplConfigData* pData ) delete[] pBuf; } pData->mnTimeStamp = nTimeStamp; - pData->mbModified = sal_False; + pData->mbModified = false; if ( bRead ) - pData->mbRead = sal_True; + pData->mbRead = true; if ( bIsUTF8BOM ) - pData->mbIsUTF8BOM = sal_True; + pData->mbIsUTF8BOM = true; } static void ImplWriteConfig( ImplConfigData* pData ) @@ -545,11 +548,11 @@ static void ImplWriteConfig( ImplConfigData* pData ) if ( pBuf ) { if ( ImplSysWriteConfig( pData->maFileName, pBuf, nBufLen, pData->mbIsUTF8BOM, pData->mnTimeStamp ) ) - pData->mbModified = sal_False; + pData->mbModified = false; delete[] pBuf; } else - pData->mbModified = sal_False; + pData->mbModified = false; } static void ImplDeleteConfigData( ImplConfigData* pData ) @@ -589,8 +592,8 @@ static ImplConfigData* ImplGetConfigData( const OUString& rFileName ) pData->mnDataUpdateId = 0; pData->meLineEnd = LINEEND_CRLF; pData->mnRefCount = 0; - pData->mbRead = sal_False; - pData->mbIsUTF8BOM = sal_False; + pData->mbRead = false; + pData->mbIsUTF8BOM = false; ImplReadConfig( pData ); return pData; @@ -602,7 +605,7 @@ static void ImplFreeConfigData( ImplConfigData* pDelData ) delete pDelData; } -sal_Bool Config::ImplUpdateConfig() const +bool Config::ImplUpdateConfig() const { // Re-read file if timestamp differs if ( mpData->mnTimeStamp != ImplSysGetConfigTimeStamp( maFileName ) ) @@ -610,10 +613,10 @@ sal_Bool Config::ImplUpdateConfig() const ImplDeleteConfigData( mpData ); ImplReadConfig( mpData ); mpData->mnDataUpdateId++; - return sal_True; + return true; } else - return sal_False; + return false; } ImplGroupData* Config::ImplGetGroup() const @@ -661,7 +664,7 @@ Config::Config( const OUString& rFileName ) mpActGroup = NULL; mnDataUpdateId = 0; mnLockCount = 1; - mbPersistence = sal_True; + mbPersistence = true; #ifdef DBG_UTIL OStringBuffer aTraceStr("Config::Config( "); @@ -697,7 +700,7 @@ void Config::DeleteGroup(const OString& rGroup) if ( !mnLockCount || !mpData->mbRead ) { ImplUpdateConfig(); - mpData->mbRead = sal_True; + mpData->mbRead = true; } ImplGroupData* pPrevGroup = NULL; @@ -735,7 +738,7 @@ void Config::DeleteGroup(const OString& rGroup) ImplWriteConfig( mpData ); else { - mpData->mbModified = sal_True; + mpData->mbModified = true; } mnDataUpdateId = mpData->mnDataUpdateId; @@ -784,20 +787,20 @@ sal_uInt16 Config::GetGroupCount() const return nGroupCount; } -sal_Bool Config::HasGroup(const OString& rGroup) const +bool Config::HasGroup(const OString& rGroup) const { // Update config data if necessary if ( !mnLockCount ) ImplUpdateConfig(); ImplGroupData* pGroup = mpData->mpFirstGroup; - sal_Bool bRet = sal_False; + bool bRet = false; while( pGroup ) { if( pGroup->maGroupName.equalsIgnoreAsciiCase(rGroup) ) { - bRet = sal_True; + bRet = true; break; } @@ -870,7 +873,7 @@ void Config::WriteKey(const OString& rKey, const OString& rStr) if ( !mnLockCount || !mpData->mbRead ) { ImplUpdateConfig(); - mpData->mbRead = sal_True; + mpData->mbRead = true; } // Search key and update value if found @@ -888,18 +891,18 @@ void Config::WriteKey(const OString& rKey, const OString& rStr) pKey = pKey->mpNext; } - sal_Bool bNewValue; + bool bNewValue; if ( !pKey ) { pKey = new ImplKeyData; pKey->mpNext = NULL; pKey->maKey = rKey; - pKey->mbIsComment = sal_False; + pKey->mbIsComment = false; if ( pPrevKey ) pPrevKey->mpNext = pKey; else pGroup->mpFirstKey = pKey; - bNewValue = sal_True; + bNewValue = true; } else bNewValue = pKey->maValue != rStr; @@ -912,7 +915,7 @@ void Config::WriteKey(const OString& rKey, const OString& rStr) ImplWriteConfig( mpData ); else { - mpData->mbModified = sal_True; + mpData->mbModified = true; } } } @@ -924,7 +927,7 @@ void Config::DeleteKey(const OString& rKey) if ( !mnLockCount || !mpData->mbRead ) { ImplUpdateConfig(); - mpData->mbRead = sal_True; + mpData->mbRead = true; } // Search key and update value @@ -956,7 +959,7 @@ void Config::DeleteKey(const OString& rKey) ImplWriteConfig( mpData ); else { - mpData->mbModified = sal_True; + mpData->mbModified = true; } } } diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index cad06a76e72f..6c13f05d87b8 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -18,8 +18,10 @@ */ #include <limits.h> +#include <rtl/ustring.hxx> #include <tools/debug.hxx> #include <tools/fract.hxx> +#include <tools/lineend.hxx> #include <tools/stream.hxx> #include <tools/bigint.hxx> diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index d7d7ff0403e8..b011a90e3578 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -126,44 +126,44 @@ void Rectangle::Justify() } } -sal_Bool Rectangle::IsInside( const Point& rPoint ) const +bool Rectangle::IsInside( const Point& rPoint ) const { if ( IsEmpty() ) - return sal_False; + return false; - sal_Bool bRet = sal_True; + bool bRet = true; if ( nLeft <= nRight ) { if ( (rPoint.X() < nLeft) || (rPoint.X() > nRight) ) - bRet = sal_False; + bRet = false; } else { if ( (rPoint.X() > nLeft) || (rPoint.X() < nRight) ) - bRet = sal_False; + bRet = false; } if ( nTop <= nBottom ) { if ( (rPoint.Y() < nTop) || (rPoint.Y() > nBottom) ) - bRet = sal_False; + bRet = false; } else { if ( (rPoint.Y() > nTop) || (rPoint.Y() < nBottom) ) - bRet = sal_False; + bRet = false; } return bRet; } -sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const +bool Rectangle::IsInside( const Rectangle& rRect ) const { if ( IsInside( rRect.TopLeft() ) && IsInside( rRect.BottomRight() ) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool Rectangle::IsOver( const Rectangle& rRect ) const +bool Rectangle::IsOver( const Rectangle& rRect ) const { // If there's no intersection, they don't overlap return !GetIntersection( rRect ).IsEmpty(); diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index 11bf510bd057..013be469945b 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.cxx @@ -30,48 +30,48 @@ double Line::GetLength() const return hypot( maStart.X() - maEnd.X(), maStart.Y() - maEnd.Y() ); } -sal_Bool Line::Intersection( const Line& rLine, Point& rIntersection ) const +bool Line::Intersection( const Line& rLine, Point& rIntersection ) const { double fX, fY; - sal_Bool bRet; + bool bRet; if( Intersection( rLine, fX, fY ) ) { rIntersection.X() = FRound( fX ); rIntersection.Y() = FRound( fY ); - bRet = sal_True; + bRet = true; } else - bRet = sal_False; + bRet = false; return bRet; } -sal_Bool Line::Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const +bool Line::Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const { const double fAx = maEnd.X() - maStart.X(); const double fAy = maEnd.Y() - maStart.Y(); const double fBx = rLine.maStart.X() - rLine.maEnd.X(); const double fBy = rLine.maStart.Y() - rLine.maEnd.Y(); const double fDen = fAy * fBx - fAx * fBy; - sal_Bool bOk = sal_False; + bool bOk = false; if( fDen != 0. ) { const double fCx = maStart.X() - rLine.maStart.X(); const double fCy = maStart.Y() - rLine.maStart.Y(); const double fA = fBy * fCx - fBx * fCy; - const sal_Bool bGreater = ( fDen > 0. ); + const bool bGreater = ( fDen > 0. ); - bOk = sal_True; + bOk = true; if ( bGreater ) { if ( ( fA < 0. ) || ( fA > fDen ) ) - bOk = sal_False; + bOk = false; } else if ( ( fA > 0. ) || ( fA < fDen ) ) - bOk = sal_False; + bOk = false; if ( bOk ) { @@ -80,10 +80,10 @@ sal_Bool Line::Intersection( const Line& rLine, double& rIntersectionX, double& if ( bGreater ) { if ( ( fB < 0. ) || ( fB > fDen ) ) - bOk = sal_False; + bOk = false; } else if ( ( fB > 0. ) || ( fB < fDen ) ) - bOk = sal_False; + bOk = false; if( bOk ) { diff --git a/tools/source/generic/link.cxx b/tools/source/generic/link.cxx index 016e00537b48..b1726104cf44 100644 --- a/tools/source/generic/link.cxx +++ b/tools/source/generic/link.cxx @@ -19,22 +19,22 @@ #include <tools/link.hxx> -sal_Bool Link::operator==( const Link& rLink ) const +bool Link::operator==( const Link& rLink ) const { if ( pFunc == rLink.pFunc ) { if ( pFunc ) { if ( pInst == rLink.pInst ) - return sal_True; + return true; else - return sal_False; + return false; } else - return sal_True; + return true; } else - return sal_False; + return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 9ea5fe4bd429..60e4a145377b 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -57,7 +57,7 @@ static ImplPolygonData aStaticImplPolygon = NULL, NULL, 0, 0 }; -ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, sal_Bool bFlags ) +ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, bool bFlags ) { if ( nInitSize ) { @@ -140,7 +140,7 @@ ImplPolygon::~ImplPolygon() delete[] mpFlagAry; } -void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, sal_Bool bResize ) +void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize ) { if( mnPoints == nNewSize ) return; @@ -221,7 +221,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI { // Append at the back nPos = mnPoints; - ImplSetSize( nNewSize, sal_True ); + ImplSetSize( nNewSize, true ); if( pInitPoly ) { @@ -459,7 +459,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin } Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEnd, - PolyStyle eStyle, sal_Bool bFullCircle ) + PolyStyle eStyle, bool bFullCircle ) { DBG_CTOR( Polygon, NULL ); @@ -641,14 +641,14 @@ PolyFlags Polygon::GetFlags( sal_uInt16 nPos ) const POLY_NORMAL ); } -sal_Bool Polygon::HasFlags() const +bool Polygon::HasFlags() const { return mpImplPolygon->mpFlagAry != NULL; } -sal_Bool Polygon::IsRect() const +bool Polygon::IsRect() const { - sal_Bool bIsRect = sal_False; + bool bIsRect = false; if ( mpImplPolygon->mpFlagAry == NULL ) { if ( ( ( mpImplPolygon->mnPoints == 5 ) && ( mpImplPolygon->mpPointAry[ 0 ] == mpImplPolygon->mpPointAry[ 4 ] ) ) || @@ -658,7 +658,7 @@ sal_Bool Polygon::IsRect() const ( mpImplPolygon->mpPointAry[ 0 ].Y() == mpImplPolygon->mpPointAry[ 1 ].Y() ) && ( mpImplPolygon->mpPointAry[ 1 ].X() == mpImplPolygon->mpPointAry[ 2 ].X() ) && ( mpImplPolygon->mpPointAry[ 2 ].Y() == mpImplPolygon->mpPointAry[ 3 ].Y() ) ) - bIsRect = sal_True; + bIsRect = true; } } return bIsRect; @@ -929,11 +929,11 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n { sal_uInt16 nPntCnt = rPoly.GetSize(), nNewPos = 0; Polygon aNewPoly( nPntCnt ); - sal_Bool bChangeInThisRun = sal_False; + bool bChangeInThisRun = false; for( sal_uInt16 n = 0; n < nPntCnt; n++ ) { - sal_Bool bDeletePoint = sal_False; + bool bDeletePoint = false; if( ( n + nNumRuns ) % 2 ) { @@ -950,7 +950,7 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n double fTurnB = aVec2.Normalize().Scalar( aVec3.Normalize() ); if( fabs( fTurnB ) < ( 1.0 + SMALL_DVALUE ) && fabs( fTurnB ) > ( 1.0 - SMALL_DVALUE ) ) - bDeletePoint = sal_True; + bDeletePoint = true; else { Vector2D aVecB( rPoly[ nIndNext ] ); @@ -979,7 +979,7 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n if( ( fLenFact < ( FSQRT2 + SMALL_DVALUE ) ) && ( ( ( fDist1 + fDist4 ) / ( fDist2 + fDist3 ) ) * 2000.0 ) > fBound ) { - bDeletePoint = sal_True; + bDeletePoint = true; } } else @@ -994,7 +994,7 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n if( ( (sal_uInt32) ( ( ( fLenFact - 1.0 ) * 1000000.0 ) + 0.5 ) < fBound ) && ( fabs( fGradB ) <= ( fRelLen * fBound * 0.01 ) ) ) { - bDeletePoint = sal_True; + bDeletePoint = true; } } } @@ -1003,7 +1003,7 @@ void Polygon::ImplReduceEdges( Polygon& rPoly, const double& rArea, sal_uInt16 n if( !bDeletePoint ) aNewPoly[ nNewPos++ ] = rPoly[ n ]; else - bChangeInThisRun = sal_True; + bChangeInThisRun = true; } if( bChangeInThisRun && nNewPos ) @@ -1147,7 +1147,7 @@ class ImplEdgePointFilter : public ImplPointFilter const long mnHigh; const int mnEdge; int mnLastOutside; - sal_Bool mbFirst; + bool mbFirst; public: ImplEdgePointFilter( int nEdge, long nLow, long nHigh, @@ -1156,7 +1156,7 @@ public: mnLow( nLow ), mnHigh( nHigh ), mnEdge( nEdge ), - mbFirst( sal_True ) + mbFirst( true ) { } @@ -1257,7 +1257,7 @@ void ImplEdgePointFilter::Input( const Point& rPoint ) if ( mbFirst ) { maFirstPoint = rPoint; - mbFirst = sal_False; + mbFirst = false; if ( !nOutside ) mrNextFilter.Input( rPoint ); } @@ -1293,7 +1293,7 @@ void ImplEdgePointFilter::LastPoint() } } -void Polygon::Clip( const Rectangle& rRect, sal_Bool bPolygon ) +void Polygon::Clip( const Rectangle& rRect, bool bPolygon ) { // #105251# Justify rect befor edge filtering Rectangle aJustifiedRect( rRect ); @@ -1391,7 +1391,7 @@ double Polygon::GetSignedArea() const return fArea; } -sal_Bool Polygon::IsInside( const Point& rPoint ) const +bool Polygon::IsInside( const Point& rPoint ) const { DBG_CHKTHIS( Polygon, NULL ); DBG_ASSERT( !mpImplPolygon->mpFlagAry, "IsInside could fail with beziers!" ); @@ -1440,7 +1440,7 @@ sal_Bool Polygon::IsInside( const Point& rPoint ) const return ( ( nPCounter & 1 ) == 1 ); } -sal_Bool Polygon::IsRightOrientated() const +bool Polygon::IsRightOrientated() const { DBG_CHKTHIS( Polygon, NULL ); return GetSignedArea() >= 0.0; @@ -1516,23 +1516,23 @@ Polygon& Polygon::operator=( const Polygon& rPoly ) return *this; } -sal_Bool Polygon::operator==( const Polygon& rPoly ) const +bool Polygon::operator==( const Polygon& rPoly ) const { DBG_CHKTHIS( Polygon, NULL ); DBG_CHKOBJ( &rPoly, Polygon, NULL ); if ( (rPoly.mpImplPolygon == mpImplPolygon) ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool Polygon::IsEqual( const Polygon& rPoly ) const +bool Polygon::IsEqual( const Polygon& rPoly ) const { - sal_Bool bIsEqual = sal_True; + bool bIsEqual = true; sal_uInt16 i; if ( GetSize() != rPoly.GetSize() ) - bIsEqual = sal_False; + bIsEqual = false; else { for ( i = 0; i < GetSize(); i++ ) @@ -1540,7 +1540,7 @@ sal_Bool Polygon::IsEqual( const Polygon& rPoly ) const if ( ( GetPoint( i ) != rPoly.GetPoint( i ) ) || ( GetFlags( i ) != rPoly.GetFlags( i ) ) ) { - bIsEqual = sal_False; + bIsEqual = false; break; } } @@ -1565,7 +1565,7 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly ) rPoly.mpImplPolygon = new ImplPolygon( nPoints ); } else - rPoly.mpImplPolygon->ImplSetSize( nPoints, sal_False ); + rPoly.mpImplPolygon->ImplSetSize( nPoints, false ); { // Determine whether we need to write through operators diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 2650960db126..4fa9a839f0ae 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -205,9 +205,9 @@ const Polygon& PolyPolygon::GetObject( sal_uInt16 nPos ) const return *(mpImplPolyPolygon->mpPolyAry[nPos]); } -sal_Bool PolyPolygon::IsRect() const +bool PolyPolygon::IsRect() const { - sal_Bool bIsRect = sal_False; + bool bIsRect = false; if ( Count() == 1 ) bIsRect = mpImplPolyPolygon->mpPolyAry[ 0 ]->IsRect(); return bIsRect; @@ -266,7 +266,7 @@ void PolyPolygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* else { double fArea; - const sal_Bool bEdges = ( nOptimizeFlags & POLY_OPTIMIZE_EDGES ) == POLY_OPTIMIZE_EDGES; + const bool bEdges = ( nOptimizeFlags & POLY_OPTIMIZE_EDGES ) == POLY_OPTIMIZE_EDGES; sal_uInt16 nPercent = 0; if( bEdges ) @@ -489,7 +489,7 @@ Rectangle PolyPolygon::GetBoundRect() const DBG_CHKTHIS( PolyPolygon, NULL ); long nXMin=0, nXMax=0, nYMin=0, nYMax=0; - sal_Bool bFirst = sal_True; + bool bFirst = true; sal_uInt16 nPolyCount = mpImplPolyPolygon->mnCount; for ( sal_uInt16 n = 0; n < nPolyCount; n++ ) @@ -506,7 +506,7 @@ Rectangle PolyPolygon::GetBoundRect() const { nXMin = nXMax = pPt->X(); nYMin = nYMax = pPt->Y(); - bFirst = sal_False; + bFirst = false; } else { @@ -559,22 +559,22 @@ PolyPolygon& PolyPolygon::operator=( const PolyPolygon& rPolyPoly ) return *this; } -sal_Bool PolyPolygon::operator==( const PolyPolygon& rPolyPoly ) const +bool PolyPolygon::operator==( const PolyPolygon& rPolyPoly ) const { DBG_CHKTHIS( PolyPolygon, NULL ); DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL ); if ( rPolyPoly.mpImplPolyPolygon == mpImplPolyPolygon ) - return sal_True; + return true; else - return sal_False; + return false; } -sal_Bool PolyPolygon::IsEqual( const PolyPolygon& rPolyPoly ) const +bool PolyPolygon::IsEqual( const PolyPolygon& rPolyPoly ) const { - sal_Bool bIsEqual = sal_True; + bool bIsEqual = true; if ( Count() != rPolyPoly.Count() ) - bIsEqual = sal_False; + bIsEqual = false; else { sal_uInt16 i; @@ -582,7 +582,7 @@ sal_Bool PolyPolygon::IsEqual( const PolyPolygon& rPolyPoly ) const { if (!GetObject( i ).IsEqual( rPolyPoly.GetObject( i ) ) ) { - bIsEqual = sal_False; + bIsEqual = false; break; } } diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index 30bdf43f9a1e..3e11ca943095 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -20,6 +20,7 @@ #include <cstddef> #include <limits> +#include <rtl/ustring.hxx> #include <rtl/strbuf.hxx> #include <rtl/tencinfo.h> #include <tools/inetmime.hxx> diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 120a1db0a32c..5855cd2958f2 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -18,6 +18,7 @@ */ #include <sal/types.h> +#include <osl/thread.h> #include <tools/datetime.hxx> #include <tools/inetmime.hxx> #include <tools/inetmsg.hxx> @@ -84,7 +85,7 @@ void INetMessage::SetHeaderField_Impl ( const OUString &rValue, sal_uIntPtr &rnIndex) { - INetMIMEStringOutputSink aSink (0, STRING_MAXLEN); + INetMIMEStringOutputSink aSink (0, 32767); /* weird the mime standard says that aline MUST not be longeur that 998 */ INetMIME::writeHeaderFieldBody ( aSink, eType, rValue, osl_getThreadTextEncoding(), false); SetHeaderField_Impl ( diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 9bef89cb1ddc..3e619d841c7b 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -26,7 +26,7 @@ #include <ctype.h> // toupper -inline sal_Bool SAL_CALL ascii_isWhitespace( sal_Unicode ch ) +inline bool SAL_CALL ascii_isWhitespace( sal_Unicode ch ) { return ((ch <= 0x20) && ch); } @@ -34,26 +34,26 @@ inline sal_Bool SAL_CALL ascii_isWhitespace( sal_Unicode ch ) /** Quoted-Printable Encoding */ class INetMessageEncodeQPStream_Impl : public INetMessageIStream { - SvStream *pMsgStrm; + SvStream* pMsgStrm; sal_uIntPtr nMsgBufSiz; - sal_Char *pMsgBuffer; - sal_Char *pMsgRead; - sal_Char *pMsgWrite; + sal_Char* pMsgBuffer; + sal_Char* pMsgRead; + sal_Char* pMsgWrite; sal_uIntPtr nTokBufSiz; - sal_Char *pTokBuffer; - sal_Char *pTokRead; - sal_Char *pTokWrite; + sal_Char* pTokBuffer; + sal_Char* pTokRead; + sal_Char* pTokWrite; INetMessageStreamState eState; - sal_Bool bDone; + bool bDone; - virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize); + virtual int GetMsgLine(sal_Char* pData, sal_uIntPtr nSize); public: - INetMessageEncodeQPStream_Impl (sal_uIntPtr nMsgBufferSize = 1024); - virtual ~INetMessageEncodeQPStream_Impl (void); + INetMessageEncodeQPStream_Impl(sal_uIntPtr nMsgBufferSize = 1024); + virtual ~INetMessageEncodeQPStream_Impl(void); }; /** Quoted-Printable Decoding */ @@ -65,35 +65,35 @@ class INetMessageDecodeQPStream_Impl : public INetMessageOStream sal_uIntPtr nTokBufLen; sal_Char pTokBuffer[4]; - virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize); + virtual int PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize); public: - INetMessageDecodeQPStream_Impl (void); - virtual ~INetMessageDecodeQPStream_Impl (void); + INetMessageDecodeQPStream_Impl(void); + virtual ~INetMessageDecodeQPStream_Impl(void); }; /** Base64 Encoding */ class INetMessageEncode64Stream_Impl : public INetMessageIStream { - SvStream *pMsgStrm; + SvStream* pMsgStrm; sal_uIntPtr nMsgBufSiz; - sal_uInt8 *pMsgBuffer; - sal_uInt8 *pMsgRead; - sal_uInt8 *pMsgWrite; + sal_uInt8* pMsgBuffer; + sal_uInt8* pMsgRead; + sal_uInt8* pMsgWrite; sal_uIntPtr nTokBufSiz; - sal_Char *pTokBuffer; - sal_Char *pTokRead; - sal_Char *pTokWrite; + sal_Char* pTokBuffer; + sal_Char* pTokRead; + sal_Char* pTokWrite; - sal_Bool bDone; + bool bDone; - virtual int GetMsgLine (sal_Char *pData, sal_uIntPtr nSize); + virtual int GetMsgLine(sal_Char* pData, sal_uIntPtr nSize); public: - INetMessageEncode64Stream_Impl (sal_uIntPtr nMsgBufferSize = 2048); - virtual ~INetMessageEncode64Stream_Impl (void); + INetMessageEncode64Stream_Impl(sal_uIntPtr nMsgBufferSize = 2048); + virtual ~INetMessageEncode64Stream_Impl(void); }; /** Base64 Decoding */ @@ -102,74 +102,74 @@ class INetMessageDecode64Stream_Impl : public INetMessageOStream INetMessageStreamState eState; sal_uIntPtr nMsgBufSiz; - sal_Char *pMsgBuffer; - sal_Char *pMsgRead; - sal_Char *pMsgWrite; + sal_Char* pMsgBuffer; + sal_Char* pMsgRead; + sal_Char* pMsgWrite; - virtual int PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize); + virtual int PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize); public: - INetMessageDecode64Stream_Impl (sal_uIntPtr nMsgBufferSize = 128); - virtual ~INetMessageDecode64Stream_Impl (void); + INetMessageDecode64Stream_Impl(sal_uIntPtr nMsgBufferSize = 128); + virtual ~INetMessageDecode64Stream_Impl(void); }; // INetIStream -INetIStream::INetIStream () +INetIStream::INetIStream() { } -INetIStream::~INetIStream (void) +INetIStream::~INetIStream(void) { } -int INetIStream::Read (sal_Char *pData, sal_uIntPtr nSize) +int INetIStream::Read(sal_Char* pData, sal_uIntPtr nSize) { - return GetData (pData, nSize); + return GetData(pData, nSize); } // INetOStream -INetOStream::INetOStream () +INetOStream::INetOStream() { } -INetOStream::~INetOStream (void) +INetOStream::~INetOStream(void) { } -int INetOStream::Write (const sal_Char *pData, sal_uIntPtr nSize) +int INetOStream::Write(const sal_Char* pData, sal_uIntPtr nSize) { - return PutData (pData, nSize); + return PutData(pData, nSize); } // INetMessageIStream -INetMessageIStream::INetMessageIStream (sal_uIntPtr nBufferSize) +INetMessageIStream::INetMessageIStream(sal_uIntPtr nBufferSize) : pSourceMsg (NULL), - bHeaderGenerated (sal_False), + bHeaderGenerated (false), nBufSiz (nBufferSize), pMsgStrm (NULL), pMsgBuffer (new SvMemoryStream) { - pMsgBuffer->SetStreamCharSet (RTL_TEXTENCODING_ASCII_US); + pMsgBuffer->SetStreamCharSet(RTL_TEXTENCODING_ASCII_US); pBuffer = new sal_Char[nBufSiz]; pRead = pWrite = pBuffer; } -INetMessageIStream::~INetMessageIStream (void) +INetMessageIStream::~INetMessageIStream(void) { delete [] pBuffer; delete pMsgBuffer; delete pMsgStrm; } -int INetMessageIStream::GetData (sal_Char *pData, sal_uIntPtr nSize) +int INetMessageIStream::GetData(sal_Char* pData, sal_uIntPtr nSize) { if (pSourceMsg == NULL) return INETSTREAM_STATUS_ERROR; - sal_Char *pWBuf = pData; - sal_Char *pWEnd = pData + nSize; + sal_Char* pWBuf = pData; + sal_Char* pWEnd = pData + nSize; while (pWBuf < pWEnd) { @@ -188,7 +188,7 @@ int INetMessageIStream::GetData (sal_Char *pData, sal_uIntPtr nSize) pRead = pWrite = pBuffer; // Read next message line. - int nRead = GetMsgLine (pBuffer, nBufSiz); + int nRead = GetMsgLine(pBuffer, nBufSiz); if (nRead > 0) { // Set read pointer. @@ -199,7 +199,7 @@ int INetMessageIStream::GetData (sal_Char *pData, sal_uIntPtr nSize) if (!bHeaderGenerated) { // Header generated. Insert empty line. - bHeaderGenerated = sal_True; + bHeaderGenerated = true; *pRead++ = '\r'; *pRead++ = '\n'; } @@ -214,12 +214,12 @@ int INetMessageIStream::GetData (sal_Char *pData, sal_uIntPtr nSize) return (pWBuf - pData); } -int INetMessageIStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) +int INetMessageIStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { if (pSourceMsg == NULL) return INETSTREAM_STATUS_ERROR; - sal_Char *pWBuf = pData; - sal_Char *pWEnd = pData + nSize; + sal_Char* pWBuf = pData; + sal_Char* pWEnd = pData + nSize; if (!bHeaderGenerated) { @@ -242,7 +242,7 @@ int INetMessageIStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) } } - pMsgWrite = (sal_Char *)(pMsgBuffer->GetData()); + pMsgWrite = (sal_Char*)(pMsgBuffer->GetData()); pMsgRead = pMsgWrite + pMsgBuffer->Tell(); } @@ -256,7 +256,7 @@ int INetMessageIStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) else { // Reset buffer. - pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN); + pMsgBuffer->Seek(STREAM_SEEK_TO_BEGIN); } } else @@ -266,7 +266,7 @@ int INetMessageIStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) if (pMsgStrm == NULL) pMsgStrm = new SvStream (pSourceMsg->GetDocumentLB()); - sal_uIntPtr nRead = pMsgStrm->Read (pWBuf, (pWEnd - pWBuf)); + sal_uIntPtr nRead = pMsgStrm->Read(pWBuf, (pWEnd - pWBuf)); pWBuf += nRead; } } @@ -275,24 +275,23 @@ int INetMessageIStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) // INetMessageOStream -INetMessageOStream::INetMessageOStream (void) +INetMessageOStream::INetMessageOStream(void) : pTargetMsg (NULL), - bHeaderParsed (sal_False), + bHeaderParsed (false), eOState (INETMSG_EOL_BEGIN), pMsgBuffer (new SvMemoryStream) { } -INetMessageOStream::~INetMessageOStream (void) +INetMessageOStream::~INetMessageOStream(void) { if (pMsgBuffer->Tell() > 0) - PutMsgLine ((const sal_Char *) pMsgBuffer->GetData(), pMsgBuffer->Tell()); + PutMsgLine((const sal_Char*) pMsgBuffer->GetData(), pMsgBuffer->Tell()); delete pMsgBuffer; if (pTargetMsg) { - SvOpenLockBytes *pLB = - PTR_CAST (SvOpenLockBytes, pTargetMsg->GetDocumentLB()); + SvOpenLockBytes* pLB = PTR_CAST(SvOpenLockBytes, pTargetMsg->GetDocumentLB()); if (pLB) { pLB->Flush(); @@ -302,11 +301,11 @@ INetMessageOStream::~INetMessageOStream (void) } /// Simple Field Parsing (RFC822, Appendix B) -int INetMessageOStream::PutData (const sal_Char *pData, sal_uIntPtr nSize) +int INetMessageOStream::PutData(const sal_Char* pData, sal_uIntPtr nSize) { if (pTargetMsg == NULL) return INETSTREAM_STATUS_ERROR; - const sal_Char *pStop = (pData + nSize); + const sal_Char* pStop = (pData + nSize); while (!bHeaderParsed && (pData < pStop)) { @@ -326,18 +325,17 @@ int INetMessageOStream::PutData (const sal_Char *pData, sal_uIntPtr nSize) if (pMsgBuffer->Tell() > 0) { *pMsgBuffer << '\0'; - int status = PutMsgLine ( - (const sal_Char *) pMsgBuffer->GetData(), - pMsgBuffer->Tell()); + int status = PutMsgLine( (const sal_Char*) pMsgBuffer->GetData(), + pMsgBuffer->Tell()); if (status != INETSTREAM_STATUS_OK) return status; } // Reset to begin. eOState = INETMSG_EOL_BEGIN; - pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN); + pMsgBuffer->Seek(STREAM_SEEK_TO_BEGIN); // Mark header parsed. - bHeaderParsed = sal_True; + bHeaderParsed = true; } else if ((*pData == ' ') || (*pData == '\t')) { @@ -352,14 +350,13 @@ int INetMessageOStream::PutData (const sal_Char *pData, sal_uIntPtr nSize) { // Emit buffered header field now. *pMsgBuffer << '\0'; - int status = PutMsgLine ( - (const sal_Char *) pMsgBuffer->GetData(), - pMsgBuffer->Tell()); + int status = PutMsgLine((const sal_Char*) pMsgBuffer->GetData(), + pMsgBuffer->Tell()); if (status != INETSTREAM_STATUS_OK) return status; } // Reset to begin of buffer. - pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN); + pMsgBuffer->Seek(STREAM_SEEK_TO_BEGIN); // Insert current character into buffer. *pMsgBuffer << *pData++; @@ -381,11 +378,11 @@ int INetMessageOStream::PutData (const sal_Char *pData, sal_uIntPtr nSize) if (*pData == '\r') pData++; eOState = INETMSG_EOL_FCR; } - else if (ascii_isWhitespace (*pData & 0x7f)) + else if (ascii_isWhitespace(*pData & 0x7f)) { // Any <LWS> is folded into a single <SP> character. - sal_Char c = *((const sal_Char *) pMsgBuffer->GetData() + pMsgBuffer->Tell() - 1); - if (!ascii_isWhitespace (c & 0x7f)) *pMsgBuffer << ' '; + sal_Char c = *((const sal_Char*) pMsgBuffer->GetData() + pMsgBuffer->Tell() - 1); + if (!ascii_isWhitespace(c & 0x7f)) *pMsgBuffer << ' '; // Skip over this <LWS> character. pData++; @@ -400,13 +397,13 @@ int INetMessageOStream::PutData (const sal_Char *pData, sal_uIntPtr nSize) if (bHeaderParsed && (pData < pStop)) { // Put message body down-stream. - return PutMsgLine (pData, (pStop - pData)); + return PutMsgLine(pData, (pStop - pData)); } return INETSTREAM_STATUS_OK; } -int INetMessageOStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) +int INetMessageOStream::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize) { // Check for message container. if (pTargetMsg == NULL) return INETSTREAM_STATUS_ERROR; @@ -418,28 +415,24 @@ int INetMessageOStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) sal_Int32 nPos = aField.indexOf(':'); if (nPos != -1) { - OString aName( - aField.copy(0, nPos)); - OString aValue( - aField.copy(nPos + 1, aField.getLength() - nPos + 1)); + OString aName( aField.copy(0, nPos)); + OString aValue( aField.copy(nPos + 1, aField.getLength() - nPos + 1)); aValue = comphelper::string::stripStart(aValue, ' '); - pTargetMsg->SetHeaderField ( - INetMessageHeader (aName, aValue)); + pTargetMsg->SetHeaderField( INetMessageHeader (aName, aValue)); } } else { - SvOpenLockBytes *pLB = - PTR_CAST(SvOpenLockBytes, pTargetMsg->GetDocumentLB()); + SvOpenLockBytes *pLB = PTR_CAST(SvOpenLockBytes, pTargetMsg->GetDocumentLB()); if (pLB == NULL) return INETSTREAM_STATUS_WOULDBLOCK; sal_Size nDocSiz = pTargetMsg->GetDocumentSize(); sal_Size nWrite = 0; - pLB->FillAppend ((sal_Char *)pData, nSize, &nWrite); - pTargetMsg->SetDocumentSize (nDocSiz + nWrite); + pLB->FillAppend((sal_Char*)pData, nSize, &nWrite); + pTargetMsg->SetDocumentSize(nDocSiz + nWrite); if (nWrite < nSize) return INETSTREAM_STATUS_ERROR; } @@ -448,13 +441,13 @@ int INetMessageOStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) // INetMessageIOStream -INetMessageIOStream::INetMessageIOStream (sal_uIntPtr nBufferSize) +INetMessageIOStream::INetMessageIOStream(sal_uIntPtr nBufferSize) : INetMessageIStream (nBufferSize), INetMessageOStream () { } -INetMessageIOStream::~INetMessageIOStream (void) +INetMessageIOStream::~INetMessageIOStream(void) { } @@ -475,9 +468,9 @@ INetMessageEncodeQPStream_Impl::INetMessageEncodeQPStream_Impl( sal_uIntPtr nMsg nMsgBufSiz (nMsgBufferSize), nTokBufSiz (80), eState (INETMSG_EOL_SCR), - bDone (sal_False) + bDone (false) { - GenerateHeader (sal_False); + GenerateHeader (false); pMsgBuffer = new sal_Char[nMsgBufSiz]; pMsgRead = pMsgWrite = pMsgBuffer; @@ -486,22 +479,22 @@ INetMessageEncodeQPStream_Impl::INetMessageEncodeQPStream_Impl( sal_uIntPtr nMsg pTokRead = pTokWrite = pTokBuffer; } -INetMessageEncodeQPStream_Impl::~INetMessageEncodeQPStream_Impl (void) +INetMessageEncodeQPStream_Impl::~INetMessageEncodeQPStream_Impl(void) { delete pMsgStrm; delete [] pMsgBuffer; delete [] pTokBuffer; } -int INetMessageEncodeQPStream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) +int INetMessageEncodeQPStream_Impl::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { - INetMessage *pMsg = GetSourceMessage (); + INetMessage* pMsg = GetSourceMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; if (pMsg->GetDocumentLB() == NULL) return 0; - if (pMsgStrm == NULL) pMsgStrm = new SvStream (pMsg->GetDocumentLB()); + if (pMsgStrm == NULL) pMsgStrm = new SvStream(pMsg->GetDocumentLB()); - sal_Char *pWBuf = pData; + sal_Char* pWBuf = pData; while (pWBuf < (pData + nSize)) { // Caller's buffer not yet filled. @@ -622,7 +615,7 @@ int INetMessageEncodeQPStream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi pMsgRead = pMsgWrite = pMsgBuffer; // Read next message block. - sal_uIntPtr nRead = pMsgStrm->Read (pMsgBuffer, nMsgBufSiz); + sal_uIntPtr nRead = pMsgStrm->Read(pMsgBuffer, nMsgBufSiz); if (nRead > 0) { // Set read pointer. @@ -637,7 +630,7 @@ int INetMessageEncodeQPStream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi *pTokRead++ = '\r'; *pTokRead++ = '\n'; - bDone = sal_True; + bDone = true; } else { @@ -686,30 +679,30 @@ static const sal_uInt8 pr2hex[128] = { 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }; -INetMessageDecodeQPStream_Impl::INetMessageDecodeQPStream_Impl (void) - : INetMessageOStream (), +INetMessageDecodeQPStream_Impl::INetMessageDecodeQPStream_Impl(void) + : INetMessageOStream(), eState (INETMSG_EOL_BEGIN), pMsgBuffer (new SvMemoryStream), nTokBufLen (0) { - ParseHeader (sal_False); + ParseHeader(false); } -INetMessageDecodeQPStream_Impl::~INetMessageDecodeQPStream_Impl (void) +INetMessageDecodeQPStream_Impl::~INetMessageDecodeQPStream_Impl(void) { delete pMsgBuffer; } -int INetMessageDecodeQPStream_Impl::PutMsgLine ( - const sal_Char *pData, sal_uIntPtr nSize) +int INetMessageDecodeQPStream_Impl::PutMsgLine( const sal_Char* pData, + sal_uIntPtr nSize) { - INetMessage *pMsg = GetTargetMessage(); + INetMessage* pMsg = GetTargetMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; - SvOpenLockBytes * pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); + SvOpenLockBytes* pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); if (pLB == NULL) return INETSTREAM_STATUS_WOULDBLOCK; - const sal_Char *pStop = pData + nSize; + const sal_Char* pStop = pData + nSize; while (pData < pStop) { if (eState == INETMSG_EOL_FESC) @@ -768,13 +761,12 @@ int INetMessageDecodeQPStream_Impl::PutMsgLine ( sal_Size nDocSiz = pMsg->GetDocumentSize(); sal_Size nWrite = 0; - pLB->FillAppend ( - (sal_Char *)(pMsgBuffer->GetData()), nRead, &nWrite); - pMsg->SetDocumentSize (nDocSiz + nWrite); + pLB->FillAppend((sal_Char*)(pMsgBuffer->GetData()), nRead, &nWrite); + pMsg->SetDocumentSize(nDocSiz + nWrite); if (nWrite < nRead) return INETSTREAM_STATUS_ERROR; - pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN); + pMsgBuffer->Seek(STREAM_SEEK_TO_BEGIN); } eState = INETMSG_EOL_SCR; } @@ -792,15 +784,15 @@ static const sal_Char six2pr[64] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; -INetMessageEncode64Stream_Impl::INetMessageEncode64Stream_Impl ( +INetMessageEncode64Stream_Impl::INetMessageEncode64Stream_Impl( sal_uIntPtr nMsgBufferSize) - : INetMessageIStream (), + : INetMessageIStream(), pMsgStrm (NULL), nMsgBufSiz (nMsgBufferSize), nTokBufSiz (80), - bDone (sal_False) + bDone (false) { - GenerateHeader (sal_False); + GenerateHeader(false); pMsgBuffer = new sal_uInt8[nMsgBufSiz]; pMsgRead = pMsgWrite = pMsgBuffer; @@ -809,22 +801,22 @@ INetMessageEncode64Stream_Impl::INetMessageEncode64Stream_Impl ( pTokRead = pTokWrite = pTokBuffer; } -INetMessageEncode64Stream_Impl::~INetMessageEncode64Stream_Impl (void) +INetMessageEncode64Stream_Impl::~INetMessageEncode64Stream_Impl(void) { delete pMsgStrm; delete [] pMsgBuffer; delete [] pTokBuffer; } -int INetMessageEncode64Stream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) +int INetMessageEncode64Stream_Impl::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { - INetMessage *pMsg = GetSourceMessage (); + INetMessage* pMsg = GetSourceMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; if (pMsg->GetDocumentLB() == NULL) return 0; - if (pMsgStrm == NULL) pMsgStrm = new SvStream (pMsg->GetDocumentLB()); + if (pMsgStrm == NULL) pMsgStrm = new SvStream(pMsg->GetDocumentLB()); - sal_Char *pWBuf = pData; + sal_Char* pWBuf = pData; while (pWBuf < (pData + nSize)) { // Caller's buffer not yet filled. @@ -836,28 +828,26 @@ int INetMessageEncode64Stream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi // Token buffer not yet filled. switch ((pTokRead - pTokBuffer) % 4) { - case 0: - *pTokRead++ = six2pr[(int)(*pMsgWrite >> 2)]; - break; + case 0: + *pTokRead++ = six2pr[(int)(*pMsgWrite >> 2)]; + break; - case 1: - *pTokRead++ = six2pr[ - (int)(((*pMsgWrite << 4) & 060) | - (((*(pMsgWrite + 1)) >> 4) & 017))]; - pMsgWrite++; - break; + case 1: + *pTokRead++ = six2pr[ (int)(((*pMsgWrite << 4) & 060) | + (((*(pMsgWrite + 1)) >> 4) & 017))]; + pMsgWrite++; + break; - case 2: - *pTokRead++ = six2pr[ - (int)(((*pMsgWrite << 2) & 074) | - (((*(pMsgWrite + 1)) >> 6) & 003))]; - pMsgWrite++; - break; + case 2: + *pTokRead++ = six2pr[ (int)(((*pMsgWrite << 2) & 074) | + (((*(pMsgWrite + 1)) >> 6) & 003))]; + pMsgWrite++; + break; - default: // == case 3 - *pTokRead++ = six2pr[(int)(*pMsgWrite & 077)]; - pMsgWrite++; - break; + default: // == case 3 + *pTokRead++ = six2pr[(int)(*pMsgWrite & 077)]; + pMsgWrite++; + break; } } else if ((pTokRead - pTokBuffer) == 72) @@ -886,7 +876,7 @@ int INetMessageEncode64Stream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi pMsgRead = pMsgWrite = pMsgBuffer; // Read next message block. - sal_uIntPtr nRead = pMsgStrm->Read (pMsgBuffer, nMsgBufSiz); + sal_uIntPtr nRead = pMsgStrm->Read(pMsgBuffer, nMsgBufSiz); if (nRead > 0) { // Set read pointer. @@ -900,22 +890,21 @@ int INetMessageEncode64Stream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi // Append pad character(s) and final <CR><LF>. switch ((pTokRead - pTokBuffer) % 4) { - case 2: - *pTokRead++ = '='; - // Fall through for 2nd pad character. - - case 3: - *pTokRead++ = '='; - break; + case 2: + *pTokRead++ = '='; + // Fall through for 2nd pad character. + case 3: + *pTokRead++ = '='; + break; - default: - break; + default: + break; } *pTokRead++ = '\r'; *pTokRead++ = '\n'; // Mark we're done. - bDone = sal_True; + bDone = true; } else { @@ -931,7 +920,7 @@ int INetMessageEncode64Stream_Impl::GetMsgLine (sal_Char *pData, sal_uIntPtr nSi pTokRead = pTokWrite = pTokBuffer; // Reset done flag, if everything has been done. - // if (pWBuf == pData) bDone = sal_False; + // if (pWBuf == pData) bDone = false; // Return. return (pWBuf - pData); @@ -987,33 +976,33 @@ static const sal_uInt8 pr2six[256] = { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }; -INetMessageDecode64Stream_Impl::INetMessageDecode64Stream_Impl ( +INetMessageDecode64Stream_Impl::INetMessageDecode64Stream_Impl( sal_uIntPtr nMsgBufferSize) - : INetMessageOStream (), + : INetMessageOStream(), eState (INETMSG_EOL_SCR), nMsgBufSiz (nMsgBufferSize) { - ParseHeader (sal_False); + ParseHeader(false); pMsgBuffer = new sal_Char[nMsgBufSiz]; pMsgRead = pMsgWrite = pMsgBuffer; } -INetMessageDecode64Stream_Impl::~INetMessageDecode64Stream_Impl (void) +INetMessageDecode64Stream_Impl::~INetMessageDecode64Stream_Impl(void) { delete [] pMsgBuffer; } -int INetMessageDecode64Stream_Impl::PutMsgLine ( - const sal_Char *pData, sal_uIntPtr nSize) +int INetMessageDecode64Stream_Impl::PutMsgLine(const sal_Char* pData, + sal_uIntPtr nSize) { - INetMessage *pMsg = GetTargetMessage (); + INetMessage* pMsg = GetTargetMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; - SvOpenLockBytes * pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); + SvOpenLockBytes* pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); if (pLB == NULL) return INETSTREAM_STATUS_WOULDBLOCK; - const sal_Char *pStop = (pData + nSize); + const sal_Char* pStop = (pData + nSize); while (pData < pStop) { if (pr2six[(int)(*pData)] > 63) @@ -1029,8 +1018,8 @@ int INetMessageDecode64Stream_Impl::PutMsgLine ( sal_Size nRead = pMsgWrite - pMsgBuffer; sal_Size nWrite = 0; - pLB->FillAppend (pMsgBuffer, nRead, &nWrite); - pMsg->SetDocumentSize (nDocSiz + nWrite); + pLB->FillAppend(pMsgBuffer, nRead, &nWrite); + pMsg->SetDocumentSize(nDocSiz + nWrite); if (nWrite < nRead) return INETSTREAM_STATUS_ERROR; @@ -1047,8 +1036,8 @@ int INetMessageDecode64Stream_Impl::PutMsgLine ( sal_Size nRead = pMsgWrite - pMsgBuffer; sal_Size nWrite = 0; - pLB->FillAppend (pMsgBuffer, nRead, &nWrite); - pMsg->SetDocumentSize (nDocSiz + nWrite); + pLB->FillAppend(pMsgBuffer, nRead, &nWrite); + pMsg->SetDocumentSize(nDocSiz + nWrite); if (nWrite < nRead) return INETSTREAM_STATUS_ERROR; @@ -1073,27 +1062,27 @@ int INetMessageDecode64Stream_Impl::PutMsgLine ( // Decode any other character into message buffer. switch ((pMsgRead - pMsgBuffer) % 4) { - case 0: - *pMsgWrite = (pr2six[(int)(*pData++)] << 2); - pMsgRead++; - break; - - case 1: - *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 4); - *pMsgWrite = (pr2six[(int)(*pData++)] << 4); - pMsgRead++; - break; - - case 2: - *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 2); - *pMsgWrite = (pr2six[(int)(*pData++)] << 6); - pMsgRead++; - break; - - default: // == case 3 - *pMsgWrite++ |= (pr2six[(int)(*pData++)]); - pMsgRead = pMsgBuffer; - break; + case 0: + *pMsgWrite = (pr2six[(int)(*pData++)] << 2); + pMsgRead++; + break; + + case 1: + *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 4); + *pMsgWrite = (pr2six[(int)(*pData++)] << 4); + pMsgRead++; + break; + + case 2: + *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 2); + *pMsgWrite = (pr2six[(int)(*pData++)] << 6); + pMsgRead++; + break; + + default: // == case 3 + *pMsgWrite++ |= (pr2six[(int)(*pData++)]); + pMsgRead = pMsgBuffer; + break; } // switch ((pMsgRead - pMsgBuffer) % 4) } } // while (pData < pStop) @@ -1102,8 +1091,8 @@ int INetMessageDecode64Stream_Impl::PutMsgLine ( // INetMIMEMessageStream -INetMIMEMessageStream::INetMIMEMessageStream (sal_uIntPtr nBufferSize) - : INetMessageIOStream (nBufferSize), +INetMIMEMessageStream::INetMIMEMessageStream(sal_uIntPtr nBufferSize) + : INetMessageIOStream(nBufferSize), eState (INETMSG_EOL_BEGIN), nChildIndex (0), pChildStrm (NULL), @@ -1114,7 +1103,7 @@ INetMIMEMessageStream::INetMIMEMessageStream (sal_uIntPtr nBufferSize) { } -INetMIMEMessageStream::~INetMIMEMessageStream (void) +INetMIMEMessageStream::~INetMIMEMessageStream(void) { delete pChildStrm; delete pEncodeStrm; @@ -1123,23 +1112,24 @@ INetMIMEMessageStream::~INetMIMEMessageStream (void) } INetMessageEncoding -INetMIMEMessageStream::GetMsgEncoding (const String& rContentType) +INetMIMEMessageStream::GetMsgEncoding(const OUString& rContentType) { - if ((rContentType.CompareIgnoreCaseToAscii ("message" , 7) == 0) || - (rContentType.CompareIgnoreCaseToAscii ("multipart", 9) == 0) ) + if (rContentType.startsWithIgnoreAsciiCase("message") || + rContentType.startsWithIgnoreAsciiCase("multipart")) + { return INETMSG_ENCODING_7BIT; - - if (rContentType.CompareIgnoreCaseToAscii ("text", 4) == 0) + } + if (rContentType.startsWithIgnoreAsciiCase("text")) { - if (rContentType.CompareIgnoreCaseToAscii ("text/plain", 10) == 0) + if (rContentType.startsWithIgnoreAsciiCase("text/plain")) { if (comphelper::string::getTokenCount(rContentType, '=') > 1) { - String aCharset (rContentType.GetToken (1, '=')); + OUString aCharset(rContentType.getToken(1, '=')); aCharset = comphelper::string::stripStart(aCharset, ' '); aCharset = comphelper::string::stripStart(aCharset, '"'); - if (aCharset.CompareIgnoreCaseToAscii ("us-ascii", 8) == 0) + if (aCharset.startsWithIgnoreAsciiCase("us-ascii")) return INETMSG_ENCODING_7BIT; else return INETMSG_ENCODING_QUOTED; @@ -1155,10 +1145,10 @@ INetMIMEMessageStream::GetMsgEncoding (const String& rContentType) } /// Message Generator -int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) +int INetMIMEMessageStream::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { // Check for message container. - INetMIMEMessage *pMsg = GetSourceMessage(); + INetMIMEMessage* pMsg = GetSourceMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; // Check for header or body. @@ -1169,20 +1159,20 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) // Prepare special header fields. if (pMsg->GetParent()) { - String aPCT (pMsg->GetParent()->GetContentType()); - if (aPCT.CompareIgnoreCaseToAscii ("message/rfc822", 14) == 0) - pMsg->SetMIMEVersion ("1.0"); + OUString aPCT(pMsg->GetParent()->GetContentType()); + if (aPCT.startsWithIgnoreAsciiCase("message/rfc822")) + pMsg->SetMIMEVersion("1.0"); else - pMsg->SetMIMEVersion (String()); + pMsg->SetMIMEVersion(OUString()); } else { - pMsg->SetMIMEVersion ("1.0"); + pMsg->SetMIMEVersion("1.0"); } // Check ContentType. - String aContentType (pMsg->GetContentType()); - if (aContentType.Len()) + OUString aContentType(pMsg->GetContentType()); + if (!aContentType.isEmpty()) { // Determine default Content-Type. OUString aDefaultType = pMsg->GetDefaultContentType(); @@ -1190,50 +1180,54 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) if (aDefaultType.equalsIgnoreAsciiCase(aContentType)) { // No need to specify default. - pMsg->SetContentType (String()); + pMsg->SetContentType(OUString()); } } // Check Encoding. - String aEncoding (pMsg->GetContentTransferEncoding()); - if (aEncoding.Len()) + OUString aEncoding(pMsg->GetContentTransferEncoding()); + if (!aEncoding.isEmpty()) { // Use given Encoding. - if (aEncoding.CompareIgnoreCaseToAscii ( - "base64", 6) == 0) + if (aEncoding.startsWithIgnoreAsciiCase("base64")) + { eEncoding = INETMSG_ENCODING_BASE64; - else if (aEncoding.CompareIgnoreCaseToAscii ( - "quoted-printable", 16) == 0) + } + else if (aEncoding.startsWithIgnoreAsciiCase("quoted-printable")) + { eEncoding = INETMSG_ENCODING_QUOTED; + } else + { eEncoding = INETMSG_ENCODING_7BIT; + } } else { // Use default Encoding for (given|default) Content-Type. - if (aContentType.Len() == 0) + if (aContentType.isEmpty()) { // Determine default Content-Type. aContentType = pMsg->GetDefaultContentType(); } - eEncoding = GetMsgEncoding (aContentType); + eEncoding = GetMsgEncoding(aContentType); } // Set Content-Transfer-Encoding header. if (eEncoding == INETMSG_ENCODING_BASE64) { // Base64. - pMsg->SetContentTransferEncoding ("base64"); + pMsg->SetContentTransferEncoding("base64"); } else if (eEncoding == INETMSG_ENCODING_QUOTED) { // Quoted-Printable. - pMsg->SetContentTransferEncoding ("quoted-printable"); + pMsg->SetContentTransferEncoding("quoted-printable"); } else { // No need to specify default. - pMsg->SetContentTransferEncoding (String()); + pMsg->SetContentTransferEncoding(OUString()); } // Mark we're done. @@ -1241,7 +1235,7 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) } // Generate the message header. - int nRead = INetMessageIOStream::GetMsgLine (pData, nSize); + int nRead = INetMessageIOStream::GetMsgLine(pData, nSize); if (nRead <= 0) { // Reset state. @@ -1259,7 +1253,7 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) { if (pChildStrm == NULL) { - INetMIMEMessage *pChild = pMsg->GetChild (nChildIndex); + INetMIMEMessage *pChild = pMsg->GetChild(nChildIndex); if (pChild) { // Increment child index. @@ -1267,7 +1261,7 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) // Create child stream. pChildStrm = new INetMIMEMessageStream; - pChildStrm->SetSourceMessage (pChild); + pChildStrm->SetSourceMessage(pChild); if (pMsg->IsMultipart()) { @@ -1294,7 +1288,7 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) aDelim.append(pMsg->GetMultipartBoundary()); aDelim.append("--\r\n"); - memcpy (pData, aDelim.getStr(), + memcpy(pData, aDelim.getStr(), aDelim.getLength()); return aDelim.getLength(); } @@ -1303,7 +1297,7 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) else { // Read current child stream. - int nRead = pChildStrm->Read (pData, nSize); + int nRead = pChildStrm->Read(pData, nSize); if (nRead > 0) { return nRead; @@ -1326,72 +1320,66 @@ int INetMIMEMessageStream::GetMsgLine (sal_Char *pData, sal_uIntPtr nSize) // Empty message body. return 0; } - else + + // Check whether message body needs to be encoded. + if (eEncoding == INETMSG_ENCODING_7BIT) + { + // No Encoding. + return INetMessageIOStream::GetMsgLine(pData, nSize); + } + + // Apply appropriate Encoding. + while (eState == INETMSG_EOL_BEGIN) { - // Check whether message body needs to be encoded. - if (eEncoding == INETMSG_ENCODING_7BIT) + if (pEncodeStrm == NULL) { - // No Encoding. - return INetMessageIOStream::GetMsgLine (pData, nSize); + // Create encoder stream. + if (eEncoding == INETMSG_ENCODING_QUOTED) + { + // Quoted-Printable Encoding. + pEncodeStrm = new INetMessageEncodeQPStream_Impl; + } + else + { + // Base64 Encoding. + pEncodeStrm = new INetMessageEncode64Stream_Impl; + } + pEncodeStrm->SetSourceMessage(pMsg); + } + + // Read encoded message. + int nRead = pEncodeStrm->Read(pData, nSize); + if (nRead > 0) + { + return nRead; } else { - // Apply appropriate Encoding. - while (eState == INETMSG_EOL_BEGIN) - { - if (pEncodeStrm == NULL) - { - // Create encoder stream. - if (eEncoding == INETMSG_ENCODING_QUOTED) - { - // Quoted-Printable Encoding. - pEncodeStrm - = new INetMessageEncodeQPStream_Impl; - } - else - { - // Base64 Encoding. - pEncodeStrm - = new INetMessageEncode64Stream_Impl; - } - pEncodeStrm->SetSourceMessage (pMsg); - } - - // Read encoded message. - int nRead = pEncodeStrm->Read (pData, nSize); - if (nRead > 0) - { - return nRead; - } - else - { - // Cleanup exhausted encoder stream. - delete pEncodeStrm; - pEncodeStrm = NULL; + // Cleanup exhausted encoder stream. + delete pEncodeStrm; + pEncodeStrm = NULL; - // Mark we're done. - eState = INETMSG_EOL_DONE; - } - } - return 0; + // Mark we're done. + eState = INETMSG_EOL_DONE; } } + return 0; } } } /// Message Parser -int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) +int INetMIMEMessageStream::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize) { // Check for message container. - INetMIMEMessage *pMsg = GetTargetMessage(); + INetMIMEMessage* pMsg = GetTargetMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; // Check for header or body. if (!IsHeaderParsed()) { // Parse the message header. - int nRet = INetMessageIOStream::PutMsgLine (pData, nSize); + int nRet = INetMessageIOStream::PutMsgLine(pData, nSize); return nRet; } else @@ -1408,13 +1396,12 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) { // Encapsulated message. INetMIMEMessage* pNewMessage = new INetMIMEMessage; - pNewMessage->SetDocumentLB ( - new SvAsyncLockBytes(new SvCacheStream, sal_False)); - pMsg->AttachChild( *pNewMessage, sal_True ); + pNewMessage->SetDocumentLB( new SvAsyncLockBytes(new SvCacheStream, false)); + pMsg->AttachChild( *pNewMessage, true ); // Encapsulated message body. Create message parser stream. pChildStrm = new INetMIMEMessageStream; - pChildStrm->SetTargetMessage ( pNewMessage ); + pChildStrm->SetTargetMessage( pNewMessage ); // Initialize control variables. eState = INETMSG_EOL_BEGIN; @@ -1427,7 +1414,7 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) return status; } - return INetMessageIOStream::PutMsgLine (pData, nSize); + return INetMessageIOStream::PutMsgLine(pData, nSize); } else { @@ -1448,10 +1435,10 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) aBoundary = comphelper::string::strip(aBoundary, '"'); // Save boundary. - pMsg->SetMultipartBoundary (aBoundary); + pMsg->SetMultipartBoundary(aBoundary); } - OString aPlainDelim (pMsg->GetMultipartBoundary()); + OString aPlainDelim(pMsg->GetMultipartBoundary()); OString aDelim = OStringBuffer("--"). append(aPlainDelim). makeStringAndClear(); @@ -1465,13 +1452,13 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) makeStringAndClear(); if (pMsgBuffer == NULL) pMsgBuffer = new SvMemoryStream; - pMsgBuffer->Write (pData, nSize); + pMsgBuffer->Write(pData, nSize); sal_uIntPtr nBufSize = pMsgBuffer->Tell(); const sal_Char* pChar; const sal_Char* pOldPos; int status; - for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--; + for( pOldPos = pChar = (const sal_Char*) pMsgBuffer->GetData(); nBufSize--; pChar++ ) { if( *pChar == '\r' || *pChar == '\n' ) @@ -1520,15 +1507,15 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) // Encapsulated message. INetMIMEMessage* pNewMessage = new INetMIMEMessage; - pNewMessage->SetDocumentLB ( - new SvAsyncLockBytes ( - new SvCacheStream, sal_False)); + pNewMessage->SetDocumentLB( + new SvAsyncLockBytes( + new SvCacheStream, false)); - pMsg->AttachChild( *pNewMessage, sal_True ); + pMsg->AttachChild( *pNewMessage, true ); // Encapsulated message body. Create message parser stream. pChildStrm = new INetMIMEMessageStream; - pChildStrm->SetTargetMessage ( pNewMessage ); + pChildStrm->SetTargetMessage( pNewMessage ); // Initialize control variables. } @@ -1569,34 +1556,41 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) if (eEncoding == INETMSG_ENCODING_BINARY) { - String aEncoding (pMsg->GetContentTransferEncoding()); - if (aEncoding.CompareIgnoreCaseToAscii ( - "base64", 6) == COMPARE_EQUAL) + OUString aEncoding(pMsg->GetContentTransferEncoding()); + if (aEncoding.startsWithIgnoreAsciiCase("base64")) + { eEncoding = INETMSG_ENCODING_BASE64; - else if (aEncoding.CompareIgnoreCaseToAscii ( - "quoted-printable", 16) == COMPARE_EQUAL) + } + else if (aEncoding.startsWithIgnoreAsciiCase("quoted-printable")) + { eEncoding = INETMSG_ENCODING_QUOTED; + } else + { eEncoding = INETMSG_ENCODING_7BIT; + } } if (eEncoding == INETMSG_ENCODING_7BIT) { // No decoding necessary. - return INetMessageIOStream::PutMsgLine (pData, nSize); + return INetMessageIOStream::PutMsgLine(pData, nSize); } else { if (pDecodeStrm == NULL) { if (eEncoding == INETMSG_ENCODING_QUOTED) + { pDecodeStrm = new INetMessageDecodeQPStream_Impl; + } else + { pDecodeStrm = new INetMessageDecode64Stream_Impl; - - pDecodeStrm->SetTargetMessage (pMsg); + } + pDecodeStrm->SetTargetMessage(pMsg); } - return pDecodeStrm->Write (pData, nSize); + return pDecodeStrm->Write(pData, nSize); } } } diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 25e4d706b9d6..992c111748b0 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -78,11 +78,11 @@ size_t MultiSelection::ImplFindSubSelection( long nIndex ) const return n; } -sal_Bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 ) +bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 ) { // didn't a sub selection at nPos2 exist? if ( nPos2 >= aSels.size() ) - return sal_False; + return false; // did the sub selections touch each other? if ( (aSels[ nPos1 ]->Max() + 1) == aSels[ nPos2 ]->Min() ) @@ -93,18 +93,18 @@ sal_Bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 ) ::std::advance( it, nPos2 ); delete *it; aSels.erase( it ); - return sal_True; + return true; } - return sal_False; + return false; } MultiSelection::MultiSelection(): aTotRange( 0, -1 ), nCurSubSel(0), nSelCount(0), - bCurValid(sal_False), - bSelectNew(sal_False) + bCurValid(false), + bSelectNew(false) { } @@ -112,7 +112,7 @@ MultiSelection::MultiSelection( const MultiSelection& rOrig ) : aTotRange(rOrig.aTotRange), nSelCount(rOrig.nSelCount), bCurValid(rOrig.bCurValid), - bSelectNew(sal_False) + bSelectNew(false) { if ( bCurValid ) { @@ -129,8 +129,8 @@ MultiSelection::MultiSelection( const Range& rRange ): aTotRange(rRange), nCurSubSel(0), nSelCount(0), - bCurValid(sal_False), - bSelectNew(sal_False) + bCurValid(false), + bSelectNew(false) { } @@ -160,20 +160,20 @@ MultiSelection& MultiSelection::operator= ( const MultiSelection& rOrig ) return *this; } -sal_Bool MultiSelection::operator== ( MultiSelection& rWith ) +bool MultiSelection::operator== ( MultiSelection& rWith ) { if ( aTotRange != rWith.aTotRange || nSelCount != rWith.nSelCount || aSels.size() != rWith.aSels.size() ) - return sal_False; + return false; // compare the sub seletions for ( size_t n = 0; n < aSels.size(); ++n ) if ( *aSels[ n ] != *rWith.aSels[ n ] ) - return sal_False; - return sal_True; + return false; + return true; } -void MultiSelection::SelectAll( sal_Bool bSelect ) +void MultiSelection::SelectAll( bool bSelect ) { DBG(DbgOutf( "::SelectAll(%s)\n", bSelect ? "sal_True" : "sal_False" )); @@ -187,13 +187,13 @@ void MultiSelection::SelectAll( sal_Bool bSelect ) DBG(Print( this )); } -sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) +bool MultiSelection::Select( long nIndex, bool bSelect ) { DBG_ASSERT( aTotRange.IsInside(nIndex), "selected index out of range" ); // out of range? if ( !aTotRange.IsInside(nIndex) ) - return sal_False; + return false; // find the virtual target position size_t nSubSelPos = ImplFindSubSelection( nIndex ); @@ -203,7 +203,7 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) // is it included in the found sub selection? if ( nSubSelPos < aSels.size() && aSels[ nSubSelPos ]->IsInside( nIndex ) ) // already selected, nothing to do - return sal_False; + return false; // it will become selected ++nSelCount; @@ -246,7 +246,7 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) ) { // not selected, nothing to do DBG(Print( this )); - return sal_False; + return false; } // it will become deselected @@ -261,7 +261,7 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) delete *it; aSels.erase( it ); DBG(Print( this )); - return sal_True; + return true; } // is it at the beginning of the found sub selection? @@ -287,10 +287,10 @@ sal_Bool MultiSelection::Select( long nIndex, sal_Bool bSelect ) DBG(Print( this )); - return sal_True; + return true; } -void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) +void MultiSelection::Select( const Range& rIndexRange, bool bSelect ) { Range* pRange; long nOld; @@ -332,7 +332,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) pRange->Min() = (long)nTmpMin; nSelCount += ( nOld - nTmpMin ); } - bCurValid = sal_False; + bCurValid = false; } return; } @@ -355,7 +355,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) pRange->Max() = (long)nTmpMax; nSelCount += ( nTmpMax - nOld ); } - bCurValid = sal_False; + bCurValid = false; } return; } @@ -368,7 +368,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect ) } } -sal_Bool MultiSelection::IsSelected( long nIndex ) const +bool MultiSelection::IsSelected( long nIndex ) const { // find the virtual target position size_t nSubSelPos = ImplFindSubSelection( nIndex ); @@ -424,7 +424,7 @@ void MultiSelection::Insert( long nIndex, long nCount ) } } - bCurValid = sal_False; + bCurValid = false; aTotRange.Max() += nCount; if ( bSelectNew ) nSelCount += nCount; @@ -466,7 +466,7 @@ void MultiSelection::Remove( long nIndex ) --( aSels[ nPos ]->Max() ); } - bCurValid = sal_False; + bCurValid = false; aTotRange.Max() -= 1; DBG(Print( this )); @@ -488,7 +488,7 @@ long MultiSelection::ImplFwdUnselected() return SFX_ENDOFSELECTION; } -long MultiSelection::FirstSelected( sal_Bool bInverse ) +long MultiSelection::FirstSelected( bool bInverse ) { bInverseCur = bInverse; nCurSubSel = 0; @@ -598,7 +598,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) for ( size_t i = 0, n = aSels.size(); i < n; ++ i ) nSelCount += aSels[i]->Len(); - bCurValid = sal_False; + bCurValid = false; nCurIndex = 0; } diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index d18835c30495..d734242ed5ec 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -80,7 +80,7 @@ class InternalResMgr sal_uInt32 nOffCorrection; sal_uInt8 * pStringBlock; SvStream * pStm; - sal_Bool bEqual2Content; + bool bEqual2Content; sal_uInt32 nEntries; OUString aFileName; OUString aPrefix; @@ -94,9 +94,9 @@ class InternalResMgr const OUString& aResName, const LanguageTag& rLocale ); ~InternalResMgr(); - sal_Bool Create(); + bool Create(); - sal_Bool IsGlobalAvailable( RESOURCE_TYPE nRT, sal_uInt32 nId ) const; + bool IsGlobalAvailable( RESOURCE_TYPE nRT, sal_uInt32 nId ) const; void * LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, void **pResHandle ); public: @@ -421,7 +421,7 @@ InternalResMgr::InternalResMgr( const OUString& rFileURL, : pContent( NULL ) , pStringBlock( NULL ) , pStm( NULL ) - , bEqual2Content( sal_True ) + , bEqual2Content( true ) , nEntries( 0 ) , aFileName( rFileURL ) , aPrefix( rPrefix ) @@ -468,10 +468,10 @@ InternalResMgr::~InternalResMgr() delete pResUseDump; } -sal_Bool InternalResMgr::Create() +bool InternalResMgr::Create() { ResMgrContainer::get(); - sal_Bool bDone = sal_False; + bool bDone = false; pStm = new SvFileStream( aFileName, (STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE) ); if( pStm->GetError() == 0 ) @@ -496,8 +496,8 @@ sal_Bool InternalResMgr::Create() pContent = (ImpContent *)rtl_allocateMemory( sizeof(ImpContent)*lContLen/12 ); // Shorten to number of ImpContent nEntries = (sal_uInt32)lContLen / 12; - bEqual2Content = sal_True; - sal_Bool bSorted = sal_True; + bEqual2Content = true; + bool bSorted = true; if( nEntries ) { #ifdef DBG_UTIL @@ -519,10 +519,10 @@ sal_Bool InternalResMgr::Create() pContent[j].nTypeAndId = ResMgr::GetUInt64( pContentBuf + (12*j) ); pContent[j].nOffset = ResMgr::GetLong( pContentBuf + (12*j+8) ); if( pContent[i].nTypeAndId >= pContent[j].nTypeAndId ) - bSorted = sal_False; + bSorted = false; if( (pContent[i].nTypeAndId & 0xFFFFFFFF00000000LL) == (pContent[j].nTypeAndId & 0xFFFFFFFF00000000LL) && pContent[i].nOffset >= pContent[j].nOffset ) - bEqual2Content = sal_False; + bEqual2Content = false; } } rtl_freeMemory( pContentBuf ); @@ -532,14 +532,14 @@ sal_Bool InternalResMgr::Create() ::std::sort(pContent,pContent+nEntries,ImpContentLessCompare()); // qsort( pContent, nEntries, sizeof( ImpContent ), Compare ); - bDone = sal_True; + bDone = true; } return bDone; } -sal_Bool InternalResMgr::IsGlobalAvailable( RESOURCE_TYPE nRT, sal_uInt32 nId ) const +bool InternalResMgr::IsGlobalAvailable( RESOURCE_TYPE nRT, sal_uInt32 nId ) const { // Anfang der Strings suchen ImpContent aValue; @@ -624,12 +624,12 @@ void InternalResMgr::FreeGlobalRes( void * pResHandle, void * pResource ) OUString GetTypeRes_Impl( const ResId& rTypeId ) { // Return on resource errors - static int bInUse = sal_False; + static int bInUse = false; OUString aTypStr(OUString::number(rTypeId.GetId())); if ( !bInUse ) { - bInUse = sal_True; + bInUse = true; ResId aResId( sal_uInt32(RSCVERSION_ID), *rTypeId.GetResMgr() ); aResId.SetRT( RSC_VERSIONCONTROL ); @@ -644,7 +644,7 @@ OUString GetTypeRes_Impl( const ResId& rTypeId ) rTypeId.GetResMgr()->Increment( sizeof( RSHEADER_TYPE ) ); } } - bInUse = sal_False; + bInUse = false; } return aTypStr; @@ -925,11 +925,11 @@ void ResMgr::TestStack( const Resource* ) #endif -sal_Bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const +bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); - sal_Bool bAvailable = sal_False; + bool bAvailable = false; RSHEADER_TYPE* pClassRes = rId.GetpResource(); RESOURCE_TYPE nRT = rId.GetRT2(); sal_uInt32 nId = rId.GetId(); @@ -952,7 +952,7 @@ sal_Bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const if ( pClassRes ) { if ( pClassRes->GetRT() == nRT ) - bAvailable = sal_True; + bAvailable = true; } } @@ -972,7 +972,7 @@ void* ResMgr::GetClass() return aStack[nCurStack].pClassRes; } -sal_Bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) +bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); @@ -1017,7 +1017,7 @@ sal_Bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) pTop->Flags |= RC_NOTFOUND; pTop->pClassRes = getEmptyBuffer(); pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes; - return sal_False; + return false; } } else @@ -1065,12 +1065,12 @@ sal_Bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) pTop->Flags |= RC_NOTFOUND; pTop->pClassRes = getEmptyBuffer(); pTop->pResource = (RSHEADER_TYPE*)pTop->pClassRes; - return sal_False; + return false; } } } - return sal_True; + return true; } void * ResMgr::GetResourceSkipHeader( const ResId& rResId, ResMgr ** ppResMgr ) diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 0ac0de87a9ac..057cc8aa1b69 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -36,7 +36,7 @@ public: ErrorHandler *pFirstHdl; ErrorContext *pFirstCtx; DisplayFnPtr pDsp; - sal_Bool bIsWindowDsp; + bool bIsWindowDsp; DynamicErrorInfo *ppDcr[ERRCODE_DYNAMIC_COUNT]; sal_uInt16 nNextDcr; @@ -171,7 +171,7 @@ class ErrHdl_Impl { public: ErrorHandler *pNext; - static sal_Bool CreateString(const ErrorHandler *pStart, + static bool CreateString(const ErrorHandler *pStart, const ErrorInfo*, OUString&, sal_uInt16&); }; @@ -231,14 +231,14 @@ ErrorHandler::~ErrorHandler() void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp) { EDcrData *pData=EDcrData::GetData(); - pData->bIsWindowDsp=sal_True; + pData->bIsWindowDsp=true; pData->pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); } void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp) { EDcrData *pData=EDcrData::GetData(); - pData->bIsWindowDsp=sal_False; + pData->bIsWindowDsp=false; pData->pDsp = reinterpret_cast< DisplayFnPtr >(aDsp); } @@ -261,7 +261,7 @@ void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp) @return ??? */ sal_uInt16 ErrorHandler::HandleError_Impl( - sal_uIntPtr lId, sal_uInt16 nFlags, sal_Bool bJustCreateString, OUString & rError) + sal_uIntPtr lId, sal_uInt16 nFlags, bool bJustCreateString, OUString & rError) { OUString aErr; OUString aAction; @@ -281,7 +281,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( break; } - sal_Bool bWarning = ((lId & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); + bool bWarning = ((lId & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); sal_uInt16 nErrFlags = ERRCODE_BUTTON_DEF_OK | ERRCODE_BUTTON_OK; if (bWarning) nErrFlags |= ERRCODE_MSG_WARNING; @@ -346,9 +346,9 @@ sal_uInt16 ErrorHandler::HandleError_Impl( } // static -sal_Bool ErrorHandler::GetErrorString(sal_uIntPtr lId, OUString& rStr) +bool ErrorHandler::GetErrorString(sal_uIntPtr lId, OUString& rStr) { - return (sal_Bool)HandleError_Impl( lId, USHRT_MAX, sal_True, rStr ); + return (bool)HandleError_Impl( lId, USHRT_MAX, true, rStr ); } /** Handles an error. @@ -358,22 +358,22 @@ sal_Bool ErrorHandler::GetErrorString(sal_uIntPtr lId, OUString& rStr) sal_uInt16 ErrorHandler::HandleError(sal_uIntPtr lId, sal_uInt16 nFlags) { OUString aDummy; - return HandleError_Impl( lId, nFlags, sal_False, aDummy ); + return HandleError_Impl( lId, nFlags, false, aDummy ); } -sal_Bool ErrHdl_Impl::CreateString( const ErrorHandler *pStart, +bool ErrHdl_Impl::CreateString( const ErrorHandler *pStart, const ErrorInfo* pInfo, OUString& pStr, sal_uInt16 &rFlags) { for(const ErrorHandler *pHdl=pStart;pHdl;pHdl=pHdl->pImpl->pNext) { if(pHdl->CreateString( pInfo, pStr, rFlags)) - return sal_True; + return true; } - return sal_False; + return false; } -sal_Bool SimpleErrorHandler::CreateString( +bool SimpleErrorHandler::CreateString( const ErrorInfo *pInfo, OUString &rStr, sal_uInt16 &) const { sal_uIntPtr nId = pInfo->GetErrorCode(); @@ -397,7 +397,7 @@ sal_Bool SimpleErrorHandler::CreateString( } rStr = OStringToOUString(aStr.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); - return sal_True; + return true; } SimpleErrorHandler::SimpleErrorHandler() diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 1ed7b0e12e1b..d6ce83115b90 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -40,7 +40,7 @@ ImpSvGlobalName::ImpSvGlobalName( Empty ) memset( szData, 0, sizeof( szData ) ); } -sal_Bool ImpSvGlobalName::operator == ( const ImpSvGlobalName & rObj ) const +bool ImpSvGlobalName::operator == ( const ImpSvGlobalName & rObj ) const { return !memcmp( szData, rObj.szData, sizeof( szData ) ); } @@ -157,14 +157,14 @@ SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj ) } -sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const +bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const { int n = memcmp( pImp->szData +6, rObj.pImp->szData +6, sizeof( pImp->szData ) -6); if( n < 0 ) - return sal_True; + return true; else if( n > 0 ) - return sal_False; + return false; sal_uInt16 Data2_a; memcpy(&Data2_a, pImp->szData+4, sizeof(sal_uInt16)); @@ -173,7 +173,7 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const memcpy(&Data2_b, rObj.pImp->szData+4, sizeof(sal_uInt16)); if( Data2_a < Data2_b ) - return sal_True; + return true; else if( Data2_a == Data2_b ) { sal_uInt32 Data1_a; @@ -185,7 +185,7 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const return Data1_a < Data1_b; } else - return sal_False; + return false; } @@ -209,7 +209,7 @@ SvGlobalName & SvGlobalName::operator += ( sal_uInt32 n ) return *this; } -sal_Bool SvGlobalName::operator == ( const SvGlobalName & rObj ) const +bool SvGlobalName::operator == ( const SvGlobalName & rObj ) const { return *pImp == *rObj.pImp; } @@ -220,12 +220,12 @@ void SvGlobalName::MakeFromMemory( void * pData ) memcpy( pImp->szData, pData, sizeof( pImp->szData ) ); } -sal_Bool SvGlobalName::MakeId( const String & rIdStr ) +bool SvGlobalName::MakeId( const OUString & rIdStr ) { OString aStr(OUStringToOString(rIdStr, RTL_TEXTENCODING_ASCII_US)); const sal_Char *pStr = aStr.getStr(); - if( rIdStr.Len() == 36 + if( rIdStr.getLength() == 36 && '-' == pStr[ 8 ] && '-' == pStr[ 13 ] && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] ) { @@ -239,7 +239,7 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) else nFirst = nFirst * 16 + (toupper( *pStr ) - 'A' + 10 ); else - return sal_False; + return false; pStr++; } @@ -253,7 +253,7 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) else nSec = nSec * 16 + (sal_uInt16)(toupper( *pStr ) - 'A' + 10 ); else - return sal_False; + return false; pStr++; } @@ -267,7 +267,7 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) else nThird = nThird * 16 + (sal_uInt16)(toupper( *pStr ) - 'A' + 10 ); else - return sal_False; + return false; pStr++; } @@ -282,7 +282,7 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) else szRemain[i/2] = szRemain[i/2] * 16 + (sal_Int8)(toupper( *pStr ) - 'A' + 10 ); else - return sal_False; + return false; pStr++; if( i == 3 ) pStr++; @@ -293,12 +293,12 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) memcpy(&pImp->szData[4], &nSec, sizeof(nSec)); memcpy(&pImp->szData[6], &nThird, sizeof(nThird)); memcpy(&pImp->szData[ 8 ], szRemain, 8); - return sal_True; + return true; } - return sal_False; + return false; } -String SvGlobalName::GetHexName() const +OUString SvGlobalName::GetHexName() const { OStringBuffer aHexBuffer; diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 66e4a28909c7..fae8e124d80f 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -141,7 +141,7 @@ SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, sal , nFlags( 0 ) { DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ); - bIsWritable = sal_True; + bIsWritable = true; if( pStm ) { SetVersion( pStm->GetVersion() ); @@ -555,7 +555,7 @@ SvPersistStream& SvPersistStream::WritePointer sal_uInt32 SvPersistStream::ReadObj ( SvPersistBase * & rpObj, - sal_Bool bRegister + bool bRegister ) { sal_uInt8 nHdr; @@ -638,7 +638,7 @@ SvPersistStream& SvPersistStream::ReadPointer SvPersistBase * & rpObj ) { - ReadObj( rpObj, sal_True ); + ReadObj( rpObj, true ); return *this; } @@ -705,7 +705,7 @@ SvStream& operator >> { SvPersistBase * pEle; // read, but don't insert into table - sal_uIntPtr nId = rThis.ReadObj( pEle, sal_False ); + sal_uIntPtr nId = rThis.ReadObj( pEle, false ); if( rThis.GetError() ) break; diff --git a/tools/source/stream/cachestr.cxx b/tools/source/stream/cachestr.cxx index e8d34fdb1f65..8b988b136ff7 100644 --- a/tools/source/stream/cachestr.cxx +++ b/tools/source/stream/cachestr.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <rtl/ustring.hxx> #include <tools/stream.hxx> #include <tools/cachestr.hxx> #include <tools/tempfile.hxx> @@ -25,9 +26,9 @@ SvCacheStream::SvCacheStream( sal_uIntPtr nMaxMemSize ) { if( !nMaxMemSize ) nMaxMemSize = 20480; - SvStream::bIsWritable = sal_True; + SvStream::bIsWritable = true; nMaxSize = nMaxMemSize; - bPersistent = sal_False; + bPersistent = false; pSwapStream = 0; pCurrentStream = new SvMemoryStream( nMaxMemSize ); pTempFile = 0; @@ -42,7 +43,7 @@ SvCacheStream::~SvCacheStream() if( pSwapStream && !bPersistent && pTempFile ) { // temporaeres File loeschen - pTempFile->EnableKillingFile( sal_True ); + pTempFile->EnableKillingFile( true ); } delete pTempFile; @@ -52,7 +53,7 @@ void SvCacheStream::SwapOut() { if( pCurrentStream != pSwapStream ) { - if( !pSwapStream && !aFileName.Len() ) + if( !pSwapStream && aFileName.isEmpty() ) { pTempFile = new TempFile; aFileName = pTempFile->GetName(); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index cc7667dd17bd..6f350abf0d31 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -112,7 +112,7 @@ inline static void SwapDouble( double& r ) { if( sizeof(double) != 8 ) { - DBG_ASSERT( sal_False, "Can only swap 8-Byte-doubles\n" ); + DBG_ASSERT( false, "Can only swap 8-Byte-doubles\n" ); } else { @@ -136,37 +136,36 @@ inline static void SwapDouble( double& r ) //SDO #define READNUMBER_WITHOUT_SWAP(datatype,value) \ -{\ -int tmp = eIOMode; \ -if( (tmp == STREAM_IO_READ) && sizeof(datatype)<=nBufFree) \ -{\ - for (std::size_t i = 0; i < sizeof(datatype); i++)\ - ((char *)&value)[i] = pBufPos[i];\ - nBufActualPos += sizeof(datatype);\ - pBufPos += sizeof(datatype);\ - nBufFree -= sizeof(datatype);\ -}\ -else\ - Read( (char*)&value, sizeof(datatype) );\ -} + if( bIoRead && sizeof(datatype)<=nBufFree) \ + { \ + for (std::size_t i = 0; i < sizeof(datatype); i++) \ + ((char *)&value)[i] = pBufPos[i]; \ + nBufActualPos += sizeof(datatype); \ + pBufPos += sizeof(datatype); \ + nBufFree -= sizeof(datatype); \ + } \ + else \ + { \ + Read( (char*)&value, sizeof(datatype) ); \ + } \ + #define WRITENUMBER_WITHOUT_SWAP(datatype,value) \ -{\ -int tmp = eIOMode; \ -if( (tmp==STREAM_IO_WRITE) && sizeof(datatype) <= nBufFree)\ -{\ - for (std::size_t i = 0; i < sizeof(datatype); i++)\ - pBufPos[i] = ((char *)&value)[i];\ - nBufFree -= sizeof(datatype);\ - nBufActualPos += sizeof(datatype);\ - if( nBufActualPos > nBufActualLen )\ - nBufActualLen = nBufActualPos;\ - pBufPos += sizeof(datatype);\ - bIsDirty = sal_True;\ -}\ -else\ - Write( (char*)&value, sizeof(datatype) );\ -} + if( bIoWrite && sizeof(datatype) <= nBufFree) \ + { \ + for (std::size_t i = 0; i < sizeof(datatype); i++) \ + pBufPos[i] = ((char *)&value)[i]; \ + nBufFree -= sizeof(datatype); \ + nBufActualPos += sizeof(datatype); \ + if( nBufActualPos > nBufActualLen ) \ + nBufActualLen = nBufActualPos; \ + pBufPos += sizeof(datatype); \ + bIsDirty = true; \ + } \ + else \ + { \ + Write( (char*)&value, sizeof(datatype) ); \ + } \ // class SvLockBytes @@ -381,7 +380,7 @@ void SvStream::ImpInit() nCompressMode = COMPRESSMODE_NONE; eStreamCharSet = osl_getThreadTextEncoding(); nCryptMask = 0; - bIsEof = sal_False; + bIsEof = false; #if defined UNX eLineDelimiter = LINEEND_LF; // UNIX-Format #else @@ -392,15 +391,16 @@ void SvStream::ImpInit() nBufFilePos = 0; nBufActualPos = 0; - bIsDirty = sal_False; - bIsConsistent = sal_True; - bIsWritable = sal_True; + bIsDirty = false; + bIsConsistent = true; + bIsWritable = true; pRWBuf = 0; pBufPos = 0; nBufSize = 0; nBufActualLen = 0; - eIOMode = STREAM_IO_DONTKNOW; + bIoRead = false; + bIoWrite = false; nBufFree = 0; eStreamMode = 0; @@ -450,7 +450,7 @@ sal_uInt16 SvStream::IsA() const void SvStream::ClearError() { - bIsEof = sal_False; + bIsEof = false; nError = SVSTREAM_OK; } @@ -463,20 +463,20 @@ void SvStream::SetError( sal_uInt32 nErrorCode ) void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat ) { nNumberFormatInt = nNewFormat; - bSwap = sal_False; + bSwap = false; #ifdef OSL_BIGENDIAN if( nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN ) - bSwap = sal_True; + bSwap = true; #else if( nNumberFormatInt == NUMBERFORMAT_INT_BIGENDIAN ) - bSwap = sal_True; + bSwap = true; #endif } void SvStream::SetBufferSize( sal_uInt16 nBufferSize ) { sal_Size nActualFilePos = Tell(); - sal_Bool bDontSeek = (sal_Bool)(pRWBuf == 0); + bool bDontSeek = (pRWBuf == 0); if( bIsDirty && bIsConsistent && bIsWritable ) // due to Windows NT: Access denied Flush(); @@ -493,9 +493,9 @@ void SvStream::SetBufferSize( sal_uInt16 nBufferSize ) nBufSize = nBufferSize; if( nBufSize ) pRWBuf = new sal_uInt8[ nBufSize ]; - bIsConsistent = sal_True; + bIsConsistent = true; pBufPos = pRWBuf; - eIOMode = STREAM_IO_DONTKNOW; + bIoRead = bIoWrite = false; if( !bDontSeek ) SeekPos( nActualFilePos ); } @@ -506,11 +506,11 @@ void SvStream::ClearBuffer() nBufActualPos = 0; nBufFilePos = 0; pBufPos = pRWBuf; - bIsDirty = sal_False; - bIsConsistent = sal_True; - eIOMode = STREAM_IO_DONTKNOW; + bIsDirty = false; + bIsConsistent = true; + bIoRead = bIoWrite = false; - bIsEof = sal_False; + bIsEof = false; } void SvStream::ResetError() @@ -518,27 +518,19 @@ void SvStream::ResetError() ClearError(); } -sal_Bool SvStream::ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, +bool SvStream::ReadByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxBytesToRead ) { OString aStr; - sal_Bool bRet = ReadLine( aStr, nMaxBytesToRead); - rStr = OStringToOUString(aStr, eSrcCharSet); - return bRet; -} - -sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet ) -{ - OString aStr; - sal_Bool bRet = ReadLine(aStr); + bool bRet = ReadLine( aStr, nMaxBytesToRead); rStr = OStringToOUString(aStr, eSrcCharSet); return bRet; } -sal_Bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) +bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) { sal_Char buf[256+1]; - sal_Bool bEnd = sal_False; + bool bEnd = false; sal_Size nOldFilePos = Tell(); sal_Char c = 0; sal_Size nTotalLen = 0; @@ -553,9 +545,9 @@ sal_Bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) if ( aBuf.isEmpty() ) { // Exit on first block-read error - bIsEof = sal_True; + bIsEof = true; rStr = OString(); - return sal_False; + return false; } else break; @@ -567,7 +559,7 @@ sal_Bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) c = buf[j]; if ( c == '\n' || c == '\r' ) { - bEnd = sal_True; + bEnd = true; break; } if ( n < j ) @@ -579,14 +571,14 @@ sal_Bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) { n -= nTotalLen - nMaxBytesToRead; nTotalLen = nMaxBytesToRead; - bEnd = sal_True; + bEnd = true; } if ( n ) aBuf.append(buf, n); } if ( !bEnd && !GetError() && !aBuf.isEmpty() ) - bEnd = sal_True; + bEnd = true; nOldFilePos += nTotalLen; if( Tell() > nOldFilePos ) @@ -604,15 +596,15 @@ sal_Bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) } if ( bEnd ) - bIsEof = sal_False; + bIsEof = false; rStr = aBuf.makeStringAndClear(); return bEnd; } -sal_Bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ) +bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ) { sal_Unicode buf[256+1]; - sal_Bool bEnd = sal_False; + bool bEnd = false; sal_Size nOldFilePos = Tell(); sal_Unicode c = 0; sal_Size nTotalLen = 0; @@ -630,9 +622,9 @@ sal_Bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsTo if ( aBuf.isEmpty() ) { // exit on first BlockRead error - bIsEof = sal_True; + bIsEof = true; rStr = OUString(); - return sal_False; + return false; } else break; @@ -646,7 +638,7 @@ sal_Bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsTo c = buf[j]; if ( c == '\n' || c == '\r' ) { - bEnd = sal_True; + bEnd = true; break; } // erAck 26.02.01: Old behavior was no special treatment of '\0' @@ -665,14 +657,14 @@ sal_Bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsTo { n -= nTotalLen - nMaxCodepointsToRead; nTotalLen = nMaxCodepointsToRead; - bEnd = sal_True; + bEnd = true; } if ( n ) aBuf.append( buf, n ); } if ( !bEnd && !GetError() && !aBuf.isEmpty() ) - bEnd = sal_True; + bEnd = true; nOldFilePos += nTotalLen * sizeof(sal_Unicode); if( Tell() > nOldFilePos ) @@ -690,12 +682,12 @@ sal_Bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsTo } if ( bEnd ) - bIsEof = sal_False; + bIsEof = false; rStr = aBuf.makeStringAndClear(); return bEnd; } -sal_Bool SvStream::ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, +bool SvStream::ReadUniOrByteStringLine( OUString& rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxCodepointsToRead ) { if ( eSrcCharSet == RTL_TEXTENCODING_UNICODE ) @@ -709,7 +701,7 @@ OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream) OStringBuffer aOutput(256); sal_Char buf[ 256 + 1 ]; - sal_Bool bEnd = sal_False; + bool bEnd = false; sal_Size nFilePos = rStream.Tell(); while( !bEnd && !rStream.GetError() ) @@ -772,11 +764,11 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, return nWritten; } -sal_Bool SvStream::WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding eDestCharSet ) +bool SvStream::WriteUnicodeOrByteText( const OUString& rStr, rtl_TextEncoding eDestCharSet ) { if ( eDestCharSet == RTL_TEXTENCODING_UNICODE ) { - write_uInt16s_FromOUString(*this, rStr, rStr.Len()); + write_uInt16s_FromOUString(*this, rStr, rStr.getLength()); return nError == SVSTREAM_OK; } else @@ -787,19 +779,19 @@ sal_Bool SvStream::WriteUnicodeOrByteText( const String& rStr, rtl_TextEncoding } } -sal_Bool SvStream::WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet ) +bool SvStream::WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDestCharSet ) { return WriteLine(OUStringToOString(rStr, eDestCharSet)); } -sal_Bool SvStream::WriteLine(const OString& rStr) +bool SvStream::WriteLine(const OString& rStr) { Write(rStr.getStr(), rStr.getLength()); endl(*this); return nError == SVSTREAM_OK; } -sal_Bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet ) +bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet ) { if ( eDestCharSet == RTL_TEXTENCODING_UNICODE ) *this << ch; @@ -811,9 +803,9 @@ sal_Bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCha return nError == SVSTREAM_OK; } -sal_Bool SvStream::StartWritingUnicodeText() +bool SvStream::StartWritingUnicodeText() { - SetEndianSwap( sal_False ); // write native format + SetEndianSwap( false ); // write native format // BOM, Byte Order Mark, U+FEFF, see // http://www.unicode.org/faq/utf_bom.html#BOM // Upon read: 0xfeff(-257) => no swap; 0xfffe(-2) => swap @@ -821,12 +813,12 @@ sal_Bool SvStream::StartWritingUnicodeText() return nError == SVSTREAM_OK; } -sal_Bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ) +bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ) { if (!( eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW || eReadBomCharSet == RTL_TEXTENCODING_UNICODE || eReadBomCharSet == RTL_TEXTENCODING_UTF8)) - return sal_True; // nothing to read + return true; // nothing to read bool bTryUtf8 = false; sal_uInt16 nFlag; @@ -977,7 +969,7 @@ SvStream& SvStream::operator>>(sal_Int64& r) SvStream& SvStream::operator>>( signed char& r ) { - if( (eIOMode == STREAM_IO_READ || !bIsConsistent) && + if( (bIoRead || !bIsConsistent) && sizeof(signed char) <= nBufFree ) { r = *pBufPos; @@ -994,7 +986,7 @@ SvStream& SvStream::operator>>( signed char& r ) SvStream& SvStream::operator>>( char& r ) { - if( (eIOMode == STREAM_IO_READ || !bIsConsistent) && + if( (bIoRead || !bIsConsistent) && sizeof(char) <= nBufFree ) { r = *pBufPos; @@ -1009,7 +1001,7 @@ SvStream& SvStream::operator>>( char& r ) SvStream& SvStream::operator>>( unsigned char& r ) { - if( (eIOMode == STREAM_IO_READ || !bIsConsistent) && + if( (bIoRead || !bIsConsistent) && sizeof(char) <= nBufFree ) { r = *pBufPos; @@ -1118,8 +1110,7 @@ SvStream& SvStream::operator<< ( sal_Int64 v ) SvStream& SvStream::operator<< ( signed char v ) { //SDO - int tmp = eIOMode; - if(tmp == STREAM_IO_WRITE && sizeof(signed char) <= nBufFree ) + if(bIoWrite && sizeof(signed char) <= nBufFree ) { *pBufPos = v; pBufPos++; // sizeof(char); @@ -1127,7 +1118,7 @@ SvStream& SvStream::operator<< ( signed char v ) if( nBufActualPos > nBufActualLen ) // Append ? nBufActualLen = nBufActualPos; nBufFree--; // = sizeof(char); - bIsDirty = sal_True; + bIsDirty = true; } else Write( (char*)&v, sizeof(signed char) ); @@ -1139,8 +1130,7 @@ SvStream& SvStream::operator<< ( signed char v ) SvStream& SvStream::operator<< ( char v ) { //SDO - int tmp = eIOMode; - if(tmp == STREAM_IO_WRITE && sizeof(char) <= nBufFree ) + if(bIoWrite && sizeof(char) <= nBufFree ) { *pBufPos = v; pBufPos++; // sizeof(char); @@ -1148,7 +1138,7 @@ SvStream& SvStream::operator<< ( char v ) if( nBufActualPos > nBufActualLen ) // Append ? nBufActualLen = nBufActualPos; nBufFree--; // = sizeof(char); - bIsDirty = sal_True; + bIsDirty = true; } else Write( (char*)&v, sizeof(char) ); @@ -1158,8 +1148,7 @@ SvStream& SvStream::operator<< ( char v ) SvStream& SvStream::operator<< ( unsigned char v ) { //SDO - int tmp = eIOMode; - if(tmp == STREAM_IO_WRITE && sizeof(char) <= nBufFree ) + if(bIoWrite && sizeof(char) <= nBufFree ) { *(unsigned char*)pBufPos = v; pBufPos++; // = sizeof(char); @@ -1167,7 +1156,7 @@ SvStream& SvStream::operator<< ( unsigned char v ) if( nBufActualPos > nBufActualLen ) // Append ? nBufActualLen = nBufActualPos; nBufFree--; - bIsDirty = sal_True; + bIsDirty = true; } else Write( (char*)&v, sizeof(char) ); @@ -1261,7 +1250,8 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) else { // check if block is completely within buffer - eIOMode = STREAM_IO_READ; + bIoRead = true; + bIoWrite = false; if( nCount <= (sal_Size)(nBufActualLen - nBufActualPos ) ) { // => yes @@ -1279,7 +1269,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) CryptAndWriteBuffer(pRWBuf, nBufActualLen); else PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; + bIsDirty = false; } // Does data block fit into buffer? @@ -1288,7 +1278,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) // => No! Thus read directly // into target area without using the buffer - eIOMode = STREAM_IO_DONTKNOW; + bIoRead = false; SeekPos( nBufFilePos + nBufActualPos ); nBufActualLen = 0; @@ -1322,10 +1312,10 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) } } } - bIsEof = sal_False; + bIsEof = false; nBufFree = nBufActualLen - nBufActualPos; if( nCount != nSaveCount && nError != ERRCODE_IO_PENDING ) - bIsEof = sal_True; + bIsEof = true; if( nCount == nSaveCount && nError == ERRCODE_IO_PENDING ) nError = ERRCODE_NONE; return nCount; @@ -1353,7 +1343,8 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) return nCount; } - eIOMode = STREAM_IO_WRITE; + bIoRead = false; + bIoWrite = true; if( nCount <= (sal_Size)(nBufSize - nBufActualPos) ) { memcpy( pBufPos, pData, (size_t)nCount ); @@ -1363,7 +1354,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) nBufActualLen = nBufActualPos; pBufPos += nCount; - bIsDirty = sal_True; + bIsDirty = true; } else { @@ -1375,13 +1366,13 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen ); else PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; + bIsDirty = false; } // Does data block fit into buffer? if( nCount > nBufSize ) { - eIOMode = STREAM_IO_DONTKNOW; + bIoWrite = false; nBufFilePos += nBufActualPos; nBufActualLen = 0; nBufActualPos = 0; @@ -1403,7 +1394,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) nBufActualPos = (sal_uInt16)nCount; pBufPos = pRWBuf + nCount; nBufActualLen = (sal_uInt16)nCount; - bIsDirty = sal_True; + bIsDirty = true; } } nBufFree = nBufSize - nBufActualPos; @@ -1412,9 +1403,8 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount ) sal_Size SvStream::Seek( sal_Size nFilePos ) { - eIOMode = STREAM_IO_DONTKNOW; - - bIsEof = sal_False; + bIoRead = bIoWrite = false; + bIsEof = false; if( !pRWBuf ) { nBufFilePos = SeekPos( nFilePos ); @@ -1439,7 +1429,7 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) CryptAndWriteBuffer( pRWBuf, nBufActualLen ); else PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; + bIsDirty = false; } nBufActualLen = 0; nBufActualPos = 0; @@ -1477,7 +1467,7 @@ void SvStream::Flush() else if( PutData( pRWBuf, nBufActualLen ) != nBufActualLen ) SetError( SVSTREAM_WRITE_ERROR ); - bIsDirty = sal_False; + bIsDirty = false; } if( bIsWritable ) FlushData(); @@ -1492,7 +1482,7 @@ void SvStream::RefreshBuffer() CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen ); else PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; + bIsDirty = false; } SeekPos( nBufFilePos ); nBufActualLen = (sal_uInt16)GetData( pRWBuf, nBufSize ); @@ -1500,8 +1490,8 @@ void SvStream::RefreshBuffer() nError = ERRCODE_NONE; if( nCryptMask ) EncryptBuffer(pRWBuf, (sal_Size)nBufActualLen); - bIsConsistent = sal_True; - eIOMode = STREAM_IO_DONTKNOW; + bIsConsistent = true; + bIoRead = bIoWrite = false; } SvStream& SvStream::WriteNumber(sal_Int32 nInt32) @@ -1554,7 +1544,7 @@ sal_Size SvStream::CryptAndWriteBuffer( const void* pStart, sal_Size nLen) return nCount; } -sal_Bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen) +bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen) { unsigned char* pTemp = (unsigned char*)pStart; unsigned char nMask = nCryptMask; @@ -1566,7 +1556,7 @@ sal_Bool SvStream::EncryptBuffer(void* pStart, sal_Size nLen) aCh ^= nMask; *pTemp = aCh; } - return sal_True; + return true; } static unsigned char implGetCryptMask(const sal_Char* pStr, sal_Int32 nLen, long nVersion) @@ -1623,7 +1613,7 @@ void SvStream::SyncSysStream() SeekPos( Tell() ); } -sal_Bool SvStream::SetStreamSize( sal_Size nSize ) +bool SvStream::SetStreamSize( sal_Size nSize ) { #ifdef DBG_UTIL sal_Size nFPos = Tell(); @@ -1633,7 +1623,7 @@ sal_Bool SvStream::SetStreamSize( sal_Size nSize ) SetSize( nSize ); SetBufferSize( nBuf ); DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed"); - return (sal_Bool)(nError == 0); + return (nError == 0); } SvStream& endl( SvStream& rStr ) @@ -1676,11 +1666,11 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize, StreamMode eMode ) { if( eMode & STREAM_WRITE ) - bIsWritable = sal_True; + bIsWritable = true; else - bIsWritable = sal_False; + bIsWritable = false; nEndOfData = bufSize; - bOwnsData = sal_False; + bOwnsData = false; pBuf = (sal_uInt8 *) pBuffer; nResize = 0L; nSize = bufSize; @@ -1690,8 +1680,8 @@ SvMemoryStream::SvMemoryStream( void* pBuffer, sal_Size bufSize, SvMemoryStream::SvMemoryStream( sal_Size nInitSize, sal_Size nResizeOffset ) { - bIsWritable = sal_True; - bOwnsData = sal_True; + bIsWritable = true; + bOwnsData = true; nEndOfData = 0L; nResize = nResizeOffset; nPos = 0; @@ -1725,7 +1715,7 @@ sal_uInt16 SvMemoryStream::IsA() const } void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount, - sal_Bool bOwnsDat, sal_Size nEOF ) + bool bOwnsDat, sal_Size nEOF ) { void* pResult; SetBufferSize( 0 ); // Buffering in der Basisklasse initialisieren @@ -1865,16 +1855,16 @@ void SvMemoryStream::ResetError() SvStream::ClearError(); } -sal_Bool SvMemoryStream::AllocateMemory( sal_Size nNewSize ) +bool SvMemoryStream::AllocateMemory( sal_Size nNewSize ) { pBuf = new sal_uInt8[nNewSize]; return( pBuf != 0 ); } // (using Bozo algorithm) -sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff ) +bool SvMemoryStream::ReAllocateMemory( long nDiff ) { - sal_Bool bRetVal = sal_False; + bool bRetVal = false; long nTemp = (long)nSize; nTemp += nDiff; sal_Size nNewSize = (sal_Size)nTemp; @@ -1885,7 +1875,7 @@ sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff ) if( pNewBuf ) { - bRetVal = sal_True; // Success! + bRetVal = true; // Success! if( nNewSize < nSize ) // Are we shrinking? { memcpy( pNewBuf, pBuf, (size_t)nNewSize ); @@ -1907,7 +1897,7 @@ sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff ) } else { - bRetVal = sal_True; + bRetVal = true; FreeMemory(); pBuf = 0; nSize = 0; diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 65b051a253f7..61e7fa87a0d9 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -54,7 +54,7 @@ class InternalStreamLock InternalStreamLock( sal_Size, sal_Size, SvFileStream* ); ~InternalStreamLock(); public: - static sal_Bool LockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* ); + static bool LockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* ); static void UnlockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* ); }; @@ -103,24 +103,24 @@ InternalStreamLock::~InternalStreamLock() #endif } -sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* pStream ) +bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* pStream ) { osl::MutexGuard aGuard( LockMutex::get() ); osl::DirectoryItem aItem; if (osl::DirectoryItem::get( pStream->GetFileName(), aItem) != osl::FileBase::E_None ) { SAL_INFO("tools.stream", "Failed to lookup stream for locking"); - return sal_True; + return true; } osl::FileStatus aStatus( osl_FileStatus_Mask_Type ); if ( aItem.getFileStatus( aStatus ) != osl::FileBase::E_None ) { SAL_INFO("tools.stream", "Failed to stat stream for locking"); - return sal_True; + return true; } if( aStatus.getFileType() == osl::FileStatus::Directory ) - return sal_True; + return true; InternalStreamLock* pLock = NULL; InternalStreamLockList &rLockList = LockList::get(); @@ -129,35 +129,35 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, sal_Size nEnd, SvFileStr pLock = rLockList[ i ]; if( aItem.isIdenticalTo( pLock->m_aItem ) ) { - sal_Bool bDenyByOptions = sal_False; + bool bDenyByOptions = false; StreamMode nLockMode = pLock->m_pStream->GetStreamMode(); StreamMode nNewMode = pStream->GetStreamMode(); if( nLockMode & STREAM_SHARE_DENYALL ) - bDenyByOptions = sal_True; + bDenyByOptions = true; else if( ( nLockMode & STREAM_SHARE_DENYWRITE ) && ( nNewMode & STREAM_WRITE ) ) - bDenyByOptions = sal_True; + bDenyByOptions = true; else if( ( nLockMode & STREAM_SHARE_DENYREAD ) && ( nNewMode & STREAM_READ ) ) - bDenyByOptions = sal_True; + bDenyByOptions = true; if( bDenyByOptions ) { if( pLock->m_nStartPos == 0 && pLock->m_nEndPos == 0 ) // whole file is already locked - return sal_False; + return false; if( nStart == 0 && nEnd == 0) // cannot lock whole file - return sal_False; + return false; if( ( nStart < pLock->m_nStartPos && nEnd > pLock->m_nStartPos ) || ( nStart < pLock->m_nEndPos && nEnd > pLock->m_nEndPos ) ) - return sal_False; + return false; } } } // hint: new InternalStreamLock() adds the entry to the global list pLock = new InternalStreamLock( nStart, nEnd, pStream ); - return sal_True; + return true; } void InternalStreamLock::UnlockFile( sal_Size nStart, sal_Size nEnd, SvFileStream* pStream ) @@ -294,11 +294,11 @@ static sal_uInt32 GetSvError( oslFileError nErrno ) return nRetVal; } -SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) +SvFileStream::SvFileStream( const OUString& rFileName, StreamMode nOpenMode ) { - bIsOpen = sal_False; + bIsOpen = false; nLockCounter = 0; - bIsWritable = sal_False; + bIsWritable = false; pInstanceData = new StreamData; SetBufferSize( 1024 ); @@ -314,9 +314,9 @@ SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode ) SvFileStream::SvFileStream() { - bIsOpen = sal_False; + bIsOpen = false; nLockCounter = 0; - bIsWritable = sal_False; + bIsWritable = false; pInstanceData = new StreamData; SetBufferSize( 1024 ); } @@ -423,12 +423,12 @@ void SvFileStream::FlushData() // does not exist locally } -sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) +bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) { int nLockMode = 0; if ( ! IsOpen() ) - return sal_False; + return false; if ( eStreamMode & STREAM_SHARE_DENYALL ) { @@ -445,7 +445,7 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) else { SetError(SVSTREAM_LOCKING_VIOLATION); - return sal_False; + return false; } } @@ -458,7 +458,7 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) } if (!nLockMode) - return sal_True; + return true; if( ! InternalStreamLock::LockFile( nByteOffset, nByteOffset+nBytes, this ) ) { @@ -466,33 +466,33 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) fprintf( stderr, "InternalLock on %s [ %ld ... %ld ] failed\n", OUStringToOString(aFilename, osl_getThreadTextEncoding()).getStr(), nByteOffset, nByteOffset+nBytes ); #endif - return sal_False; + return false; } - return sal_True; + return true; } -sal_Bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes ) +bool SvFileStream::UnlockRange( sal_Size nByteOffset, sal_Size nBytes ) { if ( ! IsOpen() ) - return sal_False; + return false; InternalStreamLock::UnlockFile( nByteOffset, nByteOffset+nBytes, this ); - return sal_True; + return true; } -sal_Bool SvFileStream::LockFile() +bool SvFileStream::LockFile() { return LockRange( 0UL, 0UL ); } -sal_Bool SvFileStream::UnlockFile() +bool SvFileStream::UnlockFile() { return UnlockRange( 0UL, 0UL ); } -void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) +void SvFileStream::Open( const OUString& rFilename, StreamMode nOpenMode ) { sal_uInt32 uFlags; oslFileHandle nHandleTmp; @@ -581,15 +581,15 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) if ( rc == osl_File_E_None ) { pInstanceData->rHandle = nHandleTmp; - bIsOpen = sal_True; + bIsOpen = true; if ( uFlags & osl_File_OpenFlag_Write ) - bIsWritable = sal_True; + bIsWritable = true; if ( !LockFile() ) // whole file { rc = osl_closeFile( nHandleTmp ); - bIsOpen = sal_False; - bIsWritable = sal_False; + bIsOpen = false; + bIsWritable = false; pInstanceData->rHandle = 0; } } @@ -615,8 +615,8 @@ void SvFileStream::Close() pInstanceData->rHandle = 0; } - bIsOpen = sal_False; - bIsWritable = sal_False; + bIsOpen = false; + bIsWritable = false; SvStream::ClearBuffer(); SvStream::ClearError(); } diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx index 13d1ea118782..cd9f1c5bacdf 100644 --- a/tools/source/stream/strmwnt.cxx +++ b/tools/source/stream/strmwnt.cxx @@ -26,6 +26,7 @@ #include <windows.h> #endif +#include <osl/thread.h> #include <tools/stream.hxx> // class FileBase @@ -99,11 +100,11 @@ static sal_uIntPtr GetSvError( DWORD nWntError ) return nRetVal; } -SvFileStream::SvFileStream( const String& rFileName, StreamMode nMode ) +SvFileStream::SvFileStream( const OUString& rFileName, StreamMode nMode ) { - bIsOpen = sal_False; + bIsOpen = false; nLockCounter = 0; - bIsWritable = sal_False; + bIsWritable = false; pInstanceData = new StreamData; SetBufferSize( 8192 ); @@ -117,9 +118,9 @@ SvFileStream::SvFileStream( const String& rFileName, StreamMode nMode ) SvFileStream::SvFileStream() { - bIsOpen = sal_False; + bIsOpen = false; nLockCounter = 0; - bIsWritable = sal_False; + bIsWritable = false; pInstanceData = new StreamData; SetBufferSize( 8192 ); @@ -195,7 +196,7 @@ void SvFileStream::FlushData() } } -sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) +bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) { bool bRetVal = false; if( IsOpen() ) @@ -207,7 +208,7 @@ sal_Bool SvFileStream::LockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) return bRetVal; } -sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) +bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes ) { bool bRetVal = false; if( IsOpen() ) @@ -219,28 +220,28 @@ sal_Bool SvFileStream::UnlockRange( sal_uIntPtr nByteOffset, sal_uIntPtr nBytes return bRetVal; } -sal_Bool SvFileStream::LockFile() +bool SvFileStream::LockFile() { - sal_Bool bRetVal = sal_False; + bool bRetVal = false; if( !nLockCounter ) { if( LockRange( 0L, LONG_MAX ) ) { nLockCounter = 1; - bRetVal = sal_True; + bRetVal = true; } } else { nLockCounter++; - bRetVal = sal_True; + bRetVal = true; } return bRetVal; } -sal_Bool SvFileStream::UnlockFile() +bool SvFileStream::UnlockFile() { - sal_Bool bRetVal = sal_False; + bool bRetVal = false; if( nLockCounter > 0) { if( nLockCounter == 1) @@ -248,13 +249,13 @@ sal_Bool SvFileStream::UnlockFile() if( UnlockRange( 0L, LONG_MAX ) ) { nLockCounter = 0; - bRetVal = sal_True; + bRetVal = true; } } else { nLockCounter--; - bRetVal = sal_True; + bRetVal = true; } } return bRetVal; @@ -268,9 +269,9 @@ sal_Bool SvFileStream::UnlockFile() 1 0 OPEN_EXISTING 1 1 TRUNCATE_EXISTING */ -void SvFileStream::Open( const String& rFilename, StreamMode nMode ) +void SvFileStream::Open( const OUString& rFilename, StreamMode nMode ) { - String aParsedFilename(rFilename); + OUString aParsedFilename(rFilename); SetLastError( ERROR_SUCCESS ); Close(); @@ -371,15 +372,15 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode ) if( GetLastError() != ERROR_SUCCESS ) { - bIsOpen = sal_False; + bIsOpen = false; SetError(::GetSvError( GetLastError() ) ); } else { - bIsOpen = sal_True; - // pInstanceData->bIsEof = sal_False; + bIsOpen = true; + // pInstanceData->bIsEof = false; if( nAccessMode & GENERIC_WRITE ) - bIsWritable = sal_True; + bIsWritable = true; } SetErrorMode( nOldErrorMode ); } @@ -396,9 +397,9 @@ void SvFileStream::Close() Flush(); CloseHandle( pInstanceData->hFile ); } - bIsOpen = sal_False; + bIsOpen = false; nLockCounter= 0; - bIsWritable = sal_False; + bIsWritable = false; SvStream::ClearBuffer(); SvStream::ClearError(); } @@ -414,7 +415,7 @@ void SvFileStream::SetSize( sal_uIntPtr nSize ) if( IsOpen() ) { - int bError = sal_False; + int bError = false; HANDLE hFile = pInstanceData->hFile; sal_uIntPtr nOld = SetFilePointer( hFile, 0L, NULL, FILE_CURRENT ); if( nOld != 0xffffffff ) @@ -423,10 +424,10 @@ void SvFileStream::SetSize( sal_uIntPtr nSize ) { bool bSucc = SetEndOfFile( hFile ); if( !bSucc ) - bError = sal_True; + bError = true; } if( SetFilePointer( hFile,nOld,NULL,FILE_BEGIN ) == 0xffffffff) - bError = sal_True; + bError = true; } if( bError ) SetError(::GetSvError( GetLastError() ) ); diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 498c74d6b4bf..497662cf1315 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -63,8 +63,8 @@ ZCodec::~ZCodec() void ZCodec::BeginCompression( sal_uIntPtr nCompressMethod ) { mbInit = 0; - mbStatus = sal_True; - mbFinish = sal_False; + mbStatus = true; + mbFinish = false; mpIStm = mpOStm = NULL; mnInToRead = 0xffffffff; mpInBuf = mpOutBuf = NULL; @@ -114,7 +114,7 @@ long ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) { mpIStm = &rIStm; mpOStm = &rOStm; - ImplInitBuf( sal_False ); + ImplInitBuf( false ); mpInBuf = new sal_uInt8[ mnInBufSize ]; } while (( PZSTREAM->avail_in = mpIStm->Read( PZSTREAM->next_in = mpInBuf, mnInBufSize )) != 0 ) @@ -123,7 +123,7 @@ long ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) ImplWriteBack(); if ( deflate( PZSTREAM, Z_NO_FLUSH ) < 0 ) { - mbStatus = sal_False; + mbStatus = false; break; } }; @@ -143,7 +143,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) { mpIStm = &rIStm; mpOStm = &rOStm; - ImplInitBuf( sal_True ); + ImplInitBuf( true ); PZSTREAM->next_out = mpOutBuf = new sal_uInt8[ PZSTREAM->avail_out = mnOutBufSize ]; } do @@ -162,7 +162,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) err = inflate( PZSTREAM, Z_NO_FLUSH ); if ( err < 0 ) { - mbStatus = sal_False; + mbStatus = false; break; } @@ -171,7 +171,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) ImplWriteBack(); if ( err == Z_STREAM_END ) - mbFinish = sal_True; + mbFinish = true; return ( mbStatus ) ? (long)(PZSTREAM->total_out - nOldTotal_Out) : -1; } @@ -180,7 +180,7 @@ long ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize ) if ( mbInit == 0 ) { mpOStm = &rOStm; - ImplInitBuf( sal_False ); + ImplInitBuf( false ); } PZSTREAM->avail_in = nSize; @@ -193,7 +193,7 @@ long ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize ) if ( deflate( PZSTREAM, Z_NO_FLUSH ) < 0 ) { - mbStatus = sal_False; + mbStatus = false; break; } } @@ -211,7 +211,7 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize ) mpIStm = &rIStm; if ( mbInit == 0 ) { - ImplInitBuf( sal_True ); + ImplInitBuf( true ); } PZSTREAM->avail_out = nSize; PZSTREAM->next_out = pData; @@ -240,7 +240,7 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize ) (PZSTREAM->avail_out != 0) && (PZSTREAM->avail_in || mnInToRead) ); if ( err == Z_STREAM_END ) - mbFinish = sal_True; + mbFinish = true; return (mbStatus ? (long)(nSize - PZSTREAM->avail_out) : -1); } @@ -256,7 +256,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize if ( mbInit == 0 ) { mpIStm = &rIStm; - ImplInitBuf( sal_True ); + ImplInitBuf( true ); } PZSTREAM->avail_out = nSize; PZSTREAM->next_out = pData; @@ -297,7 +297,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize (PZSTREAM->avail_out != 0) && (PZSTREAM->avail_in || mnInToRead) ); if ( err == Z_STREAM_END ) - mbFinish = sal_True; + mbFinish = true; return (mbStatus ? (long)(nSize - PZSTREAM->avail_out) : -1); } @@ -335,7 +335,7 @@ sal_uIntPtr ZCodec::GetCRC() return mnCRC; } -void ZCodec::ImplInitBuf ( sal_Bool nIOFlag ) +void ZCodec::ImplInitBuf ( bool nIOFlag ) { if ( mbInit == 0 ) { @@ -349,14 +349,14 @@ void ZCodec::ImplInitBuf ( sal_Bool nIOFlag ) { *mpIStm >> j; if ( j != gz_magic[ i ] ) - mbStatus = sal_False; + mbStatus = false; } *mpIStm >> nMethod; *mpIStm >> nFlags; if ( nMethod != Z_DEFLATED ) - mbStatus = sal_False; + mbStatus = false; if ( ( nFlags & GZ_RESERVED ) != 0 ) - mbStatus = sal_False; + mbStatus = false; /* Discard time, xflags and OS code: */ mpIStm->SeekRel( 6 ); /* skip the extra field */ @@ -387,7 +387,7 @@ void ZCodec::ImplInitBuf ( sal_Bool nIOFlag ) if ( nFlags & GZ_HEAD_CRC ) mpIStm->SeekRel( 2 ); if ( mbStatus ) - mbStatus = ( inflateInit2( PZSTREAM, -MAX_WBITS) != Z_OK ) ? sal_False : sal_True; + mbStatus = ( inflateInit2( PZSTREAM, -MAX_WBITS) != Z_OK ) ? false : true; } else { diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index d60f249584d6..73a10f77b9b1 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -1368,7 +1368,7 @@ void UcbLockBytes::terminate_Impl() } //---------------------------------------------------------------------------- -void UcbLockBytes::SetSynchronMode (sal_Bool bSynchron) +void UcbLockBytes::SetSynchronMode (bool bSynchron) { SvLockBytes::SetSynchronMode (bSynchron); } diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx index 1c9e39dc9658..e4c763cd2434 100644 --- a/unotools/source/ucbhelper/ucbstreamhelper.cxx +++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include <tools/string.hxx> #include <unotools/ucblockbytes.hxx> #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 9ec7cf07f743..e1e3e9b2617f 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -20,6 +20,7 @@ #include <tools/debug.hxx> #include <tools/stream.hxx> +#include <tools/string.hxx> #include <rtl/alloc.h> #include <vcl/jobset.hxx> diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 2442a1e92db6..34770335eb3f 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -145,7 +145,7 @@ ImplFontAttrCache::ImplFontAttrCache( const String& rFileNameURL, const String& aCacheFile >> n; aDFA.SetFamilyType(static_cast<FontFamily>(n)); aCacheFile >> n; aDFA.SetSymbolFlag(n != 0); - String styleName; + OUString styleName; aCacheFile.ReadByteStringLine( styleName, RTL_TEXTENCODING_UTF8 ); aDFA.SetStyleName( styleName ); |