Hi Mikko Kurunsaari,
We have observed the bug in the c code, please have a look.
From file "helpers.c" as per below function, for negative value loop will be never get executed because you haven't converted "long long val" to a positive number before the loop.
So, It will work only for positive int64 but we can't find out the length of the negative number
I think the perfect place for this "val = value" assignment is just one line before the while loop.
May be same issue present with......hlp_intToString(char *str, int bufsize......
int hlp_int64ToString(char* str, int bufsize, long long value, unsigned char isSigned)
{
int cnt = 0;
long long val = value;
if (isSigned && value < 0)
{
if (bufsize < 1)
{
return -1;
}
*str = '-';
++str;
--bufsize;
value = -value;
++cnt;
}
//Find length.
while ((val = (val / 10)) > 0) //Never executed for nagetive number
{
++str;
}
*(str + 1) = '\0';
do
{
if (bufsize < 1)
{
return -1;
}
*str = (value % 10) + '0';
--str;
value /= 10;
--bufsize;
++cnt;
} while (value != 0);
return cnt;
}
________________________________________
Ashvin