You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "zengxianrui- (JIRA)" <ji...@apache.org> on 2010/12/01 03:26:11 UTC
[jira] Created: (AXIS2C-1508) function axutil_strtol in
util/src/types.c can't convert negative number from string.('-32134556'
will be converted to 0)
function axutil_strtol in util/src/types.c can't convert negative number from string.('-32134556' will be converted to 0)
-------------------------------------------------------------------------------------------------------------------------
Key: AXIS2C-1508
URL: https://issues.apache.org/jira/browse/AXIS2C-1508
Project: Axis2-C
Issue Type: Bug
Components: util
Affects Versions: 1.6.0
Environment: all envireonments
Reporter: zengxianrui-
you will know this problem when you look at this function, if input parameter s is '-1234567', the first char is '-', the for loop will breaks, the this function return 0 to you.
the function is :
AXIS2_EXTERN int64_t AXIS2_CALL
axutil_strtol(
const char *s,
char **endptr,
int base)
{
int i;
int64_t n;
n = 0;
for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
{
n = 10 * n + (s[i] - '0');
}
if(endptr != NULL)
{
*endptr = (char *)(s + i);
}
return n;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: c-dev-help@axis.apache.org
[jira] [Commented] (AXIS2C-1508) function axutil_strtol in
util/src/types.c can't convert negative number from string.('-32134556'
will be converted to 0)
Posted by "Kevin H (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AXIS2C-1508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051412#comment-13051412 ]
Kevin H commented on AXIS2C-1508:
---------------------------------
Hi ran into this issue also when parsing a negative int64. I dont know why the axutil lib does not use standard C lib but here is a fix that i implemented for my project:
#include <stdlib.h>
AXIS2_EXTERN int64_t AXIS2_CALL
axutil_strtol(
const char *s,
char **endptr,
int base)
{
int64_t n;
n = 0;
n = strtoll( s, endptr, base );
return n;
}
> function axutil_strtol in util/src/types.c can't convert negative number from string.('-32134556' will be converted to 0)
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: AXIS2C-1508
> URL: https://issues.apache.org/jira/browse/AXIS2C-1508
> Project: Axis2-C
> Issue Type: Bug
> Components: util
> Affects Versions: 1.6.0
> Environment: all envireonments
> Reporter: zengxianrui-
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> you will know this problem when you look at this function, if input parameter s is '-1234567', then first char is '-', the for loop will breaks, the this function return 0 to you.
> the function is :
> AXIS2_EXTERN int64_t AXIS2_CALL
> axutil_strtol(
> const char *s,
> char **endptr,
> int base)
> {
> int i;
> int64_t n;
> n = 0;
> for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
> {
> n = 10 * n + (s[i] - '0');
> }
> if(endptr != NULL)
> {
> *endptr = (char *)(s + i);
> }
> return n;
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: c-dev-help@axis.apache.org
[jira] Updated: (AXIS2C-1508) function axutil_strtol in
util/src/types.c can't convert negative number from string.('-32134556'
will be converted to 0)
Posted by "zengxianrui- (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AXIS2C-1508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zengxianrui- updated AXIS2C-1508:
----------------------------------
Description:
you will know this problem when you look at this function, if input parameter s is '-1234567', then first char is '-', the for loop will breaks, the this function return 0 to you.
the function is :
AXIS2_EXTERN int64_t AXIS2_CALL
axutil_strtol(
const char *s,
char **endptr,
int base)
{
int i;
int64_t n;
n = 0;
for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
{
n = 10 * n + (s[i] - '0');
}
if(endptr != NULL)
{
*endptr = (char *)(s + i);
}
return n;
}
was:
you will know this problem when you look at this function, if input parameter s is '-1234567', the first char is '-', the for loop will breaks, the this function return 0 to you.
the function is :
AXIS2_EXTERN int64_t AXIS2_CALL
axutil_strtol(
const char *s,
char **endptr,
int base)
{
int i;
int64_t n;
n = 0;
for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
{
n = 10 * n + (s[i] - '0');
}
if(endptr != NULL)
{
*endptr = (char *)(s + i);
}
return n;
}
> function axutil_strtol in util/src/types.c can't convert negative number from string.('-32134556' will be converted to 0)
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: AXIS2C-1508
> URL: https://issues.apache.org/jira/browse/AXIS2C-1508
> Project: Axis2-C
> Issue Type: Bug
> Components: util
> Affects Versions: 1.6.0
> Environment: all envireonments
> Reporter: zengxianrui-
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> you will know this problem when you look at this function, if input parameter s is '-1234567', then first char is '-', the for loop will breaks, the this function return 0 to you.
> the function is :
> AXIS2_EXTERN int64_t AXIS2_CALL
> axutil_strtol(
> const char *s,
> char **endptr,
> int base)
> {
> int i;
> int64_t n;
> n = 0;
> for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
> {
> n = 10 * n + (s[i] - '0');
> }
> if(endptr != NULL)
> {
> *endptr = (char *)(s + i);
> }
> return n;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: c-dev-help@axis.apache.org