You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2005/07/20 16:42:14 UTC

svn commit: r219918 - /xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp

Author: cargilld
Date: Wed Jul 20 07:42:14 2005
New Revision: 219918

URL: http://svn.apache.org/viewcvs?rev=219918&view=rev
Log:
Update XMLDateTime to correctly test for timezone.

Modified:
    xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp

Modified: xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp?rev=219918&r1=219917&r2=219918&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLDateTime.cpp Wed Jul 20 07:42:14 2005
@@ -568,9 +568,9 @@
     fValue[Day]      = parseInt(fStart+3, fStart+5);
 
     if ( DAY_SIZE < fEnd )
-    {
-        int sign = findUTCSign(DAY_SIZE);
-        if ( sign < 0 )
+    {        
+        int pos = XMLString::indexOf(UTC_SET, fBuffer[DAY_SIZE]);
+        if (pos == -1 )
         {
             ThrowXMLwithMemMgr1(SchemaDateTimeException
                     , XMLExcepts::DateTime_gDay_invalid
@@ -579,7 +579,8 @@
         }
         else
         {
-            getTimeZone(sign);
+            fValue[utc] = pos+1;
+            getTimeZone(DAY_SIZE);
         }
     }
 
@@ -623,9 +624,9 @@
     // parse TimeZone if any
     //
     if ( fStart < fEnd )
-    {
-        int sign = findUTCSign(fStart);
-        if ( sign < 0 )
+    {      
+        int pos = XMLString::indexOf(UTC_SET, fBuffer[fStart]);
+        if ( pos == NOT_FOUND )
         {
             ThrowXMLwithMemMgr1(SchemaDateTimeException
                     , XMLExcepts::DateTime_gMth_invalid
@@ -634,7 +635,8 @@
         }
         else
         {
-            getTimeZone(sign);
+            fValue[utc] = pos+1;
+            getTimeZone(fStart);
         }
     }
 
@@ -697,9 +699,9 @@
     fValue[Day]      = parseInt(5, 7);
 
     if ( MONTHDAY_SIZE < fEnd )
-    {
-        int sign = findUTCSign(MONTHDAY_SIZE);
-        if ( sign<0 )
+    {        
+        int pos = XMLString::indexOf(UTC_SET, fBuffer[MONTHDAY_SIZE]);
+        if ( pos == NOT_FOUND )
         {
             ThrowXMLwithMemMgr1(SchemaDateTimeException
                     , XMLExcepts::DateTime_gMthDay_invalid
@@ -708,7 +710,8 @@
         }
         else
         {
-            getTimeZone(sign);
+            fValue[utc] = pos+1;
+            getTimeZone(MONTHDAY_SIZE);
         }
     }
 
@@ -1091,21 +1094,19 @@
 
 void XMLDateTime::parseTimeZone()
 {
-    if ( fStart < fEnd )
-    {
-        int sign = findUTCSign(fStart);
-        if ( sign < 0 )
-        {
+    //fStart points right after the date   	 
+  	if ( fStart < fEnd ) {
+        int pos = XMLString::indexOf(UTC_SET, fBuffer[fStart]);
+    	if (pos == NOT_FOUND) {
             ThrowXMLwithMemMgr1(SchemaDateTimeException
                     , XMLExcepts::DateTime_tz_noUTCsign
                     , fBuffer
                     , fMemoryManager);
-            //("Error in month parsing");
-        }
-        else
-        {
-            getTimeZone(sign);
-        }
+   		}
+   		else { 
+            fValue[utc] = pos+1;
+  	        getTimeZone(fStart);   		
+   		}
     }
 
     return;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org