1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Add comments, assertions, and test cases to demonstrate that the

problem described in ticket #2742 is not a real problem. (CVS 4510)

FossilOrigin-Name: c085d6dfc0f5849113986cb2a25e64d0c95b3dfb
This commit is contained in:
drh
2007-10-23 18:55:48 +00:00
parent 9e0ebbfa41
commit 0cf19ed817
4 changed files with 65 additions and 10 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.314 2007/10/23 15:39:45 drh Exp $
** $Id: expr.c,v 1.315 2007/10/23 18:55:49 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1694,12 +1694,17 @@ static char *dup8bytes(Vdbe *v, const char *in){
/*
** Generate an instruction that will put the floating point
** value described by z[0..n-1] on the stack.
**
** The z[] string will probably not be zero-terminated. But the
** z[n] character is guaranteed to be something that does not look
** like the continuation of the number.
*/
static void codeReal(Vdbe *v, const char *z, int n, int negateFlag){
assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
if( z ){
double value;
char *zV;
assert( !isdigit(z[n]) );
sqlite3AtoF(z, &value);
if( negateFlag ) value = -value;
zV = dup8bytes(v, (char*)&value);
@@ -1711,11 +1716,16 @@ static void codeReal(Vdbe *v, const char *z, int n, int negateFlag){
/*
** Generate an instruction that will put the integer describe by
** text z[0..n-1] on the stack.
**
** The z[] string will probably not be zero-terminated. But the
** z[n] character is guaranteed to be something that does not look
** like the continuation of the number.
*/
static void codeInteger(Vdbe *v, const char *z, int n, int negateFlag){
assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
if( z ){
int i;
assert( !isdigit(z[n]) );
if( sqlite3GetInt32(z, &i) ){
if( negateFlag ) i = -i;
sqlite3VdbeAddOp(v, OP_Integer, i, 0);