[Libreoffice-commits] .: connectivity/source desktop/win32 sfx2/source shell/source

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Sat Oct 16 22:27:43 PDT 2010


 connectivity/source/drivers/dbase/DTable.cxx       |   22 ---------------------
 connectivity/source/parse/sqlbison.y               |    7 +++---
 desktop/win32/source/guistdio/guistdio.inc         |    3 +-
 desktop/win32/source/officeloader/officeloader.cxx |    3 +-
 desktop/win32/source/rebase/rebase.cxx             |    5 ++--
 sfx2/source/appl/shutdowniconaqua.mm               |    3 +-
 shell/source/win32/SysShExec.cxx                   |    3 +-
 7 files changed, 16 insertions(+), 30 deletions(-)

New commits:
commit 2f66ff459bebbb8f181bc9e8a4e77685c874ff67
Author: Kenneth Venken <kenneth.venken at gmail.com>
Date:   Sun Oct 17 00:13:19 2010 -0500

    use SAL_N_ELEMENTS macro

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 75c9922..62b2bc8 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -183,7 +183,7 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::u
             _rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
         else
             _rDateTime.Year = static_cast<sal_uInt16>(kc - 4715);
-    } // if ( _nJulianDate )
+    }
 
     if ( _nJulianTime )
     {
@@ -192,26 +192,6 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::u
         double d_h  = d_m / 60;
         _rDateTime.Hours = (sal_uInt16) (d_h);
         _rDateTime.Minutes = (sal_uInt16) d_m;			// integer _aDateTime.Minutes
-        //// weird: time fix
-     //   int test = (_rDateTime.Hours % 3) * 100 + _rDateTime.Minutes;
-        //int test_tbl[] = {0, 1, 2, 11, 12, 13, 22, 23, 24, 25, 34, 35, 36,
-        //	45, 46, 47, 56, 57, 58, 107, 108, 109, 110, 119, 120, 121,
-        //	130, 131, 132, 141, 142, 143, 152, 153, 154, 155, 204, 205,
-        //	206, 215, 216, 217, 226, 227, 228, 237, 238, 239, 240, 249,
-        //	250, 251};
-     //   for (int i = 0; i < sizeof(test_tbl)/sizeof(test_tbl[0]); i++)
-        //{
-        //    if (test == test_tbl[i])
-        //    {
-        //	// frac += 0.000012;
-        //	    //d_hour = frac * 24.0;
-        //	    _rDateTime.Hours = (sal_uInt16)d_hour;
-        //	    d_minute = (d_hour - (double)_rDateTime.Hours) * 60.0;
-        //	    _rDateTime.Minutes = (sal_uInt16)d_minute;
-        //	    break;
-        //    }
-     //   }
-
         _rDateTime.Seconds = static_cast<sal_uInt16>(( d_m - (double) _rDateTime.Minutes ) * 60.0);
     }
 }
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 84e9aa2..a002e16 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -87,6 +87,7 @@
 #include "connectivity/dbconversion.hxx"
 #endif
 #include <rtl/ustrbuf.hxx>
+#include <sal/macros.h>
 
 #if defined __GNUC__
     #pragma GCC system_header
@@ -4007,7 +4008,7 @@ IParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ::rtl::O
         KEY_VAR_POP,KEY_COLLECT,KEY_FUSION,KEY_INTERSECTION
 	};
 
-	sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0];
+	sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID );
 	for (sal_uInt32 i = 0; i < nCount; i++)
 	{
 		::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]);
@@ -4221,7 +4222,7 @@ OSQLParseNode* OSQLParser::parseTree(::rtl::OUString& rErrorMessage,
 //-----------------------------------------------------------------------------
 ::rtl::OUString OSQLParser::RuleIDToStr(sal_uInt32 nRuleID)
 {
-	OSL_ENSURE(nRuleID < (sizeof yytname/sizeof yytname[0]), "OSQLParser::RuleIDToStr: Invalid nRuleId!");
+	OSL_ENSURE(nRuleID < SAL_N_ELEMENTS(yytname), "OSQLParser::RuleIDToStr: Invalid nRuleId!");
 	return ::rtl::OUString::createFromAscii(yytname[nRuleID]);
 }
 
@@ -4230,7 +4231,7 @@ sal_uInt32 OSQLParser::StrToRuleID(const ::rtl::OString & rValue)
 {
 	// In yysvar nach dem angegebenen Namen suchen, den Index zurueckliefern
 	// (oder 0, wenn nicht gefunden)
-	static sal_uInt32 nLen = sizeof(yytname)/sizeof(yytname[0]);
+	static sal_uInt32 nLen = SAL_N_ELEMENTS(yytname);
 	for (sal_uInt32 i = YYTRANSLATE(SQL_TOKEN_INVALIDSYMBOL); i < (nLen-1); i++)
 	{
 		if (yytname && rValue == yytname[i])
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc
index 7f2bbe9..7009b24 100644
--- a/desktop/win32/source/guistdio/guistdio.inc
+++ b/desktop/win32/source/guistdio/guistdio.inc
@@ -43,6 +43,7 @@
 #include <systools/win32/uwinapi.h>
 
 #include <stdio.h>
+#include <sal/macros.h>
 
 #ifdef UNOPKG
 
@@ -358,7 +359,7 @@ int _tmain( int, _TCHAR ** )
 	{
 		size_t len = lpLastDot - szModuleFileName;
 		_tcsncpy( szTargetFileName, szModuleFileName, len );
-		_tcsncpy( szTargetFileName + len, _T(".EXE"), sizeof(szTargetFileName)/sizeof(szTargetFileName[0]) - len );
+		_tcsncpy( szTargetFileName + len, _T(".EXE"), SAL_N_ELEMENTS(szTargetFileName) - len );
 	}
 
 	// Create process with same command line, environment and stdio handles which
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index 094d7fd..c5e34dc 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -51,6 +51,7 @@
 #include <systools/win32/uwinapi.h>
 
 #include "rtl/string.h"
+#include <sal/macros.h>
 
 #include "../../../source/inc/exithelper.hxx"
 #include "../extendloaderenvironment.hxx"
@@ -201,7 +202,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
     {
         size_t len = lpLastSlash - szModuleFileName + 1;
         _tcsncpy( szPerfTuneIniFile, szModuleFileName, len );
-        _tcsncpy( szPerfTuneIniFile + len, _T("perftune.ini"), sizeof(szPerfTuneIniFile)/sizeof(szPerfTuneIniFile[0]) - len );
+        _tcsncpy( szPerfTuneIniFile + len, _T("perftune.ini"), SAL_N_ELEMENTS(szPerfTuneIniFile) - len );
     }
 
     // Create process with same command line, environment and stdio handles which
diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx
index 5afc00b..e712c8d 100644
--- a/desktop/win32/source/rebase/rebase.cxx
+++ b/desktop/win32/source/rebase/rebase.cxx
@@ -44,6 +44,7 @@
 
 #include <time.h>
 #include "sal/config.h"
+#include <sal/macros.h>
 #include "tools/pathutils.hxx"
 
 #define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
@@ -120,7 +121,7 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
     {
         size_t len = lpLastSlash - pszFolder + 1;
         wcsncpy( szPattern, pszFolder, len );
-        wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
+        wcsncpy( szPattern + len, TEXT("*.dll"), SAL_N_ELEMENTS(szPattern) - len );
     }
 
     WIN32_FIND_DATA	aFindFileData;
@@ -138,7 +139,7 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
             {
                 size_t len = lpLastSlash - pszFolder + 1;
                 wcsncpy( szLibFilePath, pszFolder, len );
-                wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
+                wcsncpy( szLibFilePath + len, aFindFileData.cFileName, SAL_N_ELEMENTS(szLibFilePath) - len );
             }
 
             rebaseImage( szLibFilePath, nNewImageBase );
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index 14f12c7..a5bca0c 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -36,6 +36,7 @@
 #include "comphelper/sequenceashashmap.hxx"
 #include "vos/mutex.hxx"
 #include "sfx2/app.hxx"
+#include <sal/macros.h>
 #include "app.hrc"
 #define USE_APP_SHORTCUTS
 #include "shutdownicon.hxx"
@@ -454,7 +455,7 @@ void aqua_init_systray()
             }
             
             // insert the menu entries for launching the applications
-            for ( size_t i = 0; i < sizeof( aMenuItems ) / sizeof( aMenuItems[0] ); ++i )
+            for ( size_t i = 0; i < SAL_N_ELEMENTS( aMenuItems ); ++i )
             {
                 if ( !aModuleOptions.IsModuleInstalled( aMenuItems[i].eModuleIdentifier ) )
                     // the complete application is not even installed
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index e89ebfb..729812f 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -35,6 +35,7 @@
 #include <osl/diagnose.h>
 #include "SysShExec.hxx"
 #include <osl/file.hxx>
+#include <sal/macros.h>
 
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 
@@ -145,7 +146,7 @@ namespace // private
     };
 
     /* size of the table */
-    #define ERRTABLESIZE (sizeof(errtable)/sizeof(errtable[0]))
+    #define ERRTABLESIZE (SAL_N_ELEMENTS(errtable))
 
     /* The following two constants must be the minimum and maximum
     values in the (contiguous) range of osl_File_E_xec Failure errors. */


More information about the Libreoffice-commits mailing list