diff options
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index e3436ac4641..b0ab03363d3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2342,7 +2342,8 @@ String *Item_func_spatial_collection::val_str(String *str) } else { - uint32 wkb_type, len=res->length(); + enum Geometry::wkbType wkb_type; + uint32 len=res->length(); const char *data=res->ptr()+1; /* @@ -2351,75 +2352,74 @@ String *Item_func_spatial_collection::val_str(String *str) do this checking now */ - if (len<5) + if (len < 5) goto ret; - wkb_type=uint4korr(data); + wkb_type= (Geometry::wkbType) uint4korr(data); data+=4; len-=5; - if ( wkb_type != item_type ) + if (wkb_type != item_type) goto ret; - switch(coll_type) - { - case Geometry::wkbMultiPoint: - case Geometry::wkbMultiLineString: - case Geometry::wkbMultiPolygon: - if (len<WKB_HEADER_SIZE) - goto ret; + switch (coll_type) { + case Geometry::wkbMultiPoint: + case Geometry::wkbMultiLineString: + case Geometry::wkbMultiPolygon: + if (len < WKB_HEADER_SIZE) + goto ret; - data+=WKB_HEADER_SIZE; - len-=WKB_HEADER_SIZE; - if (str->reserve(len,512)) - goto ret; - str->q_append(data,len); - break; - - case Geometry::wkbLineString: - if (str->reserve(POINT_DATA_SIZE,512)) - goto ret; - str->q_append(data,POINT_DATA_SIZE); - break; - - case Geometry::wkbPolygon: - { - uint32 n_points; - double x1, y1, x2, y2; - - if (len < WKB_HEADER_SIZE + 4 + 8 + 8) - goto ret; - data+=WKB_HEADER_SIZE; - len-=WKB_HEADER_SIZE; - - uint32 llen=len; - const char *ldata=data; + data+=WKB_HEADER_SIZE; + len-=WKB_HEADER_SIZE; + if (str->reserve(len,512)) + goto ret; + str->q_append(data,len); + break; + + case Geometry::wkbLineString: + if (str->reserve(POINT_DATA_SIZE,512)) + goto ret; + str->q_append(data,POINT_DATA_SIZE); + break; + + case Geometry::wkbPolygon: + { + uint32 n_points; + double x1, y1, x2, y2; + + if (len < WKB_HEADER_SIZE + 4 + 8 + 8) + goto ret; + data+=WKB_HEADER_SIZE; + len-=WKB_HEADER_SIZE; + + uint32 llen=len; + const char *ldata=data; - n_points=uint4korr(data); - data+=4; - float8get(x1,data); - data+=8; - float8get(y1,data); - data+=8; + n_points=uint4korr(data); + data+=4; + float8get(x1,data); + data+=8; + float8get(y1,data); + data+=8; - len-= 4 + 8 + 8; + len-= 4 + 8 + 8; - if (len < n_points * POINT_DATA_SIZE) - goto ret; - data+=(n_points-2) * POINT_DATA_SIZE; + if (len < n_points * POINT_DATA_SIZE) + goto ret; + data+=(n_points-2) * POINT_DATA_SIZE; - float8get(x2,data); - float8get(y2,data+8); + float8get(x2,data); + float8get(y2,data+8); - if ((x1 != x2) || (y1 != y2)) - goto ret; + if ((x1 != x2) || (y1 != y2)) + goto ret; - if (str->reserve(llen,512)) - goto ret; - str->q_append(ldata, llen); - } - break; + if (str->reserve(llen,512)) + goto ret; + str->q_append(ldata, llen); + } + break; - default: - goto ret; + default: + goto ret; } } } |