Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 9b8acf8319ec760713773407a4d5a33dea8d75e8 |
|---|---|
| Date: | 2009-02-23 14:42:53 |
| User: | danielk1977 |
| Comment: | Ensure the return value of sqlite3_errmsg16() is aligned on a 2-byte boundary. Ticket #3665. (CVS 6313) |
Tags And Properties
- branch=trunk inherited from [704b122e53]
- sym-trunk inherited from [704b122e53]
Changes
Changes to src/main.c
10 ** 10 ** 11 ************************************************************************* 11 ************************************************************************* 12 ** Main file for the SQLite library. The routines in this file 12 ** Main file for the SQLite library. The routines in this file 13 ** implement the programmer interface to the library. Routines in 13 ** implement the programmer interface to the library. Routines in 14 ** other files are for internal use by SQLite and should not be 14 ** other files are for internal use by SQLite and should not be 15 ** accessed by users of the library. 15 ** accessed by users of the library. 16 ** 16 ** 17 ** $Id: main.c,v 1.528 2009/02/05 16:31:46 drh Exp $ | 17 ** $Id: main.c,v 1.529 2009/02/23 14:42:53 danielk1977 Exp $ 18 */ 18 */ 19 #include "sqliteInt.h" 19 #include "sqliteInt.h" 20 20 21 #ifdef SQLITE_ENABLE_FTS3 21 #ifdef SQLITE_ENABLE_FTS3 22 # include "fts3.h" 22 # include "fts3.h" 23 #endif 23 #endif 24 #ifdef SQLITE_ENABLE_RTREE 24 #ifdef SQLITE_ENABLE_RTREE ................................................................................................................................................................................ 1254 1254 1255 #ifndef SQLITE_OMIT_UTF16 1255 #ifndef SQLITE_OMIT_UTF16 1256 /* 1256 /* 1257 ** Return UTF-16 encoded English language explanation of the most recent 1257 ** Return UTF-16 encoded English language explanation of the most recent 1258 ** error. 1258 ** error. 1259 */ 1259 */ 1260 const void *sqlite3_errmsg16(sqlite3 *db){ 1260 const void *sqlite3_errmsg16(sqlite3 *db){ 1261 /* Because all the characters in the string are in the unicode < 1262 ** range 0x00-0xFF, if we pad the big-endian string with a < 1263 ** zero byte, we can obtain the little-endian string with < 1264 ** &big_endian[1]. < 1265 */ < 1266 static const char outOfMemBe[] = { | 1261 static const u16 outOfMem[] = { 1267 0, 'o', 0, 'u', 0, 't', 0, ' ', < 1268 0, 'o', 0, 'f', 0, ' ', < 1269 0, 'm', 0, 'e', 0, 'm', 0, 'o', 0, 'r', 0, 'y', 0, 0, 0 < > 1262 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0 1270 }; 1263 }; 1271 static const char misuseBe [] = { | 1264 static const u16 misuse[] = { 1272 0, 'l', 0, 'i', 0, 'b', 0, 'r', 0, 'a', 0, 'r', 0, 'y', 0, ' ', | 1265 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', 1273 0, 'r', 0, 'o', 0, 'u', 0, 't', 0, 'i', 0, 'n', 0, 'e', 0, ' ', | 1266 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', 1274 0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ', | 1267 'c', 'a', 'l', 'l', 'e', 'd', ' ', 1275 0, 'o', 0, 'u', 0, 't', 0, ' ', | 1268 'o', 'u', 't', ' ', 1276 0, 'o', 0, 'f', 0, ' ', | 1269 'o', 'f', ' ', 1277 0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0 | 1270 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0 1278 }; 1271 }; 1279 1272 1280 const void *z; 1273 const void *z; 1281 if( !db ){ 1274 if( !db ){ 1282 return (void *)(&outOfMemBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]); | 1275 return (void *)outOfMem; 1283 } 1276 } 1284 if( !sqlite3SafetyCheckSickOrOk(db) ){ 1277 if( !sqlite3SafetyCheckSickOrOk(db) ){ 1285 return (void *)(&misuseBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]); | 1278 return (void *)misuse; 1286 } 1279 } 1287 sqlite3_mutex_enter(db->mutex); 1280 sqlite3_mutex_enter(db->mutex); 1288 assert( !db->mallocFailed ); 1281 assert( !db->mallocFailed ); 1289 z = sqlite3_value_text16(db->pErr); 1282 z = sqlite3_value_text16(db->pErr); 1290 if( z==0 ){ 1283 if( z==0 ){ 1291 sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode), 1284 sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode), 1292 SQLITE_UTF8, SQLITE_STATIC); 1285 SQLITE_UTF8, SQLITE_STATIC);