List:Internals« Previous MessageNext Message »
From:holyfoot Date:May 13 2005 7:03pm
Subject:bk commit into 4.1 tree (hf:1.2270) BUG#10626
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2270 05/05/13 22:03:19 hf@deer.(none) +1 -0
  Fix for bug #10626 ( gis.test fails)

  sql/spatial.cc
    1.20 05/05/13 22:02:35 hf@deer.(none) +22 -25
    just float8get doesn't work well with the local variables -
    they can be of processor-specific floating type - not the
    standard decimal
    so 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	hf
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-4.1.clean

--- 1.19/sql/spatial.cc	Fri Oct 22 20:31:27 2004
+++ 1.20/sql/spatial.cc	Fri May 13 22:02:35 2005
@@ -96,6 +96,12 @@
 geometrycollection_class("GEOMETRYCOLLECTION",Geometry::wkb_geometrycollection,
 			 create_geometrycollection);
 
+static void get_point(double *x, double *y, const char *data)
+{
+  float8get(*x, data);
+  float8get(*y, data + SIZEOF_STORED_DOUBLE);
+}
+
 /***************************** Geometry *******************************/
 
 Geometry::Class_info *Geometry::find_class(const char *name, uint32 len)
@@ -266,14 +272,13 @@
 {			     
   while (n_points--)
   {
-    double d;
+    double x,y;
     data+= offset;
-    float8get(d, data);
-    txt->qs_append(d);
-    txt->qs_append(' ');
-    float8get(d, data + SIZEOF_STORED_DOUBLE);
+    get_point(&x, &y, data);
     data+= SIZEOF_STORED_DOUBLE * 2;
-    txt->qs_append(d);
+    txt->qs_append(x);
+    txt->qs_append(' ');
+    txt->qs_append(y);
     txt->qs_append(',');
   }
   return data;
@@ -426,8 +431,7 @@
   while (n_points--)
   {
     double x, y;
-    float8get(x, data);
-    float8get(y, data + SIZEOF_STORED_DOUBLE);
+    get_point(&x, &y, data);
     data+= SIZEOF_STORED_DOUBLE * 2;
     txt->qs_append(x);
     txt->qs_append(' ');
@@ -460,15 +464,13 @@
   if (n_points < 1 || no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points))
     return 1;
 
-  float8get(prev_x, data);
-  float8get(prev_y, data + SIZEOF_STORED_DOUBLE);
+  get_point(&prev_x, &prev_y, data);
   data+= SIZEOF_STORED_DOUBLE*2;
 
   while (--n_points)
   {
     double x, y;
-    float8get(x, data);
-    float8get(y, data + SIZEOF_STORED_DOUBLE);
+    get_point(&x, &y, data);
     data+= SIZEOF_STORED_DOUBLE * 2;
     *len+= sqrt(pow(prev_x-x,2)+pow(prev_y-y,2));
     prev_x= x;
@@ -497,13 +499,11 @@
     return 1;
 
   /* Get first point */
-  float8get(x1, data);
-  float8get(y1, data + SIZEOF_STORED_DOUBLE);
+  get_point(&x1, &y1, data);
 
   /* get last point */
   data+= SIZEOF_STORED_DOUBLE*2 + (n_points-2)*POINT_DATA_SIZE;
-  float8get(x2, data);
-  float8get(y2, data + SIZEOF_STORED_DOUBLE);
+  get_point(&x2, &y2, data);
 
   *closed= (x1==x2) && (y1==y2);
   return 0;
@@ -681,15 +681,13 @@
     n_points= uint4korr(data);
     if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
       return 1;
-    float8get(prev_x, data+4);
-    float8get(prev_y, data+(4+SIZEOF_STORED_DOUBLE));
+    get_point(&prev_x, &prev_y, data+4);
     data+= (4+SIZEOF_STORED_DOUBLE*2);
 
     while (--n_points)				// One point is already read
     {
       double x, y;
-      float8get(x, data);
-      float8get(y, data + SIZEOF_STORED_DOUBLE);
+      get_point(&x, &y, data);
       data+= (SIZEOF_STORED_DOUBLE*2);
       /* QQ: Is the following prev_x+x right ? */
       lr_area+= (prev_x + x)* (prev_y - y);
@@ -779,7 +777,8 @@
 int Gis_polygon::centroid_xy(double *x, double *y) const
 {
   uint32 n_linear_rings;
-  double res_area, res_cx, res_cy;
+  double res_area;
+  double res_cx, res_cy;
   const char *data= m_data;
   bool first_loop= 1;
   LINT_INIT(res_area);
@@ -805,15 +804,13 @@
     data+= 4;
     if (no_data(data, (SIZEOF_STORED_DOUBLE*2) * n_points))
       return 1;
-    float8get(prev_x, data);
-    float8get(prev_y, data+SIZEOF_STORED_DOUBLE);
+    get_point(&prev_x, &prev_y, data);
     data+= (SIZEOF_STORED_DOUBLE*2);
 
     while (--n_points)				// One point is already read
     {
       double x, y;
-      float8get(x, data);
-      float8get(y, data + SIZEOF_STORED_DOUBLE);
+      get_point(&x, &y, data);
       data+= (SIZEOF_STORED_DOUBLE*2);
       /* QQ: Is the following prev_x+x right ? */
       cur_area+= (prev_x + x) * (prev_y - y);
Thread
bk commit into 4.1 tree (hf:1.2270) BUG#10626holyfoot13 May