Portability fixes for Windows

This commit is contained in:
monty@mysql.com 2003-12-08 12:25:37 +02:00
commit e8aef44349
38 changed files with 193 additions and 149 deletions

View file

@ -6183,16 +6183,16 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if(wc<0x80)
if ((int) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if(!(code=func_uni_big5_onechar(wc)))
if (!(code=func_uni_big5_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
s[0]=code>>8;
@ -6201,6 +6201,7 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc,const uchar *s,const uchar *e)
@ -6211,16 +6212,16 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1])))
if (!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1])))
return MY_CS_ILSEQ;
return 2;

View file

@ -8591,9 +8591,9 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}

View file

@ -5641,16 +5641,16 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if (!(code=func_uni_gb2312_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
code|=0x8080;
@ -5659,26 +5659,27 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
int hi;
hi=s[0];
hi=(int) s[0];
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F)))
if (!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F)))
return MY_CS_ILSEQ;
return 2;

View file

@ -9837,9 +9837,9 @@ my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}

View file

@ -4428,16 +4428,16 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if(wc<0x80)
if ((int) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if(!(code=func_uni_sjis_onechar(wc)))
if (!(code=func_uni_sjis_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
s[0]=code>>8;
@ -4445,6 +4445,7 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
@ -4453,16 +4454,16 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1])))
if (!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1])))
return MY_CS_ILSEQ;
return 2;
@ -4481,6 +4482,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_hash_sort_simple,
};
static MY_CHARSET_HANDLER my_charset_handler=
{
ismbchar_sjis,

View file

@ -106,8 +106,8 @@ static int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
if ( r+2 > e )
return MY_CS_TOOSMALL;
r[0]=wc >> 8;
r[1]=wc & 0xFF;
r[0]= (uchar) (wc >> 8);
r[1]= (uchar) (wc & 0xFF);
return 2;
}
@ -862,7 +862,7 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)),
s+=cnv;
if (wc > (int) (uchar) 'e' || !wc)
break; /* Can't be part of double */
*b++=wc;
*b++= (char) wc;
}
*b= 0;

View file

@ -252,25 +252,25 @@ my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)),
uchar *e __attribute__((unused)))
{
if (wc <= 0x7D)
if ((int) wc <= 0x7D)
{
*s = wc;
*s = (uchar) wc;
return (wc == 0x5C) ? MY_CS_ILUNI : 1;
}
if (wc >= 0xFF61 && wc <= 0xFF9F)
{
*s = (wc - 0xFEC0);
*s = (uchar) (wc - 0xFEC0);
return 1;
}
if (wc==0x00A5)
if (wc == 0x00A5)
{
*s = 0x5C;
return 1;
}
if (wc==0x203E)
if (wc == 0x203E)
{
*s = 0x7E;
return 1;
@ -8349,12 +8349,12 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((int) wc < 0x80)
{
if (s>e)
return MY_CS_TOOSMALL;
*s=wc;
*s= (uchar) wc;
return 1;
}