1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

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
This commit is contained in:
drh
2014-09-11 23:34:55 +00:00
parent 46c831bf2a
commit fc59a954cb
3 changed files with 13 additions and 10 deletions

View File

@@ -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);
}
}