summaryrefslogtreecommitdiff
path: root/maximus/functioncall/src/FunctionSciMsg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'maximus/functioncall/src/FunctionSciMsg.cpp')
-rw-r--r--maximus/functioncall/src/FunctionSciMsg.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/maximus/functioncall/src/FunctionSciMsg.cpp b/maximus/functioncall/src/FunctionSciMsg.cpp
index d92f68a249..51d21df4f2 100644
--- a/maximus/functioncall/src/FunctionSciMsg.cpp
+++ b/maximus/functioncall/src/FunctionSciMsg.cpp
@@ -297,7 +297,7 @@ bool FunctionSciMsg::addParameter ( const FunctionCallParameter & function_argum
// Called by user when a message is received to retrieve function parameters
//
-bool FunctionSciMsg::bindParameter ( const string name_of_parameter_to_get, unsigned long & data_length, void * & p_data ) const
+bool FunctionSciMsg::bindParameter ( const string name_of_parameter_to_get, unsigned long & data_length, unsigned char * & p_data ) const
{
clog << "FunctionSciMsg::bindParameter" << endl;
bool bBindParameter = false;
@@ -311,26 +311,20 @@ bool FunctionSciMsg::bindParameter ( const string name_of_parameter_to_get, unsi
if ( !tempParameter.getName().compare(name_of_parameter_to_get) )
{
data_length = tempParameter.getValueLength();
- if (NULL != p_data)
+ p_data = new unsigned char [data_length+1]; // to be deleted by user
+ if ( (NULL != tempParameter.getValue()) && (NULL != p_data) )
{
- if (NULL != tempParameter.getValue())
+ for (unsigned int j=0; j<data_length; j++)
{
- p_data = tempParameter.getValue();
- }
- else
- {
- p_data = NULL;
+ *(p_data+j) = *(tempParameter.getValue()+j);
}
+ p_data[data_length] = '\0';
clog << "\tbind parameter = ";
tempParameter.displayParameter();
clog << endl;
i = mListOfParameters.size()-1;
bBindParameter = true;
}
- else
- {
- throw Error("FunctionSciMsg::bindParameter", "Allocated data pointer is NULL");
- }
}
}