Damitha, Where is it allocated? str_line is not dynamic. It is a pointer to a character array that is not allocated. So I am confused...am I missing something? Should we be doing a memcpy from str_line to svr_conn->buffer?
Nadir Amra Integrated Web Services for IBM i Operating System Internet: [email protected] Damitha Kumarage <[email protected]> wrote on 05/20/2010 11:04:30 PM: > [image removed] > > Re: Porting problems > > Damitha Kumarage > > to: > > Apache AXIS C Developers List > > 05/20/2010 11:05 PM > > Please respond to "Apache AXIS C Developers List" > > Nadir Amra wrote: > > While porting to IBM i (aka OS/400), found the following problem which I > > want to verify with developers since I really do not understand how this > > works... > > > > In file src\core\transport\tcp\receiver\simple_tcp_svr_conn.c, there is > > the routine at the bottom. > > > > My compile fails due to the line > > > > if(str_line > 0) > > > I think this shoud be corrected to if(str_line[0] > 0) > > which I do not understand. Can anyone explain? The other thing I > > question about this routine is the returning of a buffer that basically > > declared in automatic storage. See statement: > > > > svr_conn->buffer = str_line; > > > Since the content passed to svr_conn->buffer is allocated it wont' be a > problem here. > > Thanks, > Damitha > > ==================== > > > > AXIS2_EXTERN axis2_char_t *AXIS2_CALL > > axis2_simple_tcp_svr_conn_read_request( > > axis2_simple_tcp_svr_conn_t * svr_conn, > > const axutil_env_t * env) > > { > > int size = 32000; > > axis2_char_t str_line[32000]; > > axis2_char_t tmp_buf[32000]; > > int read = -1; > > > > AXIS2_ENV_CHECK(env, NULL); > > > > memset(str_line, 0, size); > > while((read = axutil_stream_peek_socket(svr_conn->stream, env, > > tmp_buf, size - 1)) > 0) > > { > > tmp_buf[read] = '\0'; > > if(read > 0) > > { > > read = axutil_stream_read(svr_conn->stream, env, tmp_buf, size > > - 1); > > if(read > 0) > > { > > tmp_buf[read] = '\0'; > > strcat(str_line, tmp_buf); > > break; > > } > > else > > { > > break; > > } > > } > > } > > if(str_line > 0) > > { > > svr_conn->buffer = str_line; > > } > > return svr_conn->buffer; > > } > > > > > > > > > > Nadir Amra > > Integrated Web Services for IBM i Operating System > > Internet: [email protected] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > > > -- > __________________________________________________________________ > > Damitha Kumarage > Technical Lead; WSO2 Inc. > "Oxygenating the Web Service Platform; " http://www.wso2.com/ > > blog: " http://damithakumarage.wordpress.com/ > __________________________________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
