summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-06-29 23:57:38 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2013-06-30 04:58:49 +0000
commit710f41b7aec8e7d35a0da8be332aa289f98942af (patch)
treeb894ef2d3f06a63a85f423b2713a654ea57f9c69 /tools
parent1ca3beae12a7f222c987481e07a544845fc9fd46 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/poly.h4
-rw-r--r--tools/qa/cppunit/test_inetmime.cxx1
-rw-r--r--tools/qa/cppunit/test_stream.cxx2
-rw-r--r--tools/source/datetime/datetime.cxx30
-rw-r--r--tools/source/datetime/tdate.cxx26
-rw-r--r--tools/source/datetime/ttime.cxx2
-rw-r--r--tools/source/debug/debug.cxx102
-rw-r--r--tools/source/fsys/tempfile.cxx31
-rw-r--r--tools/source/fsys/wldcrd.cxx8
-rw-r--r--tools/source/generic/b3dtrans.cxx56
-rw-r--r--tools/source/generic/bigint.cxx61
-rw-r--r--tools/source/generic/color.cxx8
-rw-r--r--tools/source/generic/config.cxx107
-rw-r--r--tools/source/generic/fract.cxx2
-rw-r--r--tools/source/generic/gen.cxx22
-rw-r--r--tools/source/generic/line.cxx24
-rw-r--r--tools/source/generic/link.cxx10
-rw-r--r--tools/source/generic/poly.cxx56
-rw-r--r--tools/source/generic/poly2.cxx24
-rw-r--r--tools/source/inet/inetmime.cxx1
-rw-r--r--tools/source/inet/inetmsg.cxx3
-rw-r--r--tools/source/inet/inetstrm.cxx574
-rw-r--r--tools/source/memtools/multisel.cxx56
-rw-r--r--tools/source/rc/resmgr.cxx44
-rw-r--r--tools/source/ref/errinf.cxx28
-rw-r--r--tools/source/ref/globname.cxx32
-rw-r--r--tools/source/ref/pstm.cxx8
-rw-r--r--tools/source/stream/cachestr.cxx9
-rw-r--r--tools/source/stream/stream.cxx246
-rw-r--r--tools/source/stream/strmunx.cxx72
-rw-r--r--tools/source/stream/strmwnt.cxx53
-rw-r--r--tools/source/zcodec/zcodec.cxx36
32 files changed, 867 insertions, 871 deletions
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
{