]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Changes to comments and type names in rtree.c.
authordan <dan@noemail.net>
Tue, 31 Aug 2010 15:54:21 +0000 (15:54 +0000)
committerdan <dan@noemail.net>
Tue, 31 Aug 2010 15:54:21 +0000 (15:54 +0000)
FossilOrigin-Name: 7c4f80ad272138cd4ab30455fae6a36498362933

ext/rtree/rtree.c
manifest
manifest.uuid

index 76186d48182f9364e730a0e75584c1313be37531..8e2f8666bf7f03c961aa4b5c7b1205e46e0f66fc 100644 (file)
@@ -80,8 +80,9 @@ typedef struct RtreeCursor RtreeCursor;
 typedef struct RtreeNode RtreeNode;
 typedef struct RtreeCell RtreeCell;
 typedef struct RtreeConstraint RtreeConstraint;
+typedef struct RtreeMatchArg RtreeMatchArg;
+typedef struct RtreeGeomCallback RtreeGeomCallback;
 typedef union RtreeCoord RtreeCoord;
-typedef struct RtreeGeomBlob RtreeGeomBlob;
 
 /* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */
 #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
 ** 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
 ** r-tree query.
 */
-struct RtreeGeomBlob {
+struct RtreeMatchArg {
   u32 magic;                      /* Always RTREE_GEOMETRY_MAGIC */
   int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *);
   void *pContext;
@@ -254,6 +255,19 @@ struct RtreeGeomBlob {
   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
 # define MAX(x,y) ((x) < (y) ? (y) : (x))
 #endif
@@ -1106,7 +1120,7 @@ static int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){
 ** operator.
 */
 static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
-  RtreeGeomBlob *p;
+  RtreeMatchArg *p;
   sqlite3_rtree_geometry *pGeom;
   int nBlob;
 
@@ -1115,8 +1129,8 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
 
   /* Check that the blob is roughly the right size. */
   nBlob = sqlite3_value_bytes(pValue);
-  if( nBlob<sizeof(RtreeGeomBlob
-   || ((nBlob-sizeof(RtreeGeomBlob))%sizeof(double))!=0
+  if( nBlob<sizeof(RtreeMatchArg
+   || ((nBlob-sizeof(RtreeMatchArg))%sizeof(double))!=0
   ){
     return SQLITE_ERROR;
   }
@@ -1126,11 +1140,11 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
   );
   if( !pGeom ) return SQLITE_NOMEM;
   memset(pGeom, 0, sizeof(sqlite3_rtree_geometry));
-  p = (RtreeGeomBlob *)&pGeom[1];
+  p = (RtreeMatchArg *)&pGeom[1];
 
   memcpy(p, sqlite3_value_blob(pValue), nBlob);
   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);
     return SQLITE_ERROR;
@@ -1193,7 +1207,7 @@ static int rtreeFilter(
           p->iCoord = idxStr[ii*2+1]-'a';
           if( p->op==RTREE_MATCH ){
             /* 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.
             */
             rc = deserializeGeometry(argv[ii], p);
@@ -3093,12 +3107,6 @@ static void doSqlite3Free(void *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
 ** scalar user function. This C function is the callback used for all such
@@ -3108,12 +3116,12 @@ struct GeomCallbackCtx {
 ** table MATCH operators.
 */
 static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
-  GeomCallbackCtx *pGeomCtx = (GeomCallbackCtx *)sqlite3_user_data(ctx);
-  RtreeGeomBlob *pBlob;
+  RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)sqlite3_user_data(ctx);
+  RtreeMatchArg *pBlob;
   int nBlob;
 
-  nBlob = sizeof(RtreeGeomBlob) + (nArg-1)*sizeof(double);
-  pBlob = (RtreeGeomBlob *)sqlite3_malloc(nBlob);
+  nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(double);
+  pBlob = (RtreeMatchArg *)sqlite3_malloc(nBlob);
   if( !pBlob ){
     sqlite3_result_error_nomem(ctx);
   }else{
@@ -3138,10 +3146,10 @@ int sqlite3_rtree_geometry_callback(
   int (*xGeom)(sqlite3_rtree_geometry *, int, double *, int *),
   void *pContext
 ){
-  GeomCallbackCtx *pGeomCtx;      /* Context object for new user-function */
+  RtreeGeomCallback *pGeomCtx;      /* Context object for new user-function */
 
   /* Allocate and populate the context object. */
-  pGeomCtx = (GeomCallbackCtx *)sqlite3_malloc(sizeof(GeomCallbackCtx));
+  pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback));
   if( !pGeomCtx ) return SQLITE_NOMEM;
   pGeomCtx->xGeom = xGeom;
   pGeomCtx->pContext = pContext;
index 67e1214d2a62fda193498524fe4a402bec284fb9..bedb7e031a8232258c4b2995d6604c9b8add5d52 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Fix\sa\sdocumentation\stypo\sreported\son\sthe\smailing\slist.
-D 2010-08-31T15:38:52
+C Changes\sto\scomments\sand\stype\snames\sin\srtree.c.
+D 2010-08-31T15:54:21
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -81,7 +78,7 @@ F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
 F ext/icu/icu.c 850e9a36567bbcce6bd85a4b68243cad8e3c2de2
 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
 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/rtree1.test dbd4250ac0ad367a262eb9676f7e3080b0368206
 F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@@ -854,14 +851,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 53b0c03fd33d2d8141fd386de5493fec64456042
-R 776e9f05b41cfbfcf208301fd66607f6
-U drh
-Z 57cd5b719d8ab02c054ea145e97a806a
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMfSIOoxKgR168RlERAhLxAJ9gvWaCTQYE8HmwYXE4167pk0HbqQCfeun2
-BMlG7Oi5TtVFDPLSGQrymn4=
-=fndz
------END PGP SIGNATURE-----
+P c9fe0a2392ba4ae53d1dfcb986a67beeeb33519f
+R 301d7abc2fe21cc4b65e2daa2d7c00af
+U dan
+Z eacbd5c90af2b71f9a06ae40a306d809
index 2635ec05017ceba31965fdc492933220055d3156..f117473d5fce4db00af6434171654beb55983856 100644 (file)
@@ -1 +1 @@
-c9fe0a2392ba4ae53d1dfcb986a67beeeb33519f
\ No newline at end of file
+7c4f80ad272138cd4ab30455fae6a36498362933
\ No newline at end of file