Fix an off-by-one error in setting the "iLevel" field of the

sqlite3_rtree_query_info structure passed into the RTree query callback.

FossilOrigin-Name: d708f159abfb3b87e2844463088d4fb7f8da9c97
This commit is contained in:
drh 2014-04-21 15:21:19 +00:00
parent ec7c03a08b
commit a6ca7f2c1b
4 changed files with 10 additions and 10 deletions

View File

@ -973,7 +973,7 @@ static int rtreeCallbackConstraint(
*prScore = RTREE_ZERO;
}else{
pInfo->aCoord = aCoord;
pInfo->iLevel = pSearch->iLevel;
pInfo->iLevel = pSearch->iLevel - 1;
pInfo->rScore = pInfo->rParentScore = pSearch->rScore;
pInfo->eWithin = pInfo->eParentWithin = pSearch->eWithin;
rc = pConstraint->u.xQueryFunc(pInfo);

View File

@ -1,5 +1,5 @@
C Further\simprovements\sto\sthe\sRTREE_DECODE_COORD()\smethod,\sto\stake\sadvantage\nof\sknown\sprocessor\sbyte\sorders\swhen\savailable.\s\sThis\smakes\sthe\scode\s3%\sfaster,\naccording\sto\svalgrind.\s\sAlso\sadd\stest\scases\sto\smake\ssure\sthe\son-disk\nrepresentation\sis\scorrect.
D 2014-04-18T01:37:08.946
C Fix\san\soff-by-one\serror\sin\ssetting\sthe\s"iLevel"\sfield\sof\sthe\nsqlite3_rtree_query_info\sstructure\spassed\sinto\sthe\sRTree\squery\scallback.
D 2014-04-21T15:21:19.367
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e4ee6d36cdf6136aee0158675a3b24dd3bf31a5a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -120,7 +120,7 @@ F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c b8357523ca0aa01ec8efffdec0868909e3744257
F ext/rtree/rtree.c 09000d72086c21979960426bc9b592a6007bfb8d
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
F ext/rtree/rtree1.test e2da4aaa426918d27122d1a1066c6ecf8409a514
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@ -275,7 +275,7 @@ F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
F src/test_quota.c 30c64f0ef84734f2231a686df41ed882b0c59bc0
F src/test_quota.h 8761e463b25e75ebc078bd67d70e39b9c817a0cb
F src/test_rtree.c 38cdb28581d07503c9135ef73692ec8192b876b0
F src/test_rtree.c 4c1ff96a2d3a84e6a12fe8643e6d46dae0ef11de
F src/test_schema.c cd12a2223c3a394f4d07bb93bdf6d344c5c121b6
F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e
@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P d9eef5b03c7c4bb69c11eda41152ee81aed1cac7
R fd5f15a432e8499b9e125ee6ec5ed14e
P 6f3e94f4b1b403cd7bfc5e8e0ffbd61b5174d3a4
R 9cd9b8456e5c8aff94fe9550b50b870a
U drh
Z 4e8eac956a9a7b7e58efbf89636dab07
Z 1f57c8fdc97d1a8a65988c09a5e9a0f3

View File

@ -1 +1 @@
6f3e94f4b1b403cd7bfc5e8e0ffbd61b5174d3a4
d708f159abfb3b87e2844463088d4fb7f8da9c97

View File

@ -258,7 +258,7 @@ static int circle_query_func(sqlite3_rtree_query_info *p){
}else{
/* Depth-first search, except sort the leaf nodes by area with
** the largest area first */
if( p->iLevel==2 ){
if( p->iLevel==1 ){
p->rScore = 1.0 - (xmax-xmin)*(ymax-ymin)/pCircle->mxArea;
if( p->rScore<0.01 ) p->rScore = 0.01;
}else{