summaryrefslogtreecommitdiff
path: root/sql/spatial.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-05-22 18:51:21 +0300
committerunknown <monty@hundin.mysql.fi>2002-05-22 18:51:21 +0300
commita8652e9957e014c19b47635e09147a7bc17a3b8c (patch)
treee6741f4cc08ecfcebdfc62b6fab6d6b0e1a7e453 /sql/spatial.cc
parentc811538f89925b7111e4ee0e3b940726f32a64d9 (diff)
downloadmariadb-git-a8652e9957e014c19b47635e09147a7bc17a3b8c.tar.gz
Fixed problem in fulltest testcase
include/my_base.h: Fix to ensure that old tables works in 4.1 myisam/mi_open.c: cleanup mysys/my_handler.c: Fixed problem in fulltest testcase sql/spatial.cc: cleanup sql/sql_table.cc: cleanup
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r--sql/spatial.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 32942a70dc2..bb6e03c3c03 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -680,13 +680,16 @@ int GPolygon::centroid_xy(double *x, double *y) const
uint32 i;
double res_area, res_cx, res_cy;
const char *data = m_data;
+ LINT_INIT(res_area);
+ LINT_INIT(res_cx);
+ LINT_INIT(res_cy);
if (no_data(data, 4))
return 1;
n_linear_rings = uint4korr(data);
data += 4;
- for(i = 0; i < n_linear_rings; ++i)
+ for (i = 0; i < n_linear_rings; ++i)
{
if (no_data(data, 4))
return 1;
@@ -720,7 +723,8 @@ int GPolygon::centroid_xy(double *x, double *y) const
cur_area = fabs(cur_area) / 2;
cur_cx = cur_cx / (n_points - 1);
cur_cy = cur_cy / (n_points - 1);
- if(i)
+
+ if (i)
{
double d_area = res_area - cur_area;
if (d_area <= 0)
@@ -1195,6 +1199,10 @@ int GMultiPolygon::centroid(String *result) const
double res_area, res_cx, res_cy;
double cur_area, cur_cx, cur_cy;
+ LINT_INIT(res_area);
+ LINT_INIT(res_cx);
+ LINT_INIT(res_cy);
+
const char *data = m_data;
if (no_data(data, 4))
return 1;
@@ -1211,7 +1219,7 @@ int GMultiPolygon::centroid(String *result) const
if (p.centroid_xy(&cur_cx, &cur_cy))
return 1;
- if(i)
+ if (i)
{
double sum_area = res_area + cur_area;
res_cx = (res_area * res_cx + cur_area * cur_cx) / sum_area;