mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-21 11:13:54 +03:00
Remove unused opcodes from the VDBE and fix a bug in the substr() function. (CVS 405)
FossilOrigin-Name: e8611e0c052ddac477f83df485fa5dc882593de0
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.10 2002/02/28 03:14:18 drh Exp $
|
||||
** $Id: func.c,v 1.11 2002/02/28 03:31:11 drh Exp $
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
@@ -108,6 +108,10 @@ static void substrFunc(sqlite_func *context, int argc, const char **argv){
|
||||
#endif
|
||||
if( p1<0 ){
|
||||
p1 += len;
|
||||
if( p1<0 ){
|
||||
p2 += p1;
|
||||
p1 = 0;
|
||||
}
|
||||
}else if( p1>0 ){
|
||||
p1--;
|
||||
}
|
||||
@@ -124,6 +128,7 @@ static void substrFunc(sqlite_func *context, int argc, const char **argv){
|
||||
if( (z[i]&0xc0)!=0x80 ) p2++;
|
||||
}
|
||||
#endif
|
||||
if( p2<0 ) p2 = 0;
|
||||
sqlite_set_result_string(context, &z[p1], p2);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user