mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Continuing work toward supporting unsigned 32-bit page numbers.
FossilOrigin-Name: 9ce1710aad43cebe5ad50859c7685fb83e40cdd4a60913bd2b7e659bc59942fd
This commit is contained in:
18
src/util.c
18
src/util.c
@@ -863,6 +863,24 @@ int sqlite3Atoi(const char *z){
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
** Try to convert z into an unsigned 32-bit integer. Return true on
|
||||
** success and false if there is an error.
|
||||
**
|
||||
** Only decimal notation is accepted.
|
||||
*/
|
||||
int sqlite3GetUInt32(const char *z, u32 *pI){
|
||||
u64 v = 0;
|
||||
int i;
|
||||
for(i=0; sqlite3Isdigit(z[i]); i++){
|
||||
v = v*10 + z[i] - '0';
|
||||
if( v>4294967296LL ) return 0;
|
||||
}
|
||||
if( i==0 || z[i]!=0 ) return 0;
|
||||
*pI = (u32)v;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** The variable-length integer encoding is as follows:
|
||||
**
|
||||
|
||||
Reference in New Issue
Block a user