aboutsummaryrefslogtreecommitdiff
path: root/src/vdbeapi.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-09-11 23:34:55 +0000
committerdrh <drh@noemail.net>2014-09-11 23:34:55 +0000
commitfc59a954cbce32be71da37d7ca1f447396ba39e0 (patch)
tree8deb5f24a941c7115646c344a84ccb3fd0b60425 /src/vdbeapi.c
parent46c831bf2a9195891dfb213e6c40ca3f22b09688 (diff)
downloadsqlite-fc59a954cbce32be71da37d7ca1f447396ba39e0.tar.gz
sqlite-fc59a954cbce32be71da37d7ca1f447396ba39e0.zip
Fix an issue with sqlite3_bind_text64() with the SQLITE_UTF16 encoding
parameter. Remove some unreachable code from the text64() and blob64() implementation. FossilOrigin-Name: 34292b084ef48cd6e9ca5704f6b072a29733b4c2
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r--src/vdbeapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 4dccb30c1..b64f33c8c 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -235,12 +235,11 @@ static int invokeValueDestructor(
void (*xDel)(void*), /* The destructor */
sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if no NULL */
){
+ assert( xDel!=SQLITE_DYNAMIC );
if( xDel==0 ){
/* noop */
}else if( xDel==SQLITE_TRANSIENT ){
/* noop */
- }else if( xDel==SQLITE_DYNAMIC ){
- sqlite3_free((void*)p);
}else{
xDel((void*)p);
}
@@ -264,6 +263,7 @@ void sqlite3_result_blob64(
void (*xDel)(void *)
){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
+ assert( xDel!=SQLITE_DYNAMIC );
if( n>0x7fffffff ){
(void)invokeValueDestructor(z, xDel, pCtx);
}else{
@@ -317,6 +317,7 @@ void sqlite3_result_text64(
unsigned char enc
){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
+ assert( xDel!=SQLITE_DYNAMIC );
if( n>0x7fffffff ){
(void)invokeValueDestructor(z, xDel, pCtx);
}else{
@@ -1179,6 +1180,7 @@ int sqlite3_bind_blob64(
sqlite3_uint64 nData,
void (*xDel)(void*)
){
+ assert( xDel!=SQLITE_DYNAMIC );
if( nData>0x7fffffff ){
return invokeValueDestructor(zData, xDel, 0);
}else{
@@ -1234,9 +1236,11 @@ int sqlite3_bind_text64(
void (*xDel)(void*),
unsigned char enc
){
+ assert( xDel!=SQLITE_DYNAMIC );
if( nData>0x7fffffff ){
return invokeValueDestructor(zData, xDel, 0);
}else{
+ if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
return bindText(pStmt, i, zData, nData, xDel, enc);
}
}