axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: ws-axis/c/tests/auto_build/testcases/output XSDElement.expected
Date Tue, 14 Jun 2005 11:57:04 GMT
dicka       2005/06/14 04:57:04

  Modified:    c/src/soap/xsd Integer.cpp NonNegativeInteger.cpp
                        NonPositiveInteger.cpp
               c/tests/auto_build/testcases/client/cpp XSDElementClient.cpp
               c/tests/auto_build/testcases/output XSDElement.expected
  Log:
  Resolve problem wiht deserializing large xsd:long values.
  Improved XSDElement testcase to check upper and lower limites of xsd:long.
  
  PR: AXISCPP-690
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.14      +30 -6     ws-axis/c/src/soap/xsd/Integer.cpp
  
  Index: Integer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Integer.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Integer.cpp	1 Jun 2005 14:22:56 -0000	1.13
  +++ Integer.cpp	14 Jun 2005 11:57:04 -0000	1.14
  @@ -108,7 +108,7 @@
           if ( *value > maxInclusive->getMaxInclusiveAsLONGLONG() )
           {
               AxisString exceptionMessage =
  -            "Value to be serialized is less than MaxInclusive specified for this type.
 MaxInclusive = ";
  +            "Value to be serialized is greater than MaxInclusive specified for this type.
 MaxInclusive = ";
               AxisChar* length = new AxisChar[25];
               sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsLONGLONG());
               exceptionMessage += length;
  @@ -130,7 +130,7 @@
           if ( *value >= maxExclusive->getMaxExclusiveAsLONGLONG() )
           {
               AxisString exceptionMessage =
  -            "Value to be serialized is less than or equal to MaxExclusive specified for
this type.  MaxExclusive = ";
  +            "Value to be serialized is greater than or equal to MaxExclusive specified
for this type.  MaxExclusive = ";
               AxisChar* length = new AxisChar[25];
               sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsLONGLONG());
               exceptionMessage += length;
  @@ -172,11 +172,35 @@
   
   xsd__integer* Integer::deserializeInteger(const AxisChar* valueAsChar) throw (AxisSoapException)
   {
  -    AxisChar* end;
  -    
       xsd__integer * value = new xsd__integer;
  -    *value = strtol (valueAsChar, &end, 10);
  -  
  +    *value = 0;
  +	AxisChar currentNumber[] = {'\0', '\0'};
  +    int stringLength = strlen(valueAsChar);
  +    
  +    if (stringLength > 0)
  +    {
  +        int count = 0;
  +        
  +        if (valueAsChar[0] == '-')
  +        {
  +            count = 1;
  +        }
  +        
  +        for ( ; count < stringLength ;  count ++)
  +        {
  +            *value *= 10;
  +    
  +    		currentNumber[0] = valueAsChar[count];
  +    
  +            *value += atoi(currentNumber);
  +        }
  +        
  +        if (valueAsChar[0] == '-')
  +        {
  +            *value *= -1;
  +        }
  +    }
  +    
       return value;
   }
   
  
  
  
  1.13      +5 -5      ws-axis/c/src/soap/xsd/NonNegativeInteger.cpp
  
  Index: NonNegativeInteger.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NonNegativeInteger.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- NonNegativeInteger.cpp	1 Jun 2005 14:22:56 -0000	1.12
  +++ NonNegativeInteger.cpp	14 Jun 2005 11:57:04 -0000	1.13
  @@ -172,11 +172,11 @@
   
   xsd__nonNegativeInteger* NonNegativeInteger::deserializeNonNegativeInteger(const AxisChar*
valueAsChar) throw (AxisSoapException)
   {
  -    AxisChar* end;
  -    
  -    xsd__nonNegativeInteger * value = new xsd__nonNegativeInteger;
  -    *value = strtol (valueAsChar, &end, 10);
  -  
  +    xsd__integer* returnValue = Integer::deserializeInteger(valueAsChar);
  +
  +    xsd__nonNegativeInteger * value = new xsd__nonNegativeInteger; 
  +    *value = static_cast<xsd__nonNegativeInteger> (*returnValue);
  +    delete returnValue;
       return value;
   }
   
  
  
  
  1.8       +8 -9      ws-axis/c/src/soap/xsd/NonPositiveInteger.cpp
  
  Index: NonPositiveInteger.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NonPositiveInteger.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- NonPositiveInteger.cpp	1 Jun 2005 14:22:56 -0000	1.7
  +++ NonPositiveInteger.cpp	14 Jun 2005 11:57:04 -0000	1.8
  @@ -109,7 +109,7 @@
           if ( *value < maxInclusive->getMaxInclusiveAsUnsignedLONGLONG() )
           {
               AxisString exceptionMessage =
  -            "Value to be serialized is less than MaxInclusive specified for this type.
 MaxInclusive = -";
  +            "Value to be serialized is greater than MaxInclusive specified for this type.
 MaxInclusive = -";
               AxisChar* length = new AxisChar[25];
               sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsUnsignedLONGLONG());
               exceptionMessage += length;
  @@ -131,7 +131,7 @@
           if ( *value <= maxExclusive->getMaxExclusiveAsUnsignedLONGLONG() )
           {
               AxisString exceptionMessage =
  -            "Value to be serialized is less than or equal to MaxExclusive specified for
this type.  MaxExclusive = -";
  +            "Value to be serialized is greater than or equal to MaxExclusive specified
for this type.  MaxExclusive = -";
               AxisChar* length = new AxisChar[25];
               sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsUnsignedLONGLONG());
               exceptionMessage += length;
  @@ -181,20 +181,19 @@
   
   unsigned LONGLONG* NonPositiveInteger::deserializeNonPositiveInteger(const AxisChar* valueAsChar)
throw (AxisSoapException)
   {
  -    AxisChar* end;
  -    
  -    xsd__nonPositiveInteger * value = new xsd__nonPositiveInteger;
  +    xsd__integer* returnValue = NULL;
       if (*valueAsChar == '-')
       {
  -        const AxisChar* tempVar = valueAsChar + 1;
  -        *value = strtol (tempVar, &end, 10);
  +        returnValue = Integer::deserializeInteger(valueAsChar + 1);
       }
       else
       {
  -        
  -        *value = strtol (valueAsChar, &end, 10);
  +        returnValue = Integer::deserializeInteger(valueAsChar);
       }
     
  +    xsd__nonPositiveInteger * value = new xsd__nonPositiveInteger;
  +    *value = static_cast<xsd__nonPositiveInteger> (*returnValue);
  +    delete returnValue;
       return value;
   }
   
  
  
  
  1.10      +17 -1     ws-axis/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp
  
  Index: XSDElementClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XSDElementClient.cpp	1 Jun 2005 14:23:00 -0000	1.9
  +++ XSDElementClient.cpp	14 Jun 2005 11:57:04 -0000	1.10
  @@ -50,7 +50,7 @@
     // Cannot print an __int64 number with cout without this overloading
     std::ostream& operator<<(std::ostream& os, __int64 i )
     {
  -    char buf[20];
  +    char buf[40];
       sprintf(buf,"%I64d", i );
       os << buf;
       return os;
  @@ -134,6 +134,22 @@
   
   		lResult = ws->setGetDataLong((xsd__long)35);
   	    cout << "long=" << lResult << endl;
  +#ifdef WIN32
  +        xsd__long longInput     =  10000000000I64;
  +        xsd__long longMaxInput  =  9223372036854775807I64;
  +        xsd__long longMinInput  = -9223372036854775808I64 ;
  +#else
  +        xsd__long longInput     =  10000000000LL;
  +        xsd__long longMaxInput  =  9223372036854775807LL;
  +        xsd__long longMinInput  = -9223372036854775808LL;
  +#endif
  +        lResult = ws->setGetDataLong((xsd__long) longInput);
  +        cout << "long=" << lResult << endl;
  +        lResult = ws->setGetDataLong((xsd__long) longMaxInput);
  +        cout << "MaxInclusive long=" << lResult << endl;
  +        lResult = ws->setGetDataLong((xsd__long) longMinInput);
  +        cout << "MinInclusive long=" << lResult << endl;
  +
   		ulResult = ws->setGetDataUnsignedLong((xsd__unsignedLong)42);
   		printf("unsigned long=%d\n", ulResult);
   
  
  
  
  1.6       +3 -0      ws-axis/c/tests/auto_build/testcases/output/XSDElement.expected
  
  Index: XSDElement.expected
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/output/XSDElement.expected,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSDElement.expected	24 Mar 2005 14:27:18 -0000	1.5
  +++ XSDElement.expected	14 Jun 2005 11:57:04 -0000	1.6
  @@ -6,6 +6,9 @@
   int=21
   unsigned int=28
   long=35
  +long=10000000000
  +MaxInclusive long=9223372036854775807
  +MinInclusive long=-9223372036854775808
   unsigned long=42
   float=35.35359
   double=70.71759
  
  
  

Mime
View raw message