ooo-build r11535 - in trunk: . patches/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11535 - in trunk: . patches/vba
- Date: Fri, 8 Feb 2008 09:40:35 +0000 (GMT)
Author: noelpwer
Date: Fri Feb 8 09:40:35 2008
New Revision: 11535
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11535&view=rev
Log:
2008-02-08 Noel Power <noel power novell com>
* patches/vba/n353254-dateserial.diff: tweak to be just vba mode
specific
Modified:
trunk/ChangeLog
trunk/patches/vba/n353254-dateserial.diff
Modified: trunk/patches/vba/n353254-dateserial.diff
==============================================================================
--- trunk/patches/vba/n353254-dateserial.diff (original)
+++ trunk/patches/vba/n353254-dateserial.diff Fri Feb 8 09:40:35 2008
@@ -1,43 +1,55 @@
---- basic/source/runtime/methods.cxx.orig 2008-01-23 17:25:09.000000000 +0800
-+++ basic/source/runtime/methods.cxx 2008-01-31 10:29:31.000000000 +0800
-@@ -1830,15 +1830,36 @@ BOOL implDateSerial( INT16 nYear, INT16
+--- basic/source/runtime/methods.cxx 2008-02-07 12:25:54.000000000 +0000
++++ basic/source/runtime/methods.cxx 2008-02-07 12:36:22.000000000 +0000
+@@ -1830,15 +1830,48 @@ BOOL implDateSerial( INT16 nYear, INT16
{
if ( nYear < 100 )
nYear += 1900;
- if ((nYear < 100 || nYear > 9999) ||
- (nMonth < 1 || nMonth > 12 ) ||
- (nDay < 1 || nDay > 31 ))
-+ if ((nYear < 100 || nYear > 9999))
++ Date aCurDate( nDay, nMonth, nYear );
++ if ((nYear < 100 || nYear > 9999) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return FALSE;
}
-
-- Date aCurDate( nDay, nMonth, nYear );
-+ // grab the year & month
-+ Date aCurDate( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
-+
-+ // adjust year based on month value
-+ // e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
-+ // 2000, 13, xx = 2001, 1, xx ( or January of the following year )
-+ if( ( nMonth < 1 ) || ( nMonth > 12 ) )
++ if ( !SbiRuntime::isVBAEnabled() )
+ {
-+ // inacurrate around leap year, don't use days to calculate,
-+ // just modify the months directory
-+ INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
-+ if ( nMonth <=0 )
-+ nYearAdj = ( ( nMonth -12 ) / 12 );
-+ aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
++ if ( (nMonth < 1 || nMonth > 12 )||
++ (nDay < 1 || nDay > 31 ) )
++ {
++ StarBASIC::Error( SbERR_BAD_ARGUMENT );
++ return FALSE;
++ }
+ }
-+
-+ // adjust day value,
-+ // e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month
-+ // 2000, 1, 32 = 2000, 2, 1 or the first day of the following month
-+ if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) )
-+ aCurDate += nDay - 1;
+ else
-+ aCurDate.SetDay( nDay );
++ {
++ // grab the year & month
++ aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
+
++ // adjust year based on month value
++ // e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
++ // 2000, 13, xx = 2001, 1, xx ( or January of the following year )
++ if( ( nMonth < 1 ) || ( nMonth > 12 ) )
++ {
++ // inacurrate around leap year, don't use days to calculate,
++ // just modify the months directory
++ INT16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
++ if ( nMonth <=0 )
++ nYearAdj = ( ( nMonth -12 ) / 12 );
++ aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
++ }
++
++ // adjust day value,
++ // e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month
++ // 2000, 1, 32 = 2000, 2, 1 or the first day of the following month
++ if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) )
++ aCurDate += nDay - 1;
++ else
++ aCurDate.SetDay( nDay );
++ }
+
+- Date aCurDate( nDay, nMonth, nYear );
long nDiffDays = GetDayDiff( aCurDate );
rdRet = (double)nDiffDays;
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]