Commit 2a32bb2b authored by unknown's avatar unknown

portability fix

parent b94356ae
...@@ -94,6 +94,7 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length, ...@@ -94,6 +94,7 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
{ {
for (; (int) key_length > 0; keyseg += 2 ) for (; (int) key_length > 0; keyseg += 2 )
{ {
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
RT_CMP_KORR(int8, mi_sint1korr, 1, nextflag); RT_CMP_KORR(int8, mi_sint1korr, 1, nextflag);
...@@ -138,7 +139,7 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length, ...@@ -138,7 +139,7 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
default: default:
return 1; return 1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
b+= keyseg_length; b+= keyseg_length;
...@@ -181,6 +182,7 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length) ...@@ -181,6 +182,7 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
double res = 1; double res = 1;
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
RT_VOL_KORR(int8, mi_sint1korr, 1, (double)); RT_VOL_KORR(int8, mi_sint1korr, 1, (double));
...@@ -226,7 +228,7 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length) ...@@ -226,7 +228,7 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
default: default:
return -1; return -1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
} }
...@@ -251,13 +253,16 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length) ...@@ -251,13 +253,16 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
*res++ = cast(amax); \ *res++ = cast(amax); \
} }
/* /*
Creates an MBR as an array of doubles. Creates an MBR as an array of doubles.
*/ */
int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res) int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
{ {
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
RT_D_MBR_KORR(int8, mi_sint1korr, 1, (double)); RT_D_MBR_KORR(int8, mi_sint1korr, 1, (double));
...@@ -303,7 +308,7 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res) ...@@ -303,7 +308,7 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
default: default:
return 1; return 1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
} }
...@@ -347,6 +352,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c, ...@@ -347,6 +352,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
{ {
for ( ; (int) key_length > 0 ; keyseg += 2) for ( ; (int) key_length > 0 ; keyseg += 2)
{ {
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
RT_COMB_KORR(int8, mi_sint1korr, mi_int1store, 1); RT_COMB_KORR(int8, mi_sint1korr, mi_int1store, 1);
...@@ -391,7 +397,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c, ...@@ -391,7 +397,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
default: default:
return 1; return 1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
b+= keyseg_length; b+= keyseg_length;
...@@ -400,6 +406,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c, ...@@ -400,6 +406,7 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
return 0; return 0;
} }
#define RT_OVL_AREA_KORR(type, korr_func, len) \ #define RT_OVL_AREA_KORR(type, korr_func, len) \
{ \ { \
type amin, amax, bmin, bmax; \ type amin, amax, bmin, bmax; \
...@@ -437,6 +444,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -437,6 +444,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
double res = 1; double res = 1;
for (; (int) key_length > 0 ; keyseg += 2) for (; (int) key_length > 0 ; keyseg += 2)
{ {
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
RT_OVL_AREA_KORR(int8, mi_sint1korr, 1); RT_OVL_AREA_KORR(int8, mi_sint1korr, 1);
...@@ -481,7 +489,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -481,7 +489,7 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
default: default:
return -1; return -1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
b+= keyseg_length; b+= keyseg_length;
...@@ -522,11 +530,10 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -522,11 +530,10 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
*ab_area= 1.0; *ab_area= 1.0;
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
/* Handle NULL part */ uint32 keyseg_length;
if (keyseg->null_bit)
{ if (keyseg->null_bit) /* Handle NULL part */
return -1; return -1;
}
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
...@@ -572,7 +579,7 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -572,7 +579,7 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
default: default:
return -1; return -1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
b+= keyseg_length; b+= keyseg_length;
...@@ -613,11 +620,10 @@ double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -613,11 +620,10 @@ double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
*ab_perim= 0.0; *ab_perim= 0.0;
for (; (int)key_length > 0; keyseg += 2) for (; (int)key_length > 0; keyseg += 2)
{ {
/* Handle NULL part */ uint32 keyseg_length;
if (keyseg->null_bit)
{ if (keyseg->null_bit) /* Handle NULL part */
return -1; return -1;
}
switch ((enum ha_base_keytype) keyseg->type) { switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
...@@ -663,7 +669,7 @@ double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b, ...@@ -663,7 +669,7 @@ double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
default: default:
return -1; return -1;
} }
uint32 keyseg_length= keyseg->length * 2; keyseg_length= keyseg->length * 2;
key_length-= keyseg_length; key_length-= keyseg_length;
a+= keyseg_length; a+= keyseg_length;
b+= keyseg_length; b+= keyseg_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment