mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Changes to comments and type names in rtree.c.
FossilOrigin-Name: 7c4f80ad272138cd4ab30455fae6a36498362933
This commit is contained in:
@ -80,8 +80,9 @@ typedef struct RtreeCursor RtreeCursor;
|
|||||||
typedef struct RtreeNode RtreeNode;
|
typedef struct RtreeNode RtreeNode;
|
||||||
typedef struct RtreeCell RtreeCell;
|
typedef struct RtreeCell RtreeCell;
|
||||||
typedef struct RtreeConstraint RtreeConstraint;
|
typedef struct RtreeConstraint RtreeConstraint;
|
||||||
|
typedef struct RtreeMatchArg RtreeMatchArg;
|
||||||
|
typedef struct RtreeGeomCallback RtreeGeomCallback;
|
||||||
typedef union RtreeCoord RtreeCoord;
|
typedef union RtreeCoord RtreeCoord;
|
||||||
typedef struct RtreeGeomBlob RtreeGeomBlob;
|
|
||||||
|
|
||||||
/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */
|
/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */
|
||||||
#define RTREE_MAX_DIMENSIONS 5
|
#define RTREE_MAX_DIMENSIONS 5
|
||||||
@ -235,7 +236,7 @@ struct RtreeCell {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Value for the first field of every RtreeGeomBlob object. The MATCH
|
** Value for the first field of every RtreeMatchArg object. The MATCH
|
||||||
** operator tests that the first field of a blob operand matches this
|
** operator tests that the first field of a blob operand matches this
|
||||||
** value to avoid operating on invalid blobs (which could cause a segfault).
|
** value to avoid operating on invalid blobs (which could cause a segfault).
|
||||||
*/
|
*/
|
||||||
@ -246,7 +247,7 @@ struct RtreeCell {
|
|||||||
** the right-hand-side of an SQL MATCH operator used to constrain an
|
** the right-hand-side of an SQL MATCH operator used to constrain an
|
||||||
** r-tree query.
|
** r-tree query.
|
||||||
*/
|
*/
|
||||||
struct RtreeGeomBlob {
|
struct RtreeMatchArg {
|
||||||
u32 magic; /* Always RTREE_GEOMETRY_MAGIC */
|
u32 magic; /* Always RTREE_GEOMETRY_MAGIC */
|
||||||
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);
|
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);
|
||||||
void *pContext;
|
void *pContext;
|
||||||
@ -254,6 +255,19 @@ struct RtreeGeomBlob {
|
|||||||
double aParam[1];
|
double aParam[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
** When a geometry callback is created (see sqlite3_rtree_geometry_callback),
|
||||||
|
** a single instance of the following structure is allocated. It is used
|
||||||
|
** as the context for the user-function created by by s_r_g_c(). The object
|
||||||
|
** is eventually deleted by the destructor mechanism provided by
|
||||||
|
** sqlite3_create_function_v2() (which is called by s_r_g_c() to create
|
||||||
|
** the geometry callback function).
|
||||||
|
*/
|
||||||
|
struct RtreeGeomCallback {
|
||||||
|
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);
|
||||||
|
void *pContext;
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
# define MAX(x,y) ((x) < (y) ? (y) : (x))
|
# define MAX(x,y) ((x) < (y) ? (y) : (x))
|
||||||
#endif
|
#endif
|
||||||
@ -1106,7 +1120,7 @@ static int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){
|
|||||||
** operator.
|
** operator.
|
||||||
*/
|
*/
|
||||||
static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
|
static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
|
||||||
RtreeGeomBlob *p;
|
RtreeMatchArg *p;
|
||||||
sqlite3_rtree_geometry *pGeom;
|
sqlite3_rtree_geometry *pGeom;
|
||||||
int nBlob;
|
int nBlob;
|
||||||
|
|
||||||
@ -1115,8 +1129,8 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
|
|||||||
|
|
||||||
/* Check that the blob is roughly the right size. */
|
/* Check that the blob is roughly the right size. */
|
||||||
nBlob = sqlite3_value_bytes(pValue);
|
nBlob = sqlite3_value_bytes(pValue);
|
||||||
if( nBlob<sizeof(RtreeGeomBlob)
|
if( nBlob<sizeof(RtreeMatchArg)
|
||||||
|| ((nBlob-sizeof(RtreeGeomBlob))%sizeof(double))!=0
|
|| ((nBlob-sizeof(RtreeMatchArg))%sizeof(double))!=0
|
||||||
){
|
){
|
||||||
return SQLITE_ERROR;
|
return SQLITE_ERROR;
|
||||||
}
|
}
|
||||||
@ -1126,11 +1140,11 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
|
|||||||
);
|
);
|
||||||
if( !pGeom ) return SQLITE_NOMEM;
|
if( !pGeom ) return SQLITE_NOMEM;
|
||||||
memset(pGeom, 0, sizeof(sqlite3_rtree_geometry));
|
memset(pGeom, 0, sizeof(sqlite3_rtree_geometry));
|
||||||
p = (RtreeGeomBlob *)&pGeom[1];
|
p = (RtreeMatchArg *)&pGeom[1];
|
||||||
|
|
||||||
memcpy(p, sqlite3_value_blob(pValue), nBlob);
|
memcpy(p, sqlite3_value_blob(pValue), nBlob);
|
||||||
if( p->magic!=RTREE_GEOMETRY_MAGIC
|
if( p->magic!=RTREE_GEOMETRY_MAGIC
|
||||||
|| nBlob!=(sizeof(RtreeGeomBlob) + (p->nParam-1)*sizeof(double))
|
|| nBlob!=(sizeof(RtreeMatchArg) + (p->nParam-1)*sizeof(double))
|
||||||
){
|
){
|
||||||
sqlite3_free(pGeom);
|
sqlite3_free(pGeom);
|
||||||
return SQLITE_ERROR;
|
return SQLITE_ERROR;
|
||||||
@ -1193,7 +1207,7 @@ static int rtreeFilter(
|
|||||||
p->iCoord = idxStr[ii*2+1]-'a';
|
p->iCoord = idxStr[ii*2+1]-'a';
|
||||||
if( p->op==RTREE_MATCH ){
|
if( p->op==RTREE_MATCH ){
|
||||||
/* A MATCH operator. The right-hand-side must be a blob that
|
/* A MATCH operator. The right-hand-side must be a blob that
|
||||||
** can be cast into an RtreeGeomBlob object. One created using
|
** can be cast into an RtreeMatchArg object. One created using
|
||||||
** an sqlite3_rtree_geometry_callback() SQL user function.
|
** an sqlite3_rtree_geometry_callback() SQL user function.
|
||||||
*/
|
*/
|
||||||
rc = deserializeGeometry(argv[ii], p);
|
rc = deserializeGeometry(argv[ii], p);
|
||||||
@ -3093,12 +3107,6 @@ static void doSqlite3Free(void *p){
|
|||||||
sqlite3_free(p);
|
sqlite3_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct GeomCallbackCtx GeomCallbackCtx;
|
|
||||||
struct GeomCallbackCtx {
|
|
||||||
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);
|
|
||||||
void *pContext;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Each call to sqlite3_rtree_geometry_callback() creates an ordinary SQLite
|
** Each call to sqlite3_rtree_geometry_callback() creates an ordinary SQLite
|
||||||
** scalar user function. This C function is the callback used for all such
|
** scalar user function. This C function is the callback used for all such
|
||||||
@ -3108,12 +3116,12 @@ struct GeomCallbackCtx {
|
|||||||
** table MATCH operators.
|
** table MATCH operators.
|
||||||
*/
|
*/
|
||||||
static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
|
static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
|
||||||
GeomCallbackCtx *pGeomCtx = (GeomCallbackCtx *)sqlite3_user_data(ctx);
|
RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)sqlite3_user_data(ctx);
|
||||||
RtreeGeomBlob *pBlob;
|
RtreeMatchArg *pBlob;
|
||||||
int nBlob;
|
int nBlob;
|
||||||
|
|
||||||
nBlob = sizeof(RtreeGeomBlob) + (nArg-1)*sizeof(double);
|
nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(double);
|
||||||
pBlob = (RtreeGeomBlob *)sqlite3_malloc(nBlob);
|
pBlob = (RtreeMatchArg *)sqlite3_malloc(nBlob);
|
||||||
if( !pBlob ){
|
if( !pBlob ){
|
||||||
sqlite3_result_error_nomem(ctx);
|
sqlite3_result_error_nomem(ctx);
|
||||||
}else{
|
}else{
|
||||||
@ -3138,10 +3146,10 @@ int sqlite3_rtree_geometry_callback(
|
|||||||
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *),
|
int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *),
|
||||||
void *pContext
|
void *pContext
|
||||||
){
|
){
|
||||||
GeomCallbackCtx *pGeomCtx; /* Context object for new user-function */
|
RtreeGeomCallback *pGeomCtx; /* Context object for new user-function */
|
||||||
|
|
||||||
/* Allocate and populate the context object. */
|
/* Allocate and populate the context object. */
|
||||||
pGeomCtx = (GeomCallbackCtx *)sqlite3_malloc(sizeof(GeomCallbackCtx));
|
pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback));
|
||||||
if( !pGeomCtx ) return SQLITE_NOMEM;
|
if( !pGeomCtx ) return SQLITE_NOMEM;
|
||||||
pGeomCtx->xGeom = xGeom;
|
pGeomCtx->xGeom = xGeom;
|
||||||
pGeomCtx->pContext = pContext;
|
pGeomCtx->pContext = pContext;
|
||||||
|
24
manifest
24
manifest
@ -1,8 +1,5 @@
|
|||||||
-----BEGIN PGP SIGNED MESSAGE-----
|
C Changes\sto\scomments\sand\stype\snames\sin\srtree.c.
|
||||||
Hash: SHA1
|
D 2010-08-31T15:54:21
|
||||||
|
|
||||||
C Fix\sa\sdocumentation\stypo\sreported\son\sthe\smailing\slist.
|
|
||||||
D 2010-08-31T15:38:52
|
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
|
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@ -81,7 +78,7 @@ F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
|
|||||||
F ext/icu/icu.c 850e9a36567bbcce6bd85a4b68243cad8e3c2de2
|
F ext/icu/icu.c 850e9a36567bbcce6bd85a4b68243cad8e3c2de2
|
||||||
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c 556479bc9c32aa80316dc9edd18b8c47c9afaf8d
|
F ext/rtree/rtree.c e26735d586497dbd037b3a6b2df25f9e6ea5b0ec
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
F ext/rtree/rtree1.test dbd4250ac0ad367a262eb9676f7e3080b0368206
|
F ext/rtree/rtree1.test dbd4250ac0ad367a262eb9676f7e3080b0368206
|
||||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||||
@ -854,14 +851,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 53b0c03fd33d2d8141fd386de5493fec64456042
|
P c9fe0a2392ba4ae53d1dfcb986a67beeeb33519f
|
||||||
R 776e9f05b41cfbfcf208301fd66607f6
|
R 301d7abc2fe21cc4b65e2daa2d7c00af
|
||||||
U drh
|
U dan
|
||||||
Z 57cd5b719d8ab02c054ea145e97a806a
|
Z eacbd5c90af2b71f9a06ae40a306d809
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
|
||||||
|
|
||||||
iD8DBQFMfSIOoxKgR168RlERAhLxAJ9gvWaCTQYE8HmwYXE4167pk0HbqQCfeun2
|
|
||||||
BMlG7Oi5TtVFDPLSGQrymn4=
|
|
||||||
=fndz
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
|
@ -1 +1 @@
|
|||||||
c9fe0a2392ba4ae53d1dfcb986a67beeeb33519f
|
7c4f80ad272138cd4ab30455fae6a36498362933
|
Reference in New Issue
Block a user