You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/11/22 11:11:42 UTC

svn commit: r478106 [3/3] - /webservices/axis/trunk/c/src/soap/xsd/

Modified: webservices/axis/trunk/c/src/soap/xsd/GYear.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/GYear.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/GYear.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/GYear.cpp Wed Nov 22 02:11:36 2006
@@ -62,130 +62,132 @@
             {
                 AxisString exceptionMessage =
                 "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-                exceptionMessage += asctime(&minInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minInclusive;
-
-        MinExclusive* minExclusive = getMinExclusive();
-        if (minExclusive->isSet())
-        {
-            struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
-            if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-                exceptionMessage += asctime(&minExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete minExclusive;
-
-        MaxInclusive* maxInclusive = getMaxInclusive();
-        if (maxInclusive->isSet())
-        {
-            struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
-            if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
-                exceptionMessage += asctime(&maxInclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxInclusive;
-
-        MaxExclusive* maxExclusive = getMaxExclusive();
-        if (maxExclusive->isSet())
-        {
-            struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
-            if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
-            {
-                AxisString exceptionMessage =
-                "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-                exceptionMessage += asctime(&maxExclusiveAsStructTM);
-                exceptionMessage += ", Value = ";
-                exceptionMessage += asctime(value);
-                exceptionMessage += ".";
-                
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
-                    const_cast<AxisChar*>(exceptionMessage.c_str()));
-            }
-        }
-        delete maxExclusive;
-     
-        AxisString serializedValue = "";
-        AxisChar* valueAsString = new AxisChar[80];
-        strftime (valueAsString, 80, "%Y", value);
-        serializedValue += valueAsString;
-        delete [] valueAsString;
+            exceptionMessage += asctime(&minInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    }
+    delete minInclusive;
 
-        // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 24)
-            + (utcTime.tm_hour * 60)
-            + utcTime.tm_min;
-
-        long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 24)
-            + (localTime.tm_hour * 60)
-            + localTime.tm_min;
+    MinExclusive* minExclusive = getMinExclusive();
+    if (minExclusive->isSet())
+    {
+        struct tm minExclusiveAsStructTM = minExclusive->getMinExclusiveAsStructTM();
+        if ( 0 >= difftime(mktime(&minExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
+        {
+            AxisString exceptionMessage =
+            "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
+            exceptionMessage += asctime(&minExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete minExclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    }
+    delete minExclusive;
 
-        int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+    MaxInclusive* maxInclusive = getMaxInclusive();
+    if (maxInclusive->isSet())
+    {
+        struct tm maxInclusiveAsStructTM = maxInclusive->getMaxInclusiveAsStructTM();
+        if ( 0 < difftime(mktime(&maxInclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
+        {
+            AxisString exceptionMessage =
+            "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
+            exceptionMessage += asctime(&maxInclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete maxInclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    }
+    delete maxInclusive;
 
-        if (timeOffsetInMinutes == 0)
+    MaxExclusive* maxExclusive = getMaxExclusive();
+    if (maxExclusive->isSet())
+    {
+        struct tm maxExclusiveAsStructTM = maxExclusive->getMaxExclusiveAsStructTM();
+        if ( 0 <= difftime(mktime(&maxExclusiveAsStructTM), mktime(const_cast<struct tm*>(value))) )
         {
-            serializedValue += "Z";
+            AxisString exceptionMessage =
+            "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
+            exceptionMessage += asctime(&maxExclusiveAsStructTM);
+            exceptionMessage += ", Value = ";
+            exceptionMessage += asctime(value);
+            exceptionMessage += ".";
+            
+            delete maxExclusive;
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+                const_cast<AxisChar*>(exceptionMessage.c_str()));
+        }
+    }
+    delete maxExclusive;
+ 
+    AxisString serializedValue = "";
+    AxisChar valueAsString[80];
+    strftime (valueAsString, 80, "%Y", value);
+    serializedValue += valueAsString;
+
+    // Calculate local timezone offset
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInMinutes = (utcTime.tm_year * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 24)
+        + (utcTime.tm_hour * 60)
+        + utcTime.tm_min;
+
+    long localTimeInMinutes = (localTime.tm_year * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 24)
+        + (localTime.tm_hour * 60)
+        + localTime.tm_min;
+
+    int timeOffsetInMinutes = localTimeInMinutes - utcTimeInMinutes;
+
+    if (timeOffsetInMinutes == 0)
+    {
+        serializedValue += "Z";
+    }
+    else
+    {
+        struct tm timeOffset;
+        timeOffset.tm_year = 0;
+        timeOffset.tm_yday = 0;
+        timeOffset.tm_sec = 0;
+        timeOffset.tm_min = timeOffsetInMinutes % 60;
+        timeOffsetInMinutes -= timeOffset.tm_min;
+        timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
+        
+        if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
+        {
+            serializedValue += "-";
+            timeOffset.tm_hour *= -1;
+            timeOffset.tm_min *= -1;
         }
         else
         {
-            struct tm timeOffset;
-            timeOffset.tm_year = 0;
-            timeOffset.tm_yday = 0;
-            timeOffset.tm_sec = 0;
-            timeOffset.tm_min = timeOffsetInMinutes % 60;
-            timeOffsetInMinutes -= timeOffset.tm_min;
-            timeOffset.tm_hour = (timeOffsetInMinutes % (60 * 24)) / 60;
-            
-            if ( (timeOffset.tm_hour < 0) || (timeOffset.tm_min < 0) )
-            {
-                serializedValue += "-";
-                timeOffset.tm_hour *= -1;
-                timeOffset.tm_min *= -1;
-            }
-            else
-            {
-                serializedValue += "+";
-            }
-            
-            AxisChar * offSetString = new AxisChar[6];
-            sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
+            serializedValue += "+";
+        }
+        
+        AxisChar offSetString[6];
+        sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
             serializedValue += offSetString;
-            delete [] offSetString;
         }
 
         
@@ -202,32 +204,32 @@
       AxisChar *cTemp2;
 
         // Calculate local timezone offset
-        time_t now = time(NULL);
-        struct tm *temp = gmtime(&now);
-        struct tm utcTime;
-        memcpy(&utcTime, temp, sizeof(struct tm));
-        temp = localtime(&now);
-        struct tm localTime;
-        memcpy(&localTime, temp, sizeof(struct tm));
-
-        long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
-            + (utcTime.tm_yday * 60 * 60 * 24)
-            + (utcTime.tm_hour * 60 * 60)
-            + (utcTime.tm_min * 60);
-
-        long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
-            + (localTime.tm_yday * 60 * 60 * 24)
-            + (localTime.tm_hour * 60 * 60)
-            + (localTime.tm_min * 60);
-
-        time_t d = utcTimeInSeconds - localTimeInSeconds;
-
-        /* dismantle m_sValue to get tm value;
-         * XSD_DATETIME format is
-         * CCYY(-)MMZ OR
-         * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
-         */
-        if (sscanf (valueAsChar, "%d", &value.tm_year) != 1)
+    time_t now = time(NULL);
+    struct tm *temp = gmtime(&now);
+    struct tm utcTime;
+    memcpy(&utcTime, temp, sizeof(struct tm));
+    temp = localtime(&now);
+    struct tm localTime;
+    memcpy(&localTime, temp, sizeof(struct tm));
+
+    long utcTimeInSeconds = (utcTime.tm_year * 60 * 60 * 24 * 365)
+        + (utcTime.tm_yday * 60 * 60 * 24)
+        + (utcTime.tm_hour * 60 * 60)
+        + (utcTime.tm_min * 60);
+
+    long localTimeInSeconds = (localTime.tm_year * 60 * 60 * 24 * 365)
+        + (localTime.tm_yday * 60 * 60 * 24)
+        + (localTime.tm_hour * 60 * 60)
+        + (localTime.tm_min * 60);
+
+    time_t d = utcTimeInSeconds - localTimeInSeconds;
+
+    /* dismantle m_sValue to get tm value;
+     * XSD_DATETIME format is
+     * CCYY(-)MMZ OR
+     * CCYY(-)MM+/-<UTC TIME DIFFERENCE>
+     */
+    if (sscanf (valueAsChar, "%d", &value.tm_year) != 1)
         {
          throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
         }
@@ -245,68 +247,68 @@
 #endif
         cTemp2 = const_cast<char*>(strpbrk (valueAsChar, ":"));
 
-        /* if the timezone is represented adding 'Z' at the end */
-        if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
+    /* if the timezone is represented adding 'Z' at the end */
+    if ((cTemp = const_cast<char*>(strpbrk (valueAsChar, "Z"))) != NULL)
+    {
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
         {
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            pTm = localtime (&timeInSecs);
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            t = labs (t - d);
-            pTm = localtime (&t);
-        }
-        else if (cTemp2 != NULL)
-        {
-            cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
-            if (cUtc == NULL)
-            {
-                cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
-            }
-            time_t timeInSecs = mktime (&value);
-            if (timeInSecs == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            
-            int hours = 0;
-            int mins = 0;   
-            if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            
-            int secs = hours * 60 * 60 + mins * 60;
-            if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
-            {
-                timeInSecs -= secs;
-            }
-            else
-            {
-                timeInSecs += secs;
-            }
-            
-            pTm = localtime (&timeInSecs);
-            memcpy (&value, pTm, sizeof (tm));
-            time_t t = mktime (&value);
-            if (t == -1)
-            {
-                throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
-            }
-            t = labs (t - d);
-            pTm = localtime (&t);
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        pTm = localtime (&timeInSecs);
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        t = labs (t - d);
+        pTm = localtime (&t);
+    }
+    else if (cTemp2 != NULL)
+    {
+        cUtc = const_cast<char*>(strrchr (valueAsChar, '+'));
+        if (cUtc == NULL)
+        {
+            cUtc = const_cast<char*>(strrchr (valueAsChar, '-'));
+        }
+        time_t timeInSecs = mktime (&value);
+        if (timeInSecs == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        
+        int hours = 0;
+        int mins = 0;   
+        if (sscanf (cUtc + 1, "%d:%d", &hours, &mins) != 2)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        
+        int secs = hours * 60 * 60 + mins * 60;
+        if ((cTemp = strpbrk ((cUtc), "+")) != NULL)
+        {
+            timeInSecs -= secs;
         }
-        /*if the zone is not represented in the date */
         else
         {
-            /*else it is assumed that the sent time is localtime */
+            timeInSecs += secs;
+        }
+        
+        pTm = localtime (&timeInSecs);
+        memcpy (&value, pTm, sizeof (tm));
+        time_t t = mktime (&value);
+        if (t == -1)
+        {
+            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR);
+        }
+        t = labs (t - d);
+        pTm = localtime (&t);
+    }
+    /*if the zone is not represented in the date */
+    else
+    {
+        /*else it is assumed that the sent time is localtime */
             time_t timeInSecs = mktime (&value);
             if (timeInSecs == -1)
             {

Modified: webservices/axis/trunk/c/src/soap/xsd/GYearMonth.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/GYearMonth.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/GYearMonth.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/GYearMonth.cpp Wed Nov 22 02:11:36 2006
@@ -67,6 +67,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete minInclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -86,6 +87,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete minExclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -105,6 +107,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete maxInclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -124,6 +127,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete maxExclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -131,10 +135,9 @@
         delete maxExclusive;
         
         AxisString serializedValue = "";
-        AxisChar* valueAsString = new AxisChar[80];
+        AxisChar valueAsString[80];
         strftime (valueAsString, 80, "%Y-%m", value);
         serializedValue += valueAsString;
-        delete [] valueAsString;
 
         // Calculate local timezone offset
         time_t now = time(NULL);
@@ -182,10 +185,9 @@
                 serializedValue += "+";
             }
             
-            AxisChar * offSetString = new AxisChar[6];
+            AxisChar offSetString[6];
             sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
             serializedValue += offSetString;
-            delete [] offSetString;
         }
 
         

Modified: webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp Wed Nov 22 02:11:36 2006
@@ -65,15 +65,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-                AxisChar* length = new AxisChar[10];
+                AxisChar length[100];
                 sprintf(length, "%d", minLength->getMinLength());
                 exceptionMessage += length;
                 exceptionMessage += ", Length of value = ";
                 sprintf(length, "%d", value->getSize());
                 exceptionMessage += length;
                 exceptionMessage += ".";
-                delete [] length;
                 
+                delete minLength;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -87,15 +87,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-                AxisChar* length = new AxisChar[10];
+                AxisChar length[100];
                 sprintf(length, "%d", maxLength->getMaxLength());
                 exceptionMessage += length;
                 exceptionMessage += ", Length of value = ";
                 sprintf(length, "%d", value->getSize());
                 exceptionMessage += length;
                 exceptionMessage += ".";
-                delete [] length;
                 
+                delete maxLength;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -109,15 +109,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-                AxisChar* lengthAsString = new AxisChar[10];
+                AxisChar lengthAsString[100];
                 sprintf(lengthAsString, "%d", length->getLength());
                 exceptionMessage += lengthAsString;
                 exceptionMessage += ", Length of value = ";
                 sprintf(lengthAsString, "%d", value->getSize());
                 exceptionMessage += lengthAsString;
                 exceptionMessage += ".";
-                delete [] lengthAsString;
                 
+                delete length;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }

Modified: webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp Wed Nov 22 02:11:36 2006
@@ -23,11 +23,7 @@
 
 IAnySimpleType::~IAnySimpleType()
 {
-    if (m_Buf)
-    {
-        delete [] m_Buf;
-        m_Buf = NULL;
-    }
+    delete [] m_Buf;
 }
 
 bool IAnySimpleType::isNil()
@@ -47,11 +43,8 @@
 
 void IAnySimpleType::deserialize(const AxisChar* value)
 {
-    if (m_Buf)
-    {
-        delete [] m_Buf;
-        m_Buf = NULL;
-    }
+    delete [] m_Buf;
+    m_Buf = NULL;
  
     if (value)
     {
@@ -84,11 +77,9 @@
     }
     delete enumeration;
 
-    if (m_Buf)
-    {
-        delete [] m_Buf;
-        m_Buf = NULL;
-    } 
+    delete [] m_Buf;
+    m_Buf = NULL;
+
     m_Buf = new char[strlen (serializedValue) + 1];
     strcpy (m_Buf, serializedValue);
     delete whiteSpace;

Modified: webservices/axis/trunk/c/src/soap/xsd/Int.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Int.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Int.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Int.cpp Wed Nov 22 02:11:36 2006
@@ -68,10 +68,8 @@
  
     xsd__int * value = new xsd__int;
     *value = static_cast<xsd__int> (*returnValue);
- // cb 07/07/05 : delete here is inconsistent with other data types
- // (which don't do it here), but maybe a good idea   
- // Samisa: we got to delete returnValue here, else there will be a memory leak :-(
-    delete returnValue; // Samisa - need to clean this memory
+
+    delete returnValue;
     return value;
 }
 

Modified: webservices/axis/trunk/c/src/soap/xsd/Integer.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Integer.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Integer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Integer.cpp Wed Nov 22 02:11:36 2006
@@ -65,15 +65,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minInclusive->getMinInclusiveAsLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -87,15 +87,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, minExclusive->getMinExclusiveAsLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -109,15 +109,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is greater than MaxInclusive specified for this type.  MaxInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -131,15 +131,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is greater than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -153,10 +153,9 @@
     if (totalDigits->isSet())
     {
         valueSize = totalDigits->getTotalDigits() + 1;
-        AxisChar* digits = new char[10];
+        AxisChar digits[10];
         AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
         formatSpecifier += digits;
-        delete [] digits;
     }
     delete totalDigits;
     

Modified: webservices/axis/trunk/c/src/soap/xsd/Long.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Long.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Long.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Long.cpp Wed Nov 22 02:11:36 2006
@@ -70,7 +70,7 @@
  
     xsd__long * value = new xsd__long;
     *value = static_cast<xsd__long> (*returnValue);
-    delete returnValue; // Samisa - need to clean this memory
+    delete returnValue; 
     return value;
 }
 

Modified: webservices/axis/trunk/c/src/soap/xsd/NOTATION.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/NOTATION.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/NOTATION.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/NOTATION.cpp Wed Nov 22 02:11:36 2006
@@ -61,15 +61,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-            AxisChar* length = new AxisChar[10];
+            AxisChar length[100];
             sprintf(length, "%d", minLength->getMinLength());
             exceptionMessage += length;
             exceptionMessage += ", Length of value = ";
             sprintf(length, "%d", strlen(value));
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minLength;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -83,15 +83,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-            AxisChar* length = new AxisChar[10];
+            AxisChar length[100];
             sprintf(length, "%d", maxLength->getMaxLength());
             exceptionMessage += length;
             exceptionMessage += ", Length of value = ";
             sprintf(length, "%d", strlen(value));
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxLength;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -105,15 +105,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-            AxisChar* lengthAsString = new AxisChar[10];
+            AxisChar lengthAsString[100];
             sprintf(lengthAsString, "%d", length->getLength());
             exceptionMessage += lengthAsString;
             exceptionMessage += ", Length of value = ";
             sprintf(lengthAsString, "%d", strlen(value));
             exceptionMessage += lengthAsString;
             exceptionMessage += ".";
-            delete [] lengthAsString;
             
+            delete length;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }

Modified: webservices/axis/trunk/c/src/soap/xsd/NonNegativeInteger.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/NonNegativeInteger.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/NonNegativeInteger.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/NonNegativeInteger.cpp Wed Nov 22 02:11:36 2006
@@ -67,15 +67,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than MinInclusive specified for this type.  MinInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, minInclusive->getMinInclusiveAsUnsignedLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -89,15 +89,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than or equal to MinExclusive specified for this type.  MinExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, minExclusive->getMinExclusiveAsUnsignedLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -111,15 +111,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than MaxInclusive specified for this type.  MaxInclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, maxInclusive->getMaxInclusiveAsUnsignedLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxInclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -133,15 +133,15 @@
         {
             AxisString exceptionMessage =
             "Value to be serialized is less than or equal to MaxExclusive specified for this type.  MaxExclusive = ";
-            AxisChar* length = new AxisChar[25];
+            AxisChar length[100];
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, maxExclusive->getMaxExclusiveAsUnsignedLONGLONG());
             exceptionMessage += length;
             exceptionMessage += ", Value = ";
             sprintf(length, PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER, *value);
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxExclusive;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -155,10 +155,9 @@
     if (totalDigits->isSet())
     {
         valueSize = totalDigits->getTotalDigits() + 1;
-        AxisChar* digits = new char[10];
+        AxisChar digits[10];
         AxisSprintf (digits, 10, "%i", totalDigits->getTotalDigits());
         formatSpecifier += digits;
-        delete [] digits;
     }
     delete totalDigits;
     

Modified: webservices/axis/trunk/c/src/soap/xsd/Short.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Short.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Short.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Short.cpp Wed Nov 22 02:11:36 2006
@@ -68,7 +68,7 @@
  
     xsd__short * value = new xsd__short;
     *value = static_cast<xsd__short> (*returnValue);
-    delete returnValue; // Samissa - need to clean this memory
+    delete returnValue; 
     return value;
 }
 

Modified: webservices/axis/trunk/c/src/soap/xsd/String.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/String.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/String.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/String.cpp Wed Nov 22 02:11:36 2006
@@ -61,15 +61,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-            AxisChar* length = new AxisChar[10];
+            AxisChar length[100];
             sprintf(length, "%d", minLength->getMinLength());
             exceptionMessage += length;
             exceptionMessage += ", Length of value = ";
             sprintf(length, "%d", strlen(value));
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete minLength;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -83,15 +83,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-            AxisChar* length = new AxisChar[10];
+            AxisChar length[100];
             sprintf(length, "%d", maxLength->getMaxLength());
             exceptionMessage += length;
             exceptionMessage += ", Length of value = ";
             sprintf(length, "%d", strlen(value));
             exceptionMessage += length;
             exceptionMessage += ".";
-            delete [] length;
             
+            delete maxLength;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }
@@ -105,15 +105,15 @@
         {
             AxisString exceptionMessage =
             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-            AxisChar* lengthAsString = new AxisChar[10];
+            AxisChar lengthAsString[100];
             sprintf(lengthAsString, "%d", length->getLength());
             exceptionMessage += lengthAsString;
             exceptionMessage += ", Length of value = ";
             sprintf(lengthAsString, "%d", strlen(value));
             exceptionMessage += lengthAsString;
             exceptionMessage += ".";
-            delete [] lengthAsString;
             
+            delete length;
             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                 const_cast<AxisChar*>(exceptionMessage.c_str()));
         }

Modified: webservices/axis/trunk/c/src/soap/xsd/Time.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/Time.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Time.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Time.cpp Wed Nov 22 02:11:36 2006
@@ -67,6 +67,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete minInclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -86,6 +87,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete minExclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -105,6 +107,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete maxInclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -124,6 +127,7 @@
                 exceptionMessage += asctime(value);
                 exceptionMessage += ".";
                 
+                delete maxExclusive;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -131,10 +135,9 @@
         delete maxExclusive;
      
         AxisString serializedValue = "";
-        AxisChar* valueAsString = new AxisChar[80];
+        AxisChar valueAsString[80];
         strftime (valueAsString, 80, "%H:%M:%S", value);
         serializedValue += valueAsString;
-        delete [] valueAsString;
 
         // Calculate local timezone offset
         time_t now = time(NULL);
@@ -182,10 +185,9 @@
                 serializedValue += "+";
             }
             
-            AxisChar * offSetString = new AxisChar[6];
+            AxisChar offSetString[6];
             sprintf(offSetString, "%02i:%02i", timeOffset.tm_hour, timeOffset.tm_min);
             serializedValue += offSetString;
-            delete [] offSetString;
         }
 
         

Modified: webservices/axis/trunk/c/src/soap/xsd/XSD_QName.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/XSD_QName.cpp?view=diff&rev=478106&r1=478105&r2=478106
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/XSD_QName.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/XSD_QName.cpp Wed Nov 22 02:11:36 2006
@@ -61,15 +61,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is shorter than MinLength specified for this type.  Minlength = ";
-                AxisChar* length = new AxisChar[10];
+                AxisChar length[100];
                 sprintf(length, "%d", minLength->getMinLength());
                 exceptionMessage += length;
                 exceptionMessage += ", Length of value = ";
                 sprintf(length, "%d", strlen(value));
                 exceptionMessage += length;
                 exceptionMessage += ".";
-                delete [] length;
                 
+                delete minLength;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -83,15 +83,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is longer than MaxLength specified for this type.  Maxlength = ";
-                AxisChar* length = new AxisChar[10];
+                AxisChar length[100];
                 sprintf(length, "%d", maxLength->getMaxLength());
                 exceptionMessage += length;
                 exceptionMessage += ", Length of value = ";
                 sprintf(length, "%d", strlen(value));
                 exceptionMessage += length;
                 exceptionMessage += ".";
-                delete [] length;
                 
+                delete maxLength;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }
@@ -105,15 +105,15 @@
             {
                 AxisString exceptionMessage =
                 "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
-                AxisChar* lengthAsString = new AxisChar[10];
+                AxisChar lengthAsString[100];
                 sprintf(lengthAsString, "%d", length->getLength());
                 exceptionMessage += lengthAsString;
                 exceptionMessage += ", Length of value = ";
                 sprintf(lengthAsString, "%d", strlen(value));
                 exceptionMessage += lengthAsString;
                 exceptionMessage += ".";
-                delete [] lengthAsString;
                 
+                delete length;
                 throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                     const_cast<AxisChar*>(exceptionMessage.c_str()));
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org