You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2005/11/09 17:05:11 UTC

svn commit: r332072 - in /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp: CommonClientTestCode.hpp XSD_hexBinaryClient.cpp

Author: prestonf
Date: Wed Nov  9 08:05:05 2005
New Revision: 332072

URL: http://svn.apache.org/viewcvs?rev=332072&view=rev
Log:
Fix for UT_XSD_hexBinary test.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp?rev=332072&r1=332071&r2=332072&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/CommonClientTestCode.hpp Wed Nov  9 08:05:05 2005
@@ -116,10 +116,46 @@
    return string;
 }
 
+char * asciiToStringOfLength( char * pString, int iLength)
+{
+   char *	pch = pString;
+
+   if( pString == NULL)
+   {
+	   return NULL;
+   }
+ 
+   /* while not EOL... */
+   int iCount = 0;
+
+   while( *pch != '\0' && iCount < iLength)
+   {
+         *pch = ASCIItoEBCDIC[*pch];
+         pch++;
+		 iCount++;
+   }
+
+   *pch = '\0';
+
+   return pString;
+}
+
 #else
 
 #define asciiToString( x ) ( x )
 #define stringToAscii( x ) ( x )
+
+char * asciiToStringOfLength( char * pString, int iLength)
+{
+   if( pString == NULL)
+   {
+	   return NULL;
+   }
+ 
+   pString[iLength] = '\0';
+
+   return pString;
+}
 
 #endif
 

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp?rev=332072&r1=332071&r2=332072&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp Wed Nov  9 08:05:05 2005
@@ -45,7 +45,7 @@
         xsd__hexBinary result = ws->asNonNillableElement(input);
         cout << "non-nillable element" << endl;
         cout << " size=" << result.__size << endl;
-        cout << " data=" << asciiToString((char *)result.__ptr) << endl;
+        cout << " data=" << asciiToStringOfLength((char *)result.__ptr, result.__size) << endl;
 
         // Test nillable element, with a value
         xsd__hexBinary* nillableInput = new xsd__hexBinary();
@@ -55,7 +55,7 @@
         {
             cout << "nillable element" << endl;
             cout << " size=" << nillableResult->__size << endl;
-            cout << " data=" << asciiToString((char *)nillableResult->__ptr) << endl;
+            cout << " data=" << asciiToStringOfLength((char *)nillableResult->__ptr, nillableResult->__size) << endl;
             delete nillableResult;
         }
         else
@@ -70,7 +70,7 @@
         {
             cout << "nillable element" << endl;
             cout << " size=" << nillableResult->__size << endl;
-            cout << " data=" << asciiToString((char *)nillableResult->__ptr) << endl;
+            cout << " data=" << asciiToStringOfLength((char *)nillableResult->__ptr, nillableResult->__size) << endl;
             delete nillableResult;
         }
         else
@@ -84,7 +84,7 @@
         RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
         cout << "required attribute" << endl;
         cout << " size=" << requiredAttributeResult->getrequiredAttribute().__size << endl;
-        cout << " data=" << asciiToString((char *)requiredAttributeResult->getrequiredAttribute().__ptr) << endl;
+        cout << " data=" << asciiToStringOfLength((char *)requiredAttributeResult->getrequiredAttribute().__ptr, requiredAttributeResult->getrequiredAttribute().__size) << endl;
         delete requiredAttributeResult;
 
 /* Optional Attributes currently unsupported by WSDL2Ws
@@ -97,7 +97,7 @@
         {
             cout << "optional attribute, with data" << endl;
             cout << " size=" << optionalAttributeResult->getoptionalAttribute()->__size << endl;
-            cout << " data=" << asciiToString((char *)optionalAttributeResult->getoptionalAttribute()->__ptr) << endl;
+            cout << " data=" << asciiToStringOfLength((char *)optionalAttributeResult->getoptionalAttribute()->__ptr, optionalAttributeResult->getoptionalAttribute()->__size) << endl;
         }
         else
         {
@@ -138,7 +138,7 @@
         {
             cout << " element[" << index << "]" << endl;
             cout << "  size=" << output[index]->__size << endl;
-            cout << "  data=" << asciiToString((char *)output[index]->__ptr) << endl;
+            cout << "  data=" << asciiToStringOfLength((char *)output[index]->__ptr, output[index]->__size) << endl;
             
         }
         // Clear up input array        
@@ -155,7 +155,7 @@
         SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
         cout << "within complex type" << endl;
         cout << " size=" << complexTypeResult->getcomplexTypeElement().__size << endl;
-        cout << " data=" << asciiToString((char *)complexTypeResult->getcomplexTypeElement().__ptr) << endl;
+        cout << " data=" << asciiToStringOfLength((char *)complexTypeResult->getcomplexTypeElement().__ptr, complexTypeResult->getcomplexTypeElement().__size) << endl;
         delete complexTypeResult;
 
         // Tests now complete