diff options
author | Kenneth Venken <kenneth.venken@gmail.com> | 2010-10-17 00:13:19 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-17 00:13:19 -0500 |
commit | a36dcb29132d4f8a0fc740a7714aec34ed53b8ce (patch) | |
tree | e00f9936cd53f3375e82816e2eb5d3e349f3eb18 /connectivity | |
parent | 3d361dbc2d69484657c42852dcfa426c00bc3175 (diff) |
use SAL_N_ELEMENTS macro
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 22 | ||||
-rw-r--r-- | connectivity/source/parse/sqlbison.y | 7 |
2 files changed, 5 insertions, 24 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 06373b68b1b8..fc4a9d3c119e 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 84e9aa2532ff..a002e167a51d 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]) |