axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <>
Subject returning array of string from service
Date Wed, 02 Jun 2004 00:33:17 GMT
i have a simple service implemented in Axis-C++ that take as input array 
length and returns new arrray of strings.

is it the right way to do it so there is no memory leaks (i looked on 
InteropBaseClient.cpp ti see how string arrays are created).

xsd__string_Array Benchmark1PortType::sendStrings(int length)
   xsd__string_Array arr;
   arr.m_Size = length;
   arr.m_Array = new char*[length];
   for (int i=0; i < length; i++) {
       arr.m_Array[i] = strdup("hello str::Alek");
   return arr;

i would like to see how server side AXIS-C++ works in longer run 
(especially memory handling) so i would like to get this right ...



BTW: maybe it would be good idea to have consistent naming for example 
xsd__base64Binary::__size and xsd__string_Array::m_Size - shouldnt both 
use m_Size? that makes this method asymmetrical to all other methods 
handling arrays:

xsd__base64Binary Benchmark1PortType::sendBase64(int length)
    xsd__base64Binary arr;
    arr.__size = length;
    arr.__ptr = new xsd__unsignedByte[length];
    for (int i=0; i < length; i++) {
        arr.__ptr[i] = (xsd__unsignedByte)i;
    return arr;

The best way to predict the future is to invent it - Alan Kay

View raw message