diff options
Diffstat (limited to 'basic/source/runtime/methods.cxx')
-rwxr-xr-x[-rw-r--r--] | basic/source/runtime/methods.cxx | 485 |
1 files changed, 221 insertions, 264 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 380064bb0da8..8335d6f88d26 100644..100755 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -36,7 +36,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/sound.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <basic/sbx.hxx> #include <svl/zforlist.hxx> @@ -105,15 +105,10 @@ using namespace com::sun::star::script; SbxVariable* getDefaultProp( SbxVariable* pRef ); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) #include <direct.h> // _getdcwd get current work directory, _chdrive #endif -#ifdef WIN -#include <dos.h> // _dos_getfileattr -#include <errno.h> -#endif - #ifdef UNX #include <errno.h> #include <unistd.h> @@ -164,7 +159,7 @@ static CharClass& GetCharClass( void ) return aCharClass; } -static inline BOOL isFolder( FileStatus::Type aType ) +static inline sal_Bool isFolder( FileStatus::Type aType ) { return ( aType == FileStatus::Directory || aType == FileStatus::Volume ); } @@ -230,8 +225,8 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void -// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert -// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus // Element 0 gespeichert. // CreateObject( class ) @@ -264,7 +259,7 @@ RTLFUNC(Error) { String aErrorMsg; SbError nErr = 0L; - INT32 nCode = 0; + sal_Int32 nCode = 0; if( rPar.Count() == 1 ) { nErr = StarBASIC::GetErrBasic(); @@ -276,7 +271,7 @@ RTLFUNC(Error) if( nCode > 65535L ) StarBASIC::Error( SbERR_CONVERSION ); else - nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode ); + nErr = StarBASIC::GetSfxFromVBError( (sal_uInt16)nCode ); } bool bVBA = SbiRuntime::isVBAEnabled(); @@ -425,7 +420,7 @@ RTLFUNC(CurDir) // zu ermitteln, dass eine virtuelle URL geliefert werden koennte. // rPar.Get(0)->PutEmpty(); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) int nCurDir = 0; // Current dir // JSM if ( rPar.Count() == 2 ) { @@ -462,7 +457,7 @@ RTLFUNC(CurDir) int nSize = _PATH_INCR; char* pMem; - while( TRUE ) + while( sal_True ) { pMem = new char[nSize]; if( !pMem ) @@ -499,17 +494,17 @@ RTLFUNC(ChDir) // JSM { #ifdef _ENABLE_CUR_DIR String aPath = rPar.Get(1)->GetString(); - BOOL bError = FALSE; + sal_Bool bError = sal_False; #ifdef WNT // #55997 Laut MI hilft es bei File-URLs einen DirEntry zwischenzuschalten // #40996 Harmoniert bei Verwendung der WIN32-Funktion nicht mit getdir DirEntry aEntry( aPath ); ByteString aFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() ); if( chdir( aFullPath.GetBuffer()) ) - bError = TRUE; + bError = sal_True; #else if (!DirEntry(aPath).SetCWD()) - bError = TRUE; + bError = sal_True; #endif if( bError ) StarBASIC::Error( SbERR_PATH_NOT_FOUND ); @@ -532,7 +527,7 @@ RTLFUNC(ChDrive) // JSM #ifndef UNX String aPar1 = rPar.Get(1)->GetString(); -#if defined (WIN) || defined (WNT) || defined (OS2) +#if defined (WNT) || defined (OS2) if (aPar1.Len() > 0) { int nCurDrive = (int)aPar1.GetBuffer()[0]; ; @@ -727,7 +722,7 @@ RTLFUNC(MkDir) // JSM SbxArrayRef pPar = new SbxArray; SbxVariableRef pVar = new SbxVariable(); pPar->Put( pVar, 0 ); - SbRtl_CurDir( pBasic, *pPar, FALSE ); + SbRtl_CurDir( pBasic, *pPar, sal_False ); String aCurPath = pPar->Get(0)->GetString(); File::getFileURLFromSystemPath( aCurPath, sCurDirURL ); @@ -920,7 +915,7 @@ RTLFUNC(FileLen) { SbxVariableRef pArg = rPar.Get( 1 ); String aStr( pArg->GetString() ); - INT32 nLen = 0; + sal_Int32 nLen = 0; // <-- UCB if( hasUno() ) { @@ -948,7 +943,7 @@ RTLFUNC(FileLen) DirectoryItem::get( getFullPathUNC( aStr ), aItem ); FileStatus aFileStatus( FileStatusMask_FileSize ); aItem.getFileStatus( aFileStatus ); - nLen = (INT32)aFileStatus.getFileSize(); + nLen = (sal_Int32)aFileStatus.getFileSize(); #endif } rPar.Get(0)->PutLong( (long)nLen ); @@ -1002,23 +997,23 @@ RTLFUNC(InStr) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - USHORT nStartPos = 1; + sal_uInt16 nStartPos = 1; - USHORT nFirstStringPos = 1; + sal_uInt16 nFirstStringPos = 1; if ( nArgCount >= 3 ) { - INT32 lStartPos = rPar.Get(1)->GetLong(); + sal_Int32 lStartPos = rPar.Get(1)->GetLong(); if( lStartPos <= 0 || lStartPos > 0xffff ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); lStartPos = 1; } - nStartPos = (USHORT)lStartPos; + nStartPos = (sal_uInt16)lStartPos; nFirstStringPos++; } @@ -1028,7 +1023,7 @@ RTLFUNC(InStr) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1037,7 +1032,7 @@ RTLFUNC(InStr) if ( nArgCount == 4 ) bTextMode = rPar.Get(4)->GetInteger(); - USHORT nPos; + sal_uInt16 nPos; const String& rToken = rPar.Get(nFirstStringPos+1)->GetString(); // #97545 Always find empty string @@ -1084,7 +1079,7 @@ RTLFUNC(InStrRev) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1092,7 +1087,7 @@ RTLFUNC(InStrRev) String aStr1 = rPar.Get(1)->GetString(); String aToken = rPar.Get(2)->GetString(); - INT32 lStartPos = -1; + sal_Int32 lStartPos = -1; if ( nArgCount >= 3 ) { lStartPos = rPar.Get(3)->GetLong(); @@ -1109,7 +1104,7 @@ RTLFUNC(InStrRev) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1118,13 +1113,13 @@ RTLFUNC(InStrRev) if ( nArgCount == 4 ) bTextMode = rPar.Get(4)->GetInteger(); - USHORT nStrLen = aStr1.Len(); - USHORT nStartPos = lStartPos == -1 ? nStrLen : (USHORT)lStartPos; + sal_uInt16 nStrLen = aStr1.Len(); + sal_uInt16 nStartPos = lStartPos == -1 ? nStrLen : (sal_uInt16)lStartPos; - USHORT nPos = 0; + sal_uInt16 nPos = 0; if( nStartPos <= nStrLen ) { - USHORT nTokenLen = aToken.Len(); + sal_uInt16 nTokenLen = aToken.Len(); if( !nTokenLen ) { // Always find empty string @@ -1140,7 +1135,7 @@ RTLFUNC(InStrRev) if( nRet == -1 ) nPos = 0; else - nPos = (USHORT)nRet + 1; + nPos = (sal_uInt16)nRet + 1; } else { @@ -1154,7 +1149,7 @@ RTLFUNC(InStrRev) if( nRet == -1 ) nPos = 0; else - nPos = (USHORT)nRet + 1; + nPos = (sal_uInt16)nRet + 1; } } } @@ -1238,7 +1233,7 @@ RTLFUNC(Left) else { String aStr( rPar.Get(1)->GetString() ); - INT32 lResultLen = rPar.Get(2)->GetLong(); + sal_Int32 lResultLen = rPar.Get(2)->GetLong(); if( lResultLen > 0xffff ) { lResultLen = 0xffff; @@ -1248,7 +1243,7 @@ RTLFUNC(Left) lResultLen = 0; StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - aStr.Erase( (USHORT)lResultLen ); + aStr.Erase( (sal_uInt16)lResultLen ); rPar.Get(0)->PutString( aStr ); } } @@ -1297,7 +1292,7 @@ RTLFUNC(Mid) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1307,23 +1302,23 @@ RTLFUNC(Mid) // Anders als im Original kann in dieser Variante der 3. Parameter // nLength nicht weggelassen werden. Ist ueber bWrite schon vorgesehen. if( nArgCount == 4 ) - bWrite = TRUE; + bWrite = sal_True; String aArgStr = rPar.Get(1)->GetString(); - USHORT nStartPos = (USHORT)(rPar.Get(2)->GetLong() ); + sal_uInt16 nStartPos = (sal_uInt16)(rPar.Get(2)->GetLong() ); if ( nStartPos == 0 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { nStartPos--; - USHORT nLen = 0xffff; + sal_uInt16 nLen = 0xffff; bool bWriteNoLenParam = false; if ( nArgCount == 3 || bWrite ) { - INT32 n = rPar.Get(3)->GetLong(); + sal_Int32 n = rPar.Get(3)->GetLong(); if( bWrite && n == -1 ) bWriteNoLenParam = true; - nLen = (USHORT)n; + nLen = (sal_uInt16)n; } String aResultStr; if ( bWrite ) @@ -1332,7 +1327,7 @@ RTLFUNC(Mid) bool bCompatibility = ( pInst && pInst->IsCompatibility() ); if( bCompatibility ) { - USHORT nArgLen = aArgStr.Len(); + sal_uInt16 nArgLen = aArgStr.Len(); if( nStartPos + 1 > nArgLen ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -1340,8 +1335,8 @@ RTLFUNC(Mid) } String aReplaceStr = rPar.Get(4)->GetString(); - USHORT nReplaceStrLen = aReplaceStr.Len(); - USHORT nReplaceLen; + sal_uInt16 nReplaceStrLen = aReplaceStr.Len(); + sal_uInt16 nReplaceLen; if( bWriteNoLenParam ) { nReplaceLen = nReplaceStrLen; @@ -1353,12 +1348,12 @@ RTLFUNC(Mid) nReplaceLen = nReplaceStrLen; } - USHORT nReplaceEndPos = nStartPos + nReplaceLen; + sal_uInt16 nReplaceEndPos = nStartPos + nReplaceLen; if( nReplaceEndPos > nArgLen ) nReplaceLen -= (nReplaceEndPos - nArgLen); aResultStr = aArgStr; - USHORT nErase = nReplaceLen; + sal_uInt16 nErase = nReplaceLen; aResultStr.Erase( nStartPos, nErase ); aResultStr.Insert( aReplaceStr, 0, nReplaceLen, nStartPos ); } @@ -1406,7 +1401,7 @@ RTLFUNC(Replace) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 6 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -1415,7 +1410,7 @@ RTLFUNC(Replace) String aFindStr = rPar.Get(2)->GetString(); String aReplaceStr = rPar.Get(3)->GetString(); - INT32 lStartPos = 1; + sal_Int32 lStartPos = 1; if ( nArgCount >= 4 ) { if( rPar.Get(4)->GetType() != SbxEMPTY ) @@ -1427,7 +1422,7 @@ RTLFUNC(Replace) } } - INT32 lCount = -1; + sal_Int32 lCount = -1; if( nArgCount >=5 ) { if( rPar.Get(5)->GetType() != SbxEMPTY ) @@ -1445,7 +1440,7 @@ RTLFUNC(Replace) if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { @@ -1454,14 +1449,14 @@ RTLFUNC(Replace) if ( nArgCount == 6 ) bTextMode = rPar.Get(6)->GetInteger(); - USHORT nExpStrLen = aExpStr.Len(); - USHORT nFindStrLen = aFindStr.Len(); - USHORT nReplaceStrLen = aReplaceStr.Len(); + sal_uInt16 nExpStrLen = aExpStr.Len(); + sal_uInt16 nFindStrLen = aFindStr.Len(); + sal_uInt16 nReplaceStrLen = aReplaceStr.Len(); if( lStartPos <= nExpStrLen ) { - USHORT nPos = static_cast<USHORT>( lStartPos - 1 ); - USHORT nCounts = 0; + sal_uInt16 nPos = static_cast<sal_uInt16>( lStartPos - 1 ); + sal_uInt16 nCounts = 0; while( lCount == -1 || lCount > nCounts ) { String aSrcStr( aExpStr ); @@ -1483,7 +1478,7 @@ RTLFUNC(Replace) } } } - rPar.Get(0)->PutString( aExpStr.Copy( static_cast<USHORT>(lStartPos - 1) ) ); + rPar.Get(0)->PutString( aExpStr.Copy( static_cast<sal_uInt16>(lStartPos - 1) ) ); } } @@ -1497,7 +1492,7 @@ RTLFUNC(Right) else { const String& rStr = rPar.Get(1)->GetString(); - INT32 lResultLen = rPar.Get(2)->GetLong(); + sal_Int32 lResultLen = rPar.Get(2)->GetLong(); if( lResultLen > 0xffff ) { lResultLen = 0xffff; @@ -1507,8 +1502,8 @@ RTLFUNC(Right) lResultLen = 0; StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - USHORT nResultLen = (USHORT)lResultLen; - USHORT nStrLen = rStr.Len(); + sal_uInt16 nResultLen = (sal_uInt16)lResultLen; + sal_uInt16 nStrLen = rStr.Len(); if ( nResultLen > nStrLen ) nResultLen = nStrLen; String aResultStr = rStr.Copy( nStrLen-nResultLen ); @@ -1549,7 +1544,7 @@ RTLFUNC(Sgn) else { double aDouble = rPar.Get(1)->GetDouble(); - INT16 nResult = 0; + sal_Int16 nResult = 0; if ( aDouble > 0 ) nResult = 1; else if ( aDouble < 0 ) @@ -1568,7 +1563,7 @@ RTLFUNC(Space) else { String aStr; - aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); rPar.Get(0)->PutString( aStr ); } } @@ -1583,7 +1578,7 @@ RTLFUNC(Spc) else { String aStr; - aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); rPar.Get(0)->PutString( aStr ); } } @@ -1633,11 +1628,11 @@ RTLFUNC(Str) const sal_Unicode* pBuf = aStr.GetBuffer(); bool bNeg = ( pBuf[0] == '-' ); - USHORT iZeroSearch = 0; + sal_uInt16 iZeroSearch = 0; if( bNeg ) iZeroSearch++; - USHORT iNext = iZeroSearch + 1; + sal_uInt16 iNext = iZeroSearch + 1; if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' ) { aStr.Erase( iZeroSearch, 1 ); @@ -1668,16 +1663,16 @@ RTLFUNC(StrComp) const String& rStr2 = rPar.Get(2)->GetString(); SbiInstance* pInst = pINST; - INT16 nTextCompare; + sal_Int16 nTextCompare; bool bCompatibility = ( pInst && pInst->IsCompatibility() ); if( bCompatibility ) { SbiRuntime* pRT = pInst ? pInst->pRun : NULL; - nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : FALSE; + nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False; } else { - nTextCompare = TRUE; + nTextCompare = sal_True; } if ( rPar.Count() == 4 ) nTextCompare = rPar.Get(3)->GetInteger(); @@ -1713,7 +1708,7 @@ RTLFUNC(StrComp) nRetValue = 1; } - rPar.Get(0)->PutInteger( sal::static_int_cast< INT16 >( nRetValue ) ); + rPar.Get(0)->PutInteger( sal::static_int_cast< sal_Int16 >( nRetValue ) ); } RTLFUNC(String) @@ -1727,10 +1722,10 @@ RTLFUNC(String) { String aStr; sal_Unicode aFiller; - INT32 lCount = rPar.Get(1)->GetLong(); + sal_Int32 lCount = rPar.Get(1)->GetLong(); if( lCount < 0 || lCount > 0xffff ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); - USHORT nCount = (USHORT)lCount; + sal_uInt16 nCount = (sal_uInt16)lCount; if( rPar.Get(2)->GetType() == SbxINTEGER ) aFiller = (sal_Unicode)rPar.Get(2)->GetInteger(); else @@ -1788,7 +1783,7 @@ RTLFUNC(Val) String aStr( rPar.Get(1)->GetString() ); // lt. Mikkysoft bei Kommas abbrechen! -// for( USHORT n=0; n < aStr.Len(); n++ ) +// for( sal_uInt16 n=0; n < aStr.Len(); n++ ) // if( aStr[n] == ',' ) aStr[n] = '.'; FilterWhiteSpace( aStr ); @@ -1803,7 +1798,7 @@ RTLFUNC(Val) if ( nRadix != 10 ) { ByteString aByteStr( aStr, gsl_getSystemTextEncoding() ); - INT16 nlResult = (INT16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); + sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); nResult = (double)nlResult; } } @@ -1821,46 +1816,46 @@ RTLFUNC(Val) // Helper functions for date conversion -INT16 implGetDateDay( double aDate ) +sal_Int16 implGetDateDay( double aDate ) { aDate -= 2.0; // normieren: 1.1.1900 => 0.0 Date aRefDate( 1, 1, 1900 ); if ( aDate >= 0.0 ) { aDate = floor( aDate ); - aRefDate += (ULONG)aDate; + aRefDate += (sal_uIntPtr)aDate; } else { aDate = ceil( aDate ); - aRefDate -= (ULONG)(-1.0 * aDate); + aRefDate -= (sal_uIntPtr)(-1.0 * aDate); } - INT16 nRet = (INT16)( aRefDate.GetDay() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetDay() ); return nRet; } -INT16 implGetDateMonth( double aDate ) +sal_Int16 implGetDateMonth( double aDate ) { Date aRefDate( 1,1,1900 ); long nDays = (long)aDate; nDays -= 2; // normieren: 1.1.1900 => 0.0 aRefDate += nDays; - INT16 nRet = (INT16)( aRefDate.GetMonth() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetMonth() ); return nRet; } -INT16 implGetDateYear( double aDate ) +sal_Int16 implGetDateYear( double aDate ) { Date aRefDate( 1,1,1900 ); long nDays = (long) aDate; nDays -= 2; // normieren: 1.1.1900 => 0.0 aRefDate += nDays; - INT16 nRet = (INT16)( aRefDate.GetYear() ); + sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() ); return nRet; } -BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) +sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ) { if ( nYear < 30 && SbiRuntime::isVBAEnabled() ) nYear += 2000; @@ -1870,7 +1865,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) if ((nYear < 100 || nYear > 9999) ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } if ( !SbiRuntime::isVBAEnabled() ) { @@ -1878,7 +1873,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) (nDay < 1 || nDay > 31 ) ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return FALSE; + return sal_False; } } else @@ -1893,7 +1888,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) { // inacurrate around leap year, don't use days to calculate, // just modify the months directory - INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed + sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed if ( nMonth <=0 ) nYearAdj = ( ( nMonth -12 ) / 12 ); aCurDate.SetYear( aCurDate.GetYear() + nYearAdj ); @@ -1910,7 +1905,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) long nDiffDays = GetDayDiff( aCurDate ); rdRet = (double)nDiffDays; - return TRUE; + return sal_True; } // Function to convert date to ISO 8601 date format @@ -1944,14 +1939,14 @@ RTLFUNC(CDateFromIso) if ( rPar.Count() == 2 ) { String aStr = rPar.Get(1)->GetString(); - INT16 iMonthStart = aStr.Len() - 4; + sal_Int16 iMonthStart = aStr.Len() - 4; String aYearStr = aStr.Copy( 0, iMonthStart ); String aMonthStr = aStr.Copy( iMonthStart, 2 ); String aDayStr = aStr.Copy( iMonthStart+2, 2 ); double dDate; - if( implDateSerial( (INT16)aYearStr.ToInt32(), - (INT16)aMonthStr.ToInt32(), (INT16)aDayStr.ToInt32(), dDate ) ) + if( implDateSerial( (sal_Int16)aYearStr.ToInt32(), + (sal_Int16)aMonthStr.ToInt32(), (sal_Int16)aDayStr.ToInt32(), dDate ) ) { rPar.Get(0)->PutDate( dDate ); } @@ -1970,9 +1965,9 @@ RTLFUNC(DateSerial) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nYear = rPar.Get(1)->GetInteger(); - INT16 nMonth = rPar.Get(2)->GetInteger(); - INT16 nDay = rPar.Get(3)->GetInteger(); + sal_Int16 nYear = rPar.Get(1)->GetInteger(); + sal_Int16 nMonth = rPar.Get(2)->GetInteger(); + sal_Int16 nDay = rPar.Get(3)->GetInteger(); double dDate; if( implDateSerial( nYear, nMonth, nDay, dDate ) ) @@ -1989,11 +1984,11 @@ RTLFUNC(TimeSerial) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nHour = rPar.Get(1)->GetInteger(); + sal_Int16 nHour = rPar.Get(1)->GetInteger(); if ( nHour == 24 ) nHour = 0; // Wegen UNO DateTimes, die bis 24 Uhr gehen - INT16 nMinute = rPar.Get(2)->GetInteger(); - INT16 nSecond = rPar.Get(3)->GetInteger(); + sal_Int16 nMinute = rPar.Get(2)->GetInteger(); + sal_Int16 nSecond = rPar.Get(3)->GetInteger(); if ((nHour < 0 || nHour > 23) || (nMinute < 0 || nMinute > 59 ) || (nSecond < 0 || nSecond > 59 )) @@ -2002,7 +1997,7 @@ RTLFUNC(TimeSerial) return; } - INT32 nSeconds = nHour; + sal_Int32 nSeconds = nHour; nSeconds *= 3600; nSeconds += nMinute * 60; nSeconds += nSecond; @@ -2032,7 +2027,7 @@ RTLFUNC(DateValue) sal_uInt32 nIndex; double fResult; String aStr( rPar.Get(1)->GetString() ); - BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); + sal_Bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); short nType = pFormatter->GetType( nIndex ); // DateValue("February 12, 1969") raises error if the system locale is not en_US @@ -2093,7 +2088,7 @@ RTLFUNC(TimeValue) sal_uInt32 nIndex; double fResult; - BOOL bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(), + sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(), nIndex, fResult ); short nType = pFormatter->GetType(nIndex); if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME)) @@ -2124,7 +2119,7 @@ RTLFUNC(Day) SbxVariableRef pArg = rPar.Get( 1 ); double aDate = pArg->GetDate(); - INT16 nDay = implGetDateDay( aDate ); + sal_Int16 nDay = implGetDateDay( aDate ); rPar.Get(0)->PutInteger( nDay ); } } @@ -2138,19 +2133,19 @@ RTLFUNC(Year) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nYear = implGetDateYear( rPar.Get(1)->GetDate() ); + sal_Int16 nYear = implGetDateYear( rPar.Get(1)->GetDate() ); rPar.Get(0)->PutInteger( nYear ); } } -INT16 implGetHour( double dDate ) +sal_Int16 implGetHour( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nHour = (INT16)(nSeconds / 3600); + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nHour = (sal_Int16)(nSeconds / 3600); return nHour; } @@ -2164,20 +2159,20 @@ RTLFUNC(Hour) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nHour = implGetHour( nArg ); + sal_Int16 nHour = implGetHour( nArg ); rPar.Get(0)->PutInteger( nHour ); } } -INT16 implGetMinute( double dDate ) +sal_Int16 implGetMinute( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nTemp = (INT16)(nSeconds % 3600); - INT16 nMin = nTemp / 60; + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600); + sal_Int16 nMin = nTemp / 60; return nMin; } @@ -2191,7 +2186,7 @@ RTLFUNC(Minute) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nMin = implGetMinute( nArg ); + sal_Int16 nMin = implGetMinute( nArg ); rPar.Get(0)->PutInteger( nMin ); } } @@ -2205,24 +2200,24 @@ RTLFUNC(Month) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() ); + sal_Int16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() ); rPar.Get(0)->PutInteger( nMonth ); } } -INT16 implGetSecond( double dDate ) +sal_Int16 implGetSecond( double dDate ) { if( dDate < 0.0 ) dDate *= -1.0; double nFrac = dDate - floor( dDate ); nFrac *= 86400.0; - INT32 nSeconds = (INT32)(nFrac + 0.5); - INT16 nTemp = (INT16)(nSeconds / 3600); + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nTemp = (sal_Int16)(nSeconds / 3600); nSeconds -= nTemp * 3600; - nTemp = (INT16)(nSeconds / 60); + nTemp = (sal_Int16)(nSeconds / 60); nSeconds -= nTemp * 60; - INT16 nRet = (INT16)nSeconds; + sal_Int16 nRet = (sal_Int16)nSeconds; return nRet; } @@ -2236,7 +2231,7 @@ RTLFUNC(Second) else { double nArg = rPar.Get(1)->GetDate(); - INT16 nSecond = implGetSecond( nArg ); + sal_Int16 nSecond = implGetSecond( nArg ); rPar.Get(0)->PutInteger( nSecond ); } } @@ -2388,7 +2383,7 @@ RTLFUNC(IsArray) if ( rPar.Count() < 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else - rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? TRUE : FALSE ); + rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? sal_True : sal_False ); } RTLFUNC(IsObject) @@ -2407,7 +2402,7 @@ RTLFUNC(IsObject) SbxBase::ResetError(); SbUnoClass* pUnoClass; - BOOL bObject; + sal_Bool bObject; if( pObj && NULL != ( pUnoClass=PTR_CAST(SbUnoClass,pObj) ) ) { bObject = pUnoClass->getUnoClass().is(); @@ -2429,14 +2424,14 @@ RTLFUNC(IsDate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - // #46134 Nur String wird konvertiert, andere Typen ergeben FALSE + // #46134 Nur String wird konvertiert, andere Typen ergeben sal_False SbxVariableRef xArg = rPar.Get( 1 ); SbxDataType eType = xArg->GetType(); - BOOL bDate = FALSE; + sal_Bool bDate = sal_False; if( eType == SbxDATE ) { - bDate = TRUE; + bDate = sal_True; } else if( eType == SbxSTRING ) { @@ -2518,12 +2513,12 @@ RTLFUNC(IsNull) // #51475 Wegen Uno-Objekten auch true liefern, // wenn der pObj-Wert NULL ist SbxVariableRef pArg = rPar.Get( 1 ); - BOOL bNull = rPar.Get(1)->IsNull(); + sal_Bool bNull = rPar.Get(1)->IsNull(); if( !bNull && pArg->GetType() == SbxOBJECT ) { SbxBase* pObj = pArg->GetObject(); if( !pObj ) - bNull = TRUE; + bNull = sal_True; } rPar.Get( 0 )->PutBool( bNull ); } @@ -2663,7 +2658,7 @@ inline sal_Bool implCheckWildcard( const String& rName, SbiRTLData* pRTLData ) bool isRootDir( String aDirURLStr ) { INetURLObject aDirURLObj( aDirURLStr ); - BOOL bRoot = FALSE; + sal_Bool bRoot = sal_False; // Check if it's a root directory sal_Int32 nCount = aDirURLObj.getSegmentCount(); @@ -2671,22 +2666,22 @@ bool isRootDir( String aDirURLStr ) // No segment means Unix root directory "file:///" if( nCount == 0 ) { - bRoot = TRUE; + bRoot = sal_True; } // Exactly one segment needs further checking, because it // can be Unix "file:///foo/" -> no root // or Windows "file:///c:/" -> root else if( nCount == 1 ) { - ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, TRUE, + ::rtl::OUString aSeg1 = aDirURLObj.getName( 0, sal_True, INetURLObject::DECODE_WITH_CHARSET ); if( aSeg1.getStr()[1] == (sal_Unicode)':' ) { - bRoot = TRUE; + bRoot = sal_True; } } // More than one segments can never be root - // so bRoot remains FALSE + // so bRoot remains sal_False return bRoot; } @@ -2698,7 +2693,7 @@ RTLFUNC(Dir) String aPath; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if( nParCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -2753,7 +2748,7 @@ RTLFUNC(Dir) rPar.Get(0)->PutString( aEmptyStr ); } - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else @@ -2767,7 +2762,7 @@ RTLFUNC(Dir) // #78651 Add "." and ".." directories for VB compatibility if( bIncludeFolders ) { - BOOL bRoot = isRootDir( aDirURLStr ); + sal_Bool bRoot = isRootDir( aDirURLStr ); // If it's no root directory we flag the need for // the "." and ".." directories by the value -2 @@ -2837,7 +2832,7 @@ RTLFUNC(Dir) } INetURLObject aURL( aFile ); - aPath = aURL.getName( INetURLObject::LAST_SEGMENT, TRUE, + aPath = aURL.getName( INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::DECODE_WITH_CHARSET ); } @@ -2868,23 +2863,19 @@ RTLFUNC(Dir) rPar.Get(0)->PutString( aEntry.GetName() ); return; } - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else pRTLData->nDirFlags = 0; - // Nur diese Bitmaske ist unter Windows erlaubt - #ifdef WIN - if( nFlags & ~0x1E ) - StarBASIC::Error( SbERR_BAD_ARGUMENT ), pRTLData->nDirFlags = 0; - #endif + // Sb_ATTR_VOLUME wird getrennt gehandelt if( pRTLData->nDirFlags & Sb_ATTR_VOLUME ) aPath = aEntry.GetVolume(); else { // Die richtige Auswahl treffen - USHORT nMode = FSYS_KIND_FILE; + sal_uInt16 nMode = FSYS_KIND_FILE; if( nFlags & Sb_ATTR_DIRECTORY ) nMode |= FSYS_KIND_DIR; if( nFlags == Sb_ATTR_DIRECTORY ) @@ -2907,31 +2898,7 @@ RTLFUNC(Dir) } DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++]; aPath = aNextEntry.GetName(); //Full(); - #ifdef WIN - aNextEntry.ToAbs(); - String sFull(aNextEntry.GetFull()); - unsigned nFlags; - - if (_dos_getfileattr( sFull.GetStr(), &nFlags )) - StarBASIC::Error( SbERR_FILE_NOT_FOUND ); - else - { - INT16 nCurFlags = pRTLData->nDirFlags; - if( (nCurFlags == Sb_ATTR_NORMAL) - && !(nFlags & ( _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR ) ) ) - break; - else if( (nCurFlags & Sb_ATTR_HIDDEN) && (nFlags & _A_HIDDEN) ) - break; - else if( (nCurFlags & Sb_ATTR_SYSTEM) && (nFlags & _A_SYSTEM) ) - break; - else if( (nCurFlags & Sb_ATTR_VOLUME) && (nFlags & _A_VOLID) ) - break; - else if( (nCurFlags & Sb_ATTR_DIRECTORY) && (nFlags & _A_SUBDIR) ) - break; - } - #else break; - #endif } } rPar.Get(0)->PutString( aPath ); @@ -2943,7 +2910,7 @@ RTLFUNC(Dir) String aDirURL = implSetupWildcard( aFileParam, pRTLData ); - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( nParCount > 2 ) pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); else @@ -2965,7 +2932,7 @@ RTLFUNC(Dir) pRTLData->nCurDirPos = 0; if( bIncludeFolders ) { - BOOL bRoot = isRootDir( aDirURL ); + sal_Bool bRoot = isRootDir( aDirURL ); // If it's no root directory we flag the need for // the "." and ".." directories by the value -2 @@ -3045,7 +3012,7 @@ RTLFUNC(GetAttr) if ( rPar.Count() == 2 ) { - INT16 nFlags = 0; + sal_Int16 nFlags = 0; // In Windows, We want to use Windows API to get the file attributes // for VBA interoperability. @@ -3062,7 +3029,7 @@ RTLFUNC(GetAttr) { if (nRealFlags == FILE_ATTRIBUTE_NORMAL) nRealFlags = 0; - nFlags = (INT16) (nRealFlags); + nFlags = (sal_Int16) (nRealFlags); } else StarBASIC::Error( SbERR_FILE_NOT_FOUND ); @@ -3228,7 +3195,7 @@ RTLFUNC(EOF) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; // macht MD beim Oeffnen auch nicht SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3237,7 +3204,7 @@ RTLFUNC(EOF) StarBASIC::Error( SbERR_BAD_CHANNEL ); return; } - BOOL bIsEof; + sal_Bool bIsEof; SvStream* pSvStrm = pSbStrm->GetStrm(); if ( pSbStrm->IsText() ) { @@ -3268,7 +3235,7 @@ RTLFUNC(FileAttr) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3277,9 +3244,9 @@ RTLFUNC(FileAttr) StarBASIC::Error( SbERR_BAD_CHANNEL ); return; } - INT16 nRet; + sal_Int16 nRet; if ( rPar.Get(2)->GetInteger() == 1 ) - nRet = (INT16)(pSbStrm->GetMode()); + nRet = (sal_Int16)(pSbStrm->GetMode()); else nRet = 0; // System file handle not supported @@ -3296,7 +3263,7 @@ RTLFUNC(Loc) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); if ( !pSbStrm ) @@ -3305,7 +3272,7 @@ RTLFUNC(Loc) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - ULONG nPos; + sal_uIntPtr nPos; if( pSbStrm->IsRandom()) { short nBlockLen = pSbStrm->GetBlockLen(); @@ -3320,7 +3287,7 @@ RTLFUNC(Loc) nPos = ( pSvStrm->Tell()+1 ) / 128; else nPos = pSvStrm->Tell(); - rPar.Get(0)->PutLong( (INT32)nPos ); + rPar.Get(0)->PutLong( (sal_Int32)nPos ); } } @@ -3334,7 +3301,7 @@ RTLFUNC(Lof) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); if ( !pSbStrm ) @@ -3343,10 +3310,10 @@ RTLFUNC(Lof) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - ULONG nOldPos = pSvStrm->Tell(); - ULONG nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); + sal_uIntPtr nOldPos = pSvStrm->Tell(); + sal_uIntPtr nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); pSvStrm->Seek( nOldPos ); - rPar.Get(0)->PutLong( (INT32)nLen ); + rPar.Get(0)->PutLong( (sal_Int32)nLen ); } } @@ -3363,7 +3330,7 @@ RTLFUNC(Seek) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); // nChannel--; SbiIoSystem* pIO = pINST->GetIoSystem(); SbiStream* pSbStrm = pIO->GetStream( nChannel ); @@ -3376,15 +3343,15 @@ RTLFUNC(Seek) if ( nArgs == 2 ) // Seek-Function { - ULONG nPos = pStrm->Tell(); + sal_uIntPtr nPos = pStrm->Tell(); if( pSbStrm->IsRandom() ) nPos = nPos / pSbStrm->GetBlockLen(); nPos++; // Basic zaehlt ab 1 - rPar.Get(0)->PutLong( (INT32)nPos ); + rPar.Get(0)->PutLong( (sal_Int32)nPos ); } else // Seek-Statement { - INT32 nPos = rPar.Get(2)->GetLong(); + sal_Int32 nPos = rPar.Get(2)->GetLong(); if ( nPos < 1 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -3394,7 +3361,7 @@ RTLFUNC(Seek) pSbStrm->SetExpandOnWriteTo( 0 ); if ( pSbStrm->IsRandom() ) nPos *= pSbStrm->GetBlockLen(); - pStrm->Seek( (ULONG)nPos ); + pStrm->Seek( (sal_uIntPtr)nPos ); pSbStrm->SetExpandOnWriteTo( nPos ); } } @@ -3404,7 +3371,7 @@ RTLFUNC(Format) (void)pBasic; (void)bWrite; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if ( nArgCount < 2 || nArgCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else @@ -3428,11 +3395,11 @@ RTLFUNC(Randomize) if ( rPar.Count() > 2 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); - INT16 nSeed; + sal_Int16 nSeed; if( rPar.Count() == 2 ) - nSeed = (INT16)rPar.Get(1)->GetInteger(); + nSeed = (sal_Int16)rPar.Get(1)->GetInteger(); else - nSeed = (INT16)rand(); + nSeed = (sal_Int16)rand(); srand( nSeed ); } @@ -3453,7 +3420,7 @@ RTLFUNC(Rnd) // -// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = FALSE ]]]) +// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]]) // // WindowStyles (VBA-kompatibel): // 2 == Minimized @@ -3477,7 +3444,7 @@ RTLFUNC(Shell) return; } - ULONG nArgCount = rPar.Count(); + sal_uIntPtr nArgCount = rPar.Count(); if ( nArgCount < 2 || nArgCount > 5 ) { rPar.Get(0)->PutLong(0); @@ -3499,13 +3466,13 @@ RTLFUNC(Shell) // Spezial-Behandlung (leere Liste) vermeiden aCmdLine.AppendAscii( " " ); } - USHORT nLen = aCmdLine.Len(); + sal_uInt16 nLen = aCmdLine.Len(); // #55735 Wenn Parameter dabei sind, muessen die abgetrennt werden // #72471 Auch die einzelnen Parameter trennen std::list<String> aTokenList; String aToken; - USHORT i = 0; + sal_uInt16 i = 0; sal_Unicode c; while( i < nLen ) { @@ -3519,7 +3486,7 @@ RTLFUNC(Shell) if( c == '\"' || c == '\'' ) { - USHORT iFoundPos = aCmdLine.Search( c, i + 1 ); + sal_uInt16 iFoundPos = aCmdLine.Search( c, i + 1 ); // Wenn nichts gefunden wurde, Rest kopieren if( iFoundPos == STRING_NOTFOUND ) @@ -3535,9 +3502,9 @@ RTLFUNC(Shell) } else { - USHORT iFoundSpacePos = aCmdLine.Search( ' ', i ); - USHORT iFoundTabPos = aCmdLine.Search( '\t', i ); - USHORT iFoundPos = Min( iFoundSpacePos, iFoundTabPos ); + sal_uInt16 iFoundSpacePos = aCmdLine.Search( ' ', i ); + sal_uInt16 iFoundTabPos = aCmdLine.Search( '\t', i ); + sal_uInt16 iFoundPos = Min( iFoundSpacePos, iFoundTabPos ); // Wenn nichts gefunden wurde, Rest kopieren if( iFoundPos == STRING_NOTFOUND ) @@ -3557,7 +3524,7 @@ RTLFUNC(Shell) } // #55735 / #72471 Ende - INT16 nWinStyle = 0; + sal_Int16 nWinStyle = 0; if( nArgCount >= 3 ) { nWinStyle = rPar.Get(2)->GetInteger(); @@ -3574,7 +3541,7 @@ RTLFUNC(Shell) break; } - BOOL bSync = FALSE; + sal_Bool bSync = sal_False; if( nArgCount >= 5 ) bSync = rPar.Get(4)->GetBool(); if( bSync ) @@ -3589,7 +3556,7 @@ RTLFUNC(Shell) ++iter; - USHORT nParamCount = sal::static_int_cast< USHORT >( + sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >( aTokenList.size() - 1 ); rtl_uString** pParamList = NULL; if( nParamCount ) @@ -3605,7 +3572,7 @@ RTLFUNC(Shell) } oslProcess pApp; - BOOL bSucc = osl_executeProcess( + sal_Bool bSucc = osl_executeProcess( aOUStrProgUNC.pData, pParamList, nParamCount, @@ -3650,7 +3617,7 @@ RTLFUNC(VarType) else { SbxDataType eType = rPar.Get(1)->GetType(); - rPar.Get(0)->PutInteger( (INT16)eType ); + rPar.Get(0)->PutInteger( (sal_Int16)eType ); } } @@ -3700,7 +3667,7 @@ String getBasicTypeName( SbxDataType eType ) }; int nPos = ((int)eType) & 0x0FFF; - USHORT nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* ); + sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* ); if ( nPos < 0 || nPos >= nTypeNameCount ) nPos = nTypeNameCount - 1; String aRetStr = String::CreateFromAscii( pTypeNames[nPos] ); @@ -3776,7 +3743,7 @@ RTLFUNC(TypeName) else { SbxDataType eType = rPar.Get(1)->GetType(); - BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 ); + sal_Bool bIsArray = ( ( eType & SbxARRAY ) != 0 ); String aRetStr; if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT ) @@ -3799,7 +3766,7 @@ RTLFUNC(Len) else { const String& rStr = rPar.Get(1)->GetString(); - rPar.Get(0)->PutLong( (INT32)rStr.Len() ); + rPar.Get(0)->PutLong( (sal_Int32)rStr.Len() ); } } @@ -3825,7 +3792,7 @@ RTLFUNC(DDEInitiate) const String& rTopic = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); - INT16 nChannel; + sal_Int16 nChannel; SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel ); if( nDdeErr ) StarBASIC::Error( nDdeErr ); @@ -3852,7 +3819,7 @@ RTLFUNC(DDETerminate) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); SbiDdeControl* pDDE = pINST->GetDdeControl(); SbError nDdeErr = pDDE->Terminate( nChannel ); if( nDdeErr ) @@ -3904,7 +3871,7 @@ RTLFUNC(DDERequest) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rItem = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); String aResult; @@ -3934,7 +3901,7 @@ RTLFUNC(DDEExecute) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rCommand = rPar.Get(2)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); SbError nDdeErr = pDDE->Execute( nChannel, rCommand ); @@ -3961,7 +3928,7 @@ RTLFUNC(DDEPoke) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT16 nChannel = rPar.Get(1)->GetInteger(); + sal_Int16 nChannel = rPar.Get(1)->GetInteger(); const String& rItem = rPar.Get(2)->GetString(); const String& rData = rPar.Get(3)->GetString(); SbiDdeControl* pDDE = pINST->GetDdeControl(); @@ -4001,7 +3968,7 @@ RTLFUNC(LBound) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4011,7 +3978,7 @@ RTLFUNC(LBound) SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); if( pArr ) { - INT32 nLower, nUpper; + sal_Int32 nLower, nUpper; short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; if( !pArr->GetDim32( nDim, nLower, nUpper ) ) StarBASIC::Error( SbERR_OUT_OF_RANGE ); @@ -4027,7 +3994,7 @@ RTLFUNC(UBound) (void)pBasic; (void)bWrite; - USHORT nParCount = rPar.Count(); + sal_uInt16 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4038,7 +4005,7 @@ RTLFUNC(UBound) SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); if( pArr ) { - INT32 nLower, nUpper; + sal_Int32 nLower, nUpper; short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; if( !pArr->GetDim32( nDim, nLower, nUpper ) ) StarBASIC::Error( SbERR_OUT_OF_RANGE ); @@ -4060,10 +4027,10 @@ RTLFUNC(RGB) return; } - ULONG nRed = rPar.Get(1)->GetInteger() & 0xFF; - ULONG nGreen = rPar.Get(2)->GetInteger() & 0xFF; - ULONG nBlue = rPar.Get(3)->GetInteger() & 0xFF; - ULONG nRGB; + sal_uIntPtr nRed = rPar.Get(1)->GetInteger() & 0xFF; + sal_uIntPtr nGreen = rPar.Get(2)->GetInteger() & 0xFF; + sal_uIntPtr nBlue = rPar.Get(3)->GetInteger() & 0xFF; + sal_uIntPtr nRGB; SbiInstance* pInst = pINST; bool bCompatibility = ( pInst && pInst->IsCompatibility() ); @@ -4083,7 +4050,7 @@ RTLFUNC(QBColor) (void)pBasic; (void)bWrite; - static const INT32 pRGB[] = + static const sal_Int32 pRGB[] = { 0x000000, 0x800000, @@ -4109,13 +4076,13 @@ RTLFUNC(QBColor) return; } - INT16 nCol = rPar.Get(1)->GetInteger(); + sal_Int16 nCol = rPar.Get(1)->GetInteger(); if( nCol < 0 || nCol > 15 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - INT32 nRGB = pRGB[ nCol ]; + sal_Int32 nRGB = pRGB[ nCol ]; rPar.Get(0)->PutLong( nRGB ); } @@ -4125,7 +4092,7 @@ RTLFUNC(StrConv) (void)pBasic; (void)bWrite; - ULONG nArgCount = rPar.Count()-1; + sal_uIntPtr nArgCount = rPar.Count()-1; if( nArgCount < 2 || nArgCount > 3 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4133,16 +4100,16 @@ RTLFUNC(StrConv) } String aOldStr = rPar.Get(1)->GetString(); - INT32 nConversion = rPar.Get(2)->GetLong(); + sal_Int32 nConversion = rPar.Get(2)->GetLong(); - USHORT nLanguage = LANGUAGE_SYSTEM; + sal_uInt16 nLanguage = LANGUAGE_SYSTEM; if( nArgCount == 3 ) { // LCID not supported now //nLanguage = rPar.Get(3)->GetInteger(); } - USHORT nOldLen = aOldStr.Len(); + sal_uInt16 nOldLen = aOldStr.Len(); if( nOldLen == 0 ) { // null string,return @@ -4150,7 +4117,7 @@ RTLFUNC(StrConv) return; } - INT32 nType = 0; + sal_Int32 nType = 0; if ( (nConversion & 0x03) == 3 ) // vbProperCase { CharClass& rCharClass = GetCharClass(); @@ -4184,10 +4151,10 @@ RTLFUNC(StrConv) if ( (nConversion & 0x40) == 64 ) // vbUnicode { // convert the string to byte string, preserving unicode (2 bytes per character) - USHORT nSize = aNewStr.Len()*2; + sal_uInt16 nSize = aNewStr.Len()*2; const sal_Unicode* pSrc = aNewStr.GetBuffer(); sal_Char* pChar = new sal_Char[nSize+1]; - for( USHORT i=0; i < nSize; i++ ) + for( sal_uInt16 i=0; i < nSize; i++ ) { pChar[i] = static_cast< sal_Char >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff ); if( i%2 ) @@ -4208,7 +4175,7 @@ RTLFUNC(StrConv) // there is no concept about default codepage in unix. so it is incorrectly in unix ::rtl::OString aOStr = ::rtl::OUStringToOString(aNewStr,osl_getThreadTextEncoding()); const sal_Char* pChar = aOStr.getStr(); - USHORT nArraySize = static_cast< USHORT >( aOStr.getLength() ); + sal_uInt16 nArraySize = static_cast< sal_uInt16 >( aOStr.getLength() ); SbxDimArray* pArray = new SbxDimArray(SbxBYTE); bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); if(nArraySize) @@ -4223,7 +4190,7 @@ RTLFUNC(StrConv) pArray->unoAddDim( 0, -1 ); } - for( USHORT i=0; i< nArraySize; i++) + for( sal_uInt16 i=0; i< nArraySize; i++) { SbxVariable* pNew = new SbxVariable( SbxBYTE ); pNew->PutByte(*pChar); @@ -4236,7 +4203,7 @@ RTLFUNC(StrConv) } SbxVariableRef refVar = rPar.Get(0); - USHORT nFlags = refVar->GetFlags(); + sal_uInt16 nFlags = refVar->GetFlags(); refVar->ResetFlag( SBX_FIXED ); refVar->PutObject( pArray ); refVar->SetFlags( nFlags ); @@ -4392,17 +4359,17 @@ RTLFUNC(MsgBox) WB_YES_NO, // MB_YESNO WB_RETRY_CANCEL // MB_RETRYCANCEL }; - static const INT16 nButtonMap[] = + static const sal_Int16 nButtonMap[] = { - 2, // #define RET_CANCEL FALSE - 1, // #define RET_OK TRUE + 2, // #define RET_CANCEL sal_False + 1, // #define RET_OK sal_True 6, // #define RET_YES 2 7, // #define RET_NO 3 4 // #define RET_RETRY 4 }; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if( nArgCount < 2 || nArgCount > 6 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); @@ -4469,11 +4436,11 @@ RTLFUNC(MsgBox) pBox = new MessBox( pParent, nWinBits, aTitle, aMsg ); } pBox->SetText( aTitle ); - USHORT nRet = (USHORT)pBox->Execute(); - if( nRet == TRUE ) + sal_uInt16 nRet = (sal_uInt16)pBox->Execute(); + if( nRet == sal_True ) nRet = 1; - INT16 nMappedRet; + sal_Int16 nMappedRet; if( nStyle == 2 ) { nMappedRet = nRet; @@ -4496,7 +4463,7 @@ RTLFUNC(SetAttr) // JSM if ( rPar.Count() == 3 ) { String aStr = rPar.Get(1)->GetString(); - INT16 nFlags = rPar.Get(2)->GetInteger(); + sal_Int16 nFlags = rPar.Get(2)->GetInteger(); // <-- UCB if( hasUno() ) @@ -4524,16 +4491,6 @@ RTLFUNC(SetAttr) // JSM // #57064 Bei virtuellen URLs den Real-Path extrahieren DirEntry aEntry( aStr ); String aFile = aEntry.GetFull(); - #ifdef WIN - int nErr = _dos_setfileattr( aFile.GetStr(),(unsigned ) nFlags ); - if ( nErr ) - { - if (errno == EACCES) - StarBASIC::Error( SbERR_ACCESS_DENIED ); - else - StarBASIC::Error( SbERR_FILE_NOT_FOUND ); - } - #endif ByteString aByteFile( aFile, gsl_getSystemTextEncoding() ); #ifdef WNT if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags)) @@ -4582,7 +4539,7 @@ RTLFUNC(DumpAllObjects) (void)pBasic; (void)bWrite; - USHORT nArgCount = (USHORT)rPar.Count(); + sal_uInt16 nArgCount = (sal_uInt16)rPar.Count(); if( nArgCount < 2 || nArgCount > 3 ) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else if( !pBasic ) @@ -4610,7 +4567,7 @@ RTLFUNC(FileExists) if ( rPar.Count() == 2 ) { String aStr = rPar.Get(1)->GetString(); - BOOL bExists = FALSE; + sal_Bool bExists = sal_False; // <-- UCB if( hasUno() ) @@ -4657,10 +4614,10 @@ RTLFUNC(Partition) return; } - INT32 nNumber = rPar.Get(1)->GetLong(); - INT32 nStart = rPar.Get(2)->GetLong(); - INT32 nStop = rPar.Get(3)->GetLong(); - INT32 nInterval = rPar.Get(4)->GetLong(); + sal_Int32 nNumber = rPar.Get(1)->GetLong(); + sal_Int32 nStart = rPar.Get(2)->GetLong(); + sal_Int32 nStop = rPar.Get(3)->GetLong(); + sal_Int32 nInterval = rPar.Get(4)->GetLong(); if( nStart < 0 || nStop <= nStart || nInterval < 1 ) { @@ -4677,9 +4634,9 @@ RTLFUNC(Partition) // calculate the maximun number of characters before lowervalue and uppervalue ::rtl::OUString aBeforeStart = ::rtl::OUString::valueOf( nStart - 1 ); ::rtl::OUString aAfterStop = ::rtl::OUString::valueOf( nStop + 1 ); - INT32 nLen1 = aBeforeStart.getLength(); - INT32 nLen2 = aAfterStop.getLength(); - INT32 nLen = nLen1 >= nLen2 ? nLen1:nLen2; + sal_Int32 nLen1 = aBeforeStart.getLength(); + sal_Int32 nLen2 = aAfterStop.getLength(); + sal_Int32 nLen = nLen1 >= nLen2 ? nLen1:nLen2; ::rtl::OUStringBuffer aRetStr( nLen * 2 + 1); ::rtl::OUString aLowerValue; @@ -4694,8 +4651,8 @@ RTLFUNC(Partition) } else { - INT32 nLowerValue = nNumber; - INT32 nUpperValue = nLowerValue; + sal_Int32 nLowerValue = nNumber; + sal_Int32 nUpperValue = nLowerValue; if( nInterval > 1 ) { nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart; @@ -4712,14 +4669,14 @@ RTLFUNC(Partition) if( nLen > nLen1 ) { // appending the leading spaces for the lowervalue - for ( INT32 i= (nLen - nLen1) ; i > 0; --i ) + for ( sal_Int32 i= (nLen - nLen1) ; i > 0; --i ) aRetStr.appendAscii(" "); } aRetStr.append( aLowerValue ).appendAscii(":"); if( nLen > nLen2 ) { // appending the leading spaces for the uppervalue - for ( INT32 i= (nLen - nLen2) ; i > 0; --i ) + for ( sal_Int32 i= (nLen - nLen2) ; i > 0; --i ) aRetStr.appendAscii(" "); } aRetStr.append( aUpperValue ); |