diff options
author | dan <dan@noemail.net> | 2010-03-05 16:32:12 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-03-05 16:32:12 +0000 |
commit | b7dca7d7335b02122a3fd1846723c07a3a5af32f (patch) | |
tree | 1b544e6fb8e1422be2e9441147557f0f60bb4ca6 /src/utf.c | |
parent | f8b4d8c682ecc60197c9c3f5e76f55a3beda9981 (diff) | |
download | sqlite-b7dca7d7335b02122a3fd1846723c07a3a5af32f.tar.gz sqlite-b7dca7d7335b02122a3fd1846723c07a3a5af32f.zip |
Modify the vdbe so that the comparison operator opcodes do not modify the data type of operands. Fix for [aa92c76cd4].
FossilOrigin-Name: 8858042fa1449516a2c7dbb991dca3eb6c5794cb
Diffstat (limited to 'src/utf.c')
-rw-r--r-- | src/utf.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -437,11 +437,11 @@ int sqlite3Utf8To8(unsigned char *zIn){ ** ** NULL is returned if there is an allocation error. */ -char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){ +char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){ Mem m; memset(&m, 0, sizeof(m)); m.db = db; - sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC); + sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC); sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8); if( db->mallocFailed ){ sqlite3VdbeMemRelease(&m); @@ -449,7 +449,9 @@ char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){ } assert( (m.flags & MEM_Term)!=0 || db->mallocFailed ); assert( (m.flags & MEM_Str)!=0 || db->mallocFailed ); - return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3DbStrDup(db, m.z); + assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed ); + assert( m.z || db->mallocFailed ); + return m.z; } /* |