diff options
author | 2015-09-12 02:08:34 +0000 | |
---|---|---|
committer | 2015-09-12 02:08:34 +0000 | |
commit | 9002a9ec67ed1654a017252f6e4bc93deef91d2a (patch) | |
tree | 775f5d1fe0cf77f56c7617f4e867764206a537c7 /lib/libsqlite3/src/util.c | |
parent | add missing functions to NAME; (diff) | |
download | wireguard-openbsd-9002a9ec67ed1654a017252f6e4bc93deef91d2a.tar.xz wireguard-openbsd-9002a9ec67ed1654a017252f6e4bc93deef91d2a.zip |
Update sqlite3 to 3.8.11.1. Bump major, regen .pc and header. Changes
available here: http://sqlite.org/changes.html
Tested in bulk by aja@. ok landry@ "Please crank sqlite when you get
this mail." deraadt@
Diffstat (limited to 'lib/libsqlite3/src/util.c')
-rw-r--r-- | lib/libsqlite3/src/util.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/libsqlite3/src/util.c b/lib/libsqlite3/src/util.c index 6e64242e876..091481d9216 100644 --- a/lib/libsqlite3/src/util.c +++ b/lib/libsqlite3/src/util.c @@ -105,10 +105,8 @@ int sqlite3IsNaN(double x){ ** than 1GiB) the value returned might be less than the true string length. */ int sqlite3Strlen30(const char *z){ - const char *z2 = z; if( z==0 ) return 0; - while( *z2 ){ z2++; } - return 0x3fffffff & (int)(z2 - z); + return 0x3fffffff & (int)strlen(z); } /* @@ -655,6 +653,7 @@ int sqlite3GetInt32(const char *zNum, int *pValue){ } } #endif + while( zNum[0]=='0' ) zNum++; for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){ v = v*10 + c; } @@ -1079,14 +1078,38 @@ int sqlite3VarintLen(u64 v){ ** Read or write a four-byte big-endian integer value. */ u32 sqlite3Get4byte(const u8 *p){ +#if SQLITE_BYTEORDER==4321 + u32 x; + memcpy(&x,p,4); + return x; +#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) && GCC_VERSION>=4003000 + u32 x; + memcpy(&x,p,4); + return __builtin_bswap32(x); +#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300 + u32 x; + memcpy(&x,p,4); + return _byteswap_ulong(x); +#else testcase( p[0]&0x80 ); return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3]; +#endif } void sqlite3Put4byte(unsigned char *p, u32 v){ +#if SQLITE_BYTEORDER==4321 + memcpy(p,&v,4); +#elif SQLITE_BYTEORDER==1234 && defined(__GNUC__) && GCC_VERSION>=4003000 + u32 x = __builtin_bswap32(v); + memcpy(p,&x,4); +#elif SQLITE_BYTEORDER==1234 && defined(_MSC_VER) && _MSC_VER>=1300 + u32 x = _byteswap_ulong(v); + memcpy(p,&x,4); +#else p[0] = (u8)(v>>24); p[1] = (u8)(v>>16); p[2] = (u8)(v>>8); p[3] = (u8)v; +#endif } |