Hi! Just wanted to say that the sqlite3Atoi64() function doesn't seem to work
properly when zNum = "0", because the while( zNum[0]=='0' ){ zNum++; } skips
it, leading to an empty string and i == 0. Then, the test "if( c!=0 || i==0 ||
i>19 )" always return 0 (false), meaning that the conversion did not succeed...
Is that the intended behaviour?
Bye,
Aladdin
SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum){
i64 v = 0;
int neg;
int i, c;
while( isspace(*(u8*)zNum) ) zNum++;
if( *zNum=='-' ){
neg = 1;
zNum++;
}else if( *zNum=='+' ){
neg = 0;
zNum++;
}else{
neg = 0;
}
while( zNum[0]=='0' ){ zNum++; } /* Skip over leading zeros. Ticket #2454 */
for(i=0; (c=zNum[i])>='0' && c<='9'; i++){
v = v*10 + c - '0';
}
*pNum = neg ? -v : v;
if( c!=0 || i==0 || i>19 ){
/* zNum is empty or contains non-numeric text or is longer
** than 19 digits (thus guaranting that it is too large) */
return 0;
}else if( i
_________________________________________________________________
Retouchez, classez et partagez vos photos gratuitement avec le logiciel Galerie
de Photos !
http://www.windowslive.fr/galerie/
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users