diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-14 11:12:26 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-14 11:12:26 -0300 |
commit | 7f1eedec2d70c3afe3b9b1c788d357322189a237 (patch) | |
tree | c1cb5b7c9fbb5fd6901154d278efe7223b5cac53 /sql/spatial.cc | |
parent | 4972f4d8030b5fc053b3c5605505215a653a39e1 (diff) | |
parent | f317d3a6fb413cfc04c1ed005df8e859664e41d5 (diff) | |
download | mariadb-git-7f1eedec2d70c3afe3b9b1c788d357322189a237.tar.gz |
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r-- | sql/spatial.cc | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc index fcf06119db9..f96196cb836 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -36,7 +36,7 @@ static Geometry::Class_info **ci_collection_end= Geometry::ci_collection+Geometry::wkb_last + 1; Geometry::Class_info::Class_info(const char *name, int type_id, - void(*create_func)(void *)): + create_geom_t create_func): m_type_id(type_id), m_create_func(create_func) { m_name.str= (char *) name; @@ -45,39 +45,39 @@ Geometry::Class_info::Class_info(const char *name, int type_id, ci_collection[type_id]= this; } -static void create_point(void *buffer) +static Geometry *create_point(char *buffer) { - new(buffer) Gis_point; + return new (buffer) Gis_point; } -static void create_linestring(void *buffer) +static Geometry *create_linestring(char *buffer) { - new(buffer) Gis_line_string; + return new (buffer) Gis_line_string; } -static void create_polygon(void *buffer) +static Geometry *create_polygon(char *buffer) { - new(buffer) Gis_polygon; + return new (buffer) Gis_polygon; } -static void create_multipoint(void *buffer) +static Geometry *create_multipoint(char *buffer) { - new(buffer) Gis_multi_point; + return new (buffer) Gis_multi_point; } -static void create_multipolygon(void *buffer) +static Geometry *create_multipolygon(char *buffer) { - new(buffer) Gis_multi_polygon; + return new (buffer) Gis_multi_polygon; } -static void create_multilinestring(void *buffer) +static Geometry *create_multilinestring(char *buffer) { - new(buffer) Gis_multi_line_string; + return new (buffer) Gis_multi_line_string; } -static void create_geometrycollection(void *buffer) +static Geometry *create_geometrycollection(char *buffer) { - new(buffer) Gis_geometry_collection; + return new (buffer) Gis_geometry_collection; } @@ -131,10 +131,9 @@ Geometry::Class_info *Geometry::find_class(const char *name, uint32 len) Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id) { Class_info *ci; - if (!(ci= find_class((int) type_id))) + if (!(ci= find_class(type_id))) return NULL; - (*ci->m_create_func)(buffer->buf.arr()); - return my_reinterpret_cast(Geometry *)(buffer->buf.arr()); + return (*ci->m_create_func)(buffer->data); } @@ -172,9 +171,7 @@ Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer, if (!(ci= find_class(name.str, name.length)) || wkt->reserve(1 + 4, 512)) return NULL; - (*ci->m_create_func)((void *)buffer); - Geometry *result= (Geometry *)buffer; - + Geometry *result= (*ci->m_create_func)(buffer->data); wkt->q_append((char) wkb_ndr); wkt->q_append((uint32) result->get_class_info()->m_type_id); if (trs->check_next_symbol('(') || |