Commit 3d41d577 authored by serg@serg.mylan's avatar serg@serg.mylan

crash BUG#1116 fixed

parent 071ec768
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "m_ctype.h" #include "m_ctype.h"
#include "t_ctype.h" #include "t_ctype.h"
static uchar* thai2sortable(const uchar *tstr,uint len); static uchar* thai2sortable(const uchar *tstr,int len);
#define BUFFER_MULTIPLY 4 #define BUFFER_MULTIPLY 4
#define buffsize(s) (BUFFER_MULTIPLY * (strlen(s) + 1)) #define buffsize(s) (BUFFER_MULTIPLY * (strlen(s) + 1))
...@@ -456,7 +456,7 @@ uchar NEAR sort_order_tis620[]= ...@@ -456,7 +456,7 @@ uchar NEAR sort_order_tis620[]=
/* /*
NOTE: isn't it faster to alloc buffer in calling function? NOTE: isn't it faster to alloc buffer in calling function?
*/ */
static uchar* thai2sortable(const uchar * tstr,uint len) static uchar* thai2sortable(const uchar * tstr,int len)
{ {
/* We use only 3 levels (neglect capitalization). */ /* We use only 3 levels (neglect capitalization). */
...@@ -467,7 +467,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -467,7 +467,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
uint bufSize; uint bufSize;
uint RightSize; uint RightSize;
len= (uint) strnlen((char*) tstr,len); len= (int) strnlen((char*) tstr,len);
bufSize= (uint) buffsize((char*) tstr); bufSize= (uint) buffsize((char*) tstr);
RightSize= sizeof(uchar) * (len + 1); RightSize= sizeof(uchar) * (len + 1);
if (!(outBuf= pLeft1= pRight1= if (!(outBuf= pLeft1= pRight1=
...@@ -476,7 +476,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -476,7 +476,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
pLeft2= pRight2= pRight1 + sizeof(uchar) * bufSize; pLeft2= pRight2= pRight1 + sizeof(uchar) * bufSize;
pLeft3= pRight3= pRight2 + RightSize; pLeft3= pRight3= pRight2 + RightSize;
while (--len) while (--len > 0)
{ {
int *t_ctype0= t_ctype[p[0]]; int *t_ctype0= t_ctype[p[0]];
if (isldvowel(*p) && isconsnt(p[1])) if (isldvowel(*p) && isconsnt(p[1]))
...@@ -567,8 +567,8 @@ int my_strcoll_tis620(const uchar * s1, const uchar * s2) ...@@ -567,8 +567,8 @@ int my_strcoll_tis620(const uchar * s1, const uchar * s2)
{ {
uchar *tc1, *tc2; uchar *tc1, *tc2;
int i; int i;
tc1= thai2sortable(s1, (uint) strlen((char*)s1)); tc1= thai2sortable(s1, (int) strlen((char*)s1));
tc2= thai2sortable(s2, (uint) strlen((char*)s2)); tc2= thai2sortable(s2, (int) strlen((char*)s2));
i= strcmp((char*)tc1, (char*)tc2); i= strcmp((char*)tc1, (char*)tc2);
free(tc1); free(tc1);
free(tc2); free(tc2);
......
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