Question

I am using xmlrpc-c 1.33.9 , compiled with libc++ and c++11 on OSX Mavericks.

std::vector<xmlrpc_c::value> parameters;

parameters.push_back(ValueInt(x));
parameters.push_back(ValueInt(y));

int paramsize = parameters.size();

xmlrpc_c::paramList params;
for(int i; i < paramsize; i++){
    params.addc(parameters.at(i));
    //verifyEnd will throw an error without the following line
    std::cout << parameters.at(i).type() << std::endl;
}

params.verifyEnd(paramsize);

When moving xmlrpc_c::value_int's from my parameters vector into xmlrpc_c::paramList, the values don't appear to actually end up there unless I do the following within my for loop:

std::cout << parameters.at(i).type() << std::endl;

Which is also why I'm doing

int paramsize = parameters.size();

Because I get similar errors with other xmlrpc_c::value_type's without it. Without these "workarounds", verifyEnd(paramsize) will throw errors and the paramList object ends up empty.

What is the proper way to construct xmlrpc_c::paramList objects? I gather that either I've encountered a bug in xmlrpc-c, or I'm copying these values around the wrong way.

I should point out that when I used the version of xmlrpc-c that comes with Homebrew on Mavericks (1.33.0), and don't use "-std=c++11 -stdlib=libc++" to compile my project, everything works without the need for these weird "workarounds".

Was it helpful?

Solution

The problem was here

for(int i; i < paramsize; i++)

"i" needed to be initialized (Doh!)

for(int i=0; i < paramsize; i++) ...

Throws no errors now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top