8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

WCHAR --> UCS2_CHAR and some cleanup around it

This commit is contained in:
aafemt 2003-02-18 05:24:35 +00:00
parent db6ecc1034
commit 2dadf55537
20 changed files with 280 additions and 296 deletions

View File

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.117 2003-02-13 22:49:17 bellardo Exp $ dnl $Id: configure.in,v 1.118 2003-02-18 05:24:31 aafemt Exp $
dnl ############################# INITIALISATION ############################### dnl ############################# INITIALISATION ###############################
@ -345,6 +345,7 @@ AC_SEARCH_LIBS(dirname,gen)
AC_CHECK_FUNCS(dirname) AC_CHECK_FUNCS(dirname)
AC_CHECK_FUNCS(sigaction setitimer) AC_CHECK_FUNCS(sigaction setitimer)
AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(swab _swab)
AC_FUNC_MMAP AC_FUNC_MMAP
AC_CHECK_FUNCS(atexit on_exit) AC_CHECK_FUNCS(atexit on_exit)
AC_FUNC_FORK AC_FUNC_FORK

View File

@ -126,6 +126,8 @@
#undef HAVE_SIGACTION #undef HAVE_SIGACTION
#undef HAVE_SETITIMER #undef HAVE_SETITIMER
#define HAVE_SNPRINTF #define HAVE_SNPRINTF
#define HAVE_SWAB
#define HAVE__SWAB
#undef HAVE_MMAP #undef HAVE_MMAP
#undef HAVE_ATEXIT #undef HAVE_ATEXIT
#undef HAVE_ON_EXIT #undef HAVE_ON_EXIT

View File

@ -34,7 +34,7 @@ extern USHORT CVJIS_unicode_to_eucj();
CHARSET_ENTRY(CS_jis_0208_1990) CHARSET_ENTRY(CS_jis_0208_1990)
{ {
static const WCHAR space = 0x0020; static const UCS2_CHAR space = 0x0020;
#include "../intl/charsets/cs_jis_0208_1990.h" #include "../intl/charsets/cs_jis_0208_1990.h"

View File

@ -58,7 +58,7 @@ CHARSET_ENTRY(CS_unicode_fss)
SSHORT CS_UTFFSS_fss_mbtowc(obj, wc, p, n) SSHORT CS_UTFFSS_fss_mbtowc(obj, wc, p, n)
TEXTTYPE *obj; TEXTTYPE *obj;
WCHAR *wc; UCS2_CHAR *wc;
NCHAR *p; NCHAR *p;
USHORT n; USHORT n;
{ {

View File

@ -31,7 +31,7 @@ extern USHORT CV_wc_copy();
CHARSET_ENTRY(CS_unicode_ucs2) CHARSET_ENTRY(CS_unicode_ucs2)
{ {
static const WCHAR space = 0x0020; static const UCS2_CHAR space = 0x0020;
csptr->charset_version = 40; csptr->charset_version = 40;
csptr->charset_id = CS_UNICODE_UCS2; csptr->charset_id = CS_UNICODE_UCS2;

View File

@ -35,16 +35,16 @@
USHORT CVBIG5_big5_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len, USHORT CVBIG5_big5_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
err_code, err_position) err_code, err_position)
CSCONVERT obj; CSCONVERT obj;
USHORT *dest_ptr; UCS2_CHAR *dest_ptr;
USHORT dest_len; USHORT dest_len;
UCHAR *src_ptr; UCHAR *src_ptr;
USHORT src_len; USHORT src_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
USHORT *start; UCS2_CHAR *start;
WCHAR ch; UCS2_CHAR ch;
WCHAR wide; UCS2_CHAR wide;
USHORT src_start = src_len; USHORT src_start = src_len;
USHORT this_len; USHORT this_len;
UCHAR c1, c2; UCHAR c1, c2;
@ -61,10 +61,9 @@ USHORT CVBIG5_big5_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
/* See if we're only after a length estimate */ /* See if we're only after a length estimate */
if (dest_ptr == NULL) if (dest_ptr == NULL)
return (src_len * 2); return (src_len * sizeof(UCS2_CHAR));
start = dest_ptr; start = dest_ptr;
src_start = src_len;
while ((src_len) && (dest_len > 1)) { while ((src_len) && (dest_len > 1)) {
if (*src_ptr & 0x80) { if (*src_ptr & 0x80) {
c1 = *src_ptr++; c1 = *src_ptr++;
@ -104,7 +103,7 @@ USHORT CVBIG5_big5_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
} }
*dest_ptr++ = ch; *dest_ptr++ = ch;
dest_len -= 2; dest_len -= sizeof(UCS2_CHAR);
src_len -= this_len; src_len -= this_len;
}; };
if (src_len && !*err_code) { if (src_len && !*err_code) {
@ -120,14 +119,14 @@ USHORT CVBIG5_unicode_to_big5(obj, big5_str, big5_len, unicode_str,
CSCONVERT obj; CSCONVERT obj;
UCHAR *big5_str; UCHAR *big5_str;
USHORT big5_len; USHORT big5_len;
USHORT *unicode_str; UCS2_CHAR *unicode_str;
USHORT unicode_len; USHORT unicode_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
UCHAR *start; UCHAR *start;
WCHAR big5_ch; UCS2_CHAR big5_ch;
WCHAR wide; UCS2_CHAR wide;
int tmp1, tmp2; int tmp1, tmp2;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
@ -150,14 +149,10 @@ USHORT CVBIG5_unicode_to_big5(obj, big5_str, big5_len, unicode_str,
/* Convert from UNICODE to BIG5 code */ /* Convert from UNICODE to BIG5 code */
wide = *unicode_str++; wide = *unicode_str++;
big5_ch = ((USHORT *) obj->csconvert_datatable)[ big5_ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide/256]
(USHORT) +(wide % 256)];
wide
/
256]
+ (wide % 256)];
if ((big5_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((big5_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
*err_code = CS_CONVERT_ERROR; *err_code = CS_CONVERT_ERROR;
break; break;
@ -286,7 +281,7 @@ USHORT CVBIG5_big5_byte2short(obj, dst, dst_len, src, src_len, err_code,
SSHORT CVBIG5_big5_mbtowc(obj, wc, src, src_len) SSHORT CVBIG5_big5_mbtowc(obj, wc, src, src_len)
CSCONVERT obj; CSCONVERT obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *src; UCHAR *src;
USHORT src_len; USHORT src_len;
{ {

View File

@ -35,16 +35,16 @@
USHORT CVGB_gb2312_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len, USHORT CVGB_gb2312_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
err_code, err_position) err_code, err_position)
CSCONVERT obj; CSCONVERT obj;
USHORT *dest_ptr; UCS2_CHAR *dest_ptr;
USHORT dest_len; USHORT dest_len;
UCHAR *src_ptr; UCHAR *src_ptr;
USHORT src_len; USHORT src_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
USHORT *start; UCS2_CHAR *start;
WCHAR ch; UCS2_CHAR ch;
WCHAR wide; UCS2_CHAR wide;
USHORT src_start = src_len; USHORT src_start = src_len;
USHORT this_len; USHORT this_len;
UCHAR c1, c2; UCHAR c1, c2;
@ -61,10 +61,9 @@ USHORT CVGB_gb2312_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
/* See if we're only after a length estimate */ /* See if we're only after a length estimate */
if (dest_ptr == NULL) if (dest_ptr == NULL)
return (src_len * 2); return (src_len * sizeof(UCS2_CHAR));
start = dest_ptr; start = dest_ptr;
src_start = src_len;
while ((src_len) && (dest_len > 1)) { while ((src_len) && (dest_len > 1)) {
if (*src_ptr & 0x80) { if (*src_ptr & 0x80) {
c1 = *src_ptr++; c1 = *src_ptr++;
@ -104,7 +103,7 @@ USHORT CVGB_gb2312_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
} }
*dest_ptr++ = ch; *dest_ptr++ = ch;
dest_len -= 2; dest_len -= sizeof(*dest_ptr);
src_len -= this_len; src_len -= this_len;
}; };
if (src_len && !*err_code) { if (src_len && !*err_code) {
@ -120,14 +119,14 @@ USHORT CVGB_unicode_to_gb2312(obj, gb_str, gb_len, unicode_str, unicode_len,
CSCONVERT obj; CSCONVERT obj;
UCHAR *gb_str; UCHAR *gb_str;
USHORT gb_len; USHORT gb_len;
USHORT *unicode_str; UCS2_CHAR *unicode_str;
USHORT unicode_len; USHORT unicode_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
UCHAR *start; UCHAR *start;
WCHAR gb_ch; UCS2_CHAR gb_ch;
WCHAR wide; UCS2_CHAR wide;
int tmp1, tmp2; int tmp1, tmp2;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
@ -150,13 +149,10 @@ USHORT CVGB_unicode_to_gb2312(obj, gb_str, gb_len, unicode_str, unicode_len,
/* Convert from UNICODE to GB2312 code */ /* Convert from UNICODE to GB2312 code */
wide = *unicode_str++; wide = *unicode_str++;
gb_ch = ((USHORT *) obj->csconvert_datatable)[ gb_ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide / 256]
(USHORT) + (wide % 256)];
wide /
256] +
(wide % 256)];
if ((gb_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((gb_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
*err_code = CS_CONVERT_ERROR; *err_code = CS_CONVERT_ERROR;
break; break;
@ -285,7 +281,7 @@ USHORT CVGB_gb2312_byte2short(obj, dst, dst_len, src, src_len, err_code,
SSHORT CVGB_gb2312_mbtowc(obj, wc, src, src_len) SSHORT CVGB_gb2312_mbtowc(obj, wc, src, src_len)
CSCONVERT obj; CSCONVERT obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *src; UCHAR *src;
USHORT src_len; USHORT src_len;
{ {

View File

@ -30,16 +30,16 @@
USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len, USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
err_code, err_position) err_code, err_position)
CSCONVERT obj; CSCONVERT obj;
USHORT *dest_ptr; UCS2_CHAR *dest_ptr;
USHORT dest_len; USHORT dest_len;
UCHAR *src_ptr; UCHAR *src_ptr;
USHORT src_len; USHORT src_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
USHORT *start; UCS2_CHAR *start;
WCHAR ch; UCS2_CHAR ch;
WCHAR wide; UCS2_CHAR wide;
UCHAR ch1; UCHAR ch1;
USHORT src_start = src_len; USHORT src_start = src_len;
USHORT this_len; USHORT this_len;
@ -59,7 +59,6 @@ USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
return (src_len); return (src_len);
start = dest_ptr; start = dest_ptr;
src_start = src_len;
while ((src_len) && (dest_len > 1)) { while ((src_len) && (dest_len > 1)) {
ch1 = *src_ptr++; ch1 = *src_ptr++;
@ -83,13 +82,10 @@ USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
this_len = 2; this_len = 2;
/* Step 2: Convert from JIS to UNICODE */ /* Step 2: Convert from JIS to UNICODE */
ch = ((USHORT *) obj->csconvert_datatable)[ ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide / 256]
(USHORT) + (wide % 256)];
wide /
256] +
(wide % 256)];
}; };
@ -98,7 +94,7 @@ USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
*/ */
*dest_ptr++ = ch; *dest_ptr++ = ch;
dest_len -= 2; dest_len -= sizeof(*dest_ptr);
src_len -= this_len; src_len -= this_len;
}; };
if (src_len && !*err_code) { if (src_len && !*err_code) {
@ -127,16 +123,16 @@ USHORT CVJIS_eucj_to_unicode(obj, dest_ptr, dest_len, src_ptr, src_len,
USHORT CVJIS_sjis_to_unicode(obj, dest_ptr, dest_len, sjis_str, sjis_len, USHORT CVJIS_sjis_to_unicode(obj, dest_ptr, dest_len, sjis_str, sjis_len,
err_code, err_position) err_code, err_position)
CSCONVERT obj; CSCONVERT obj;
USHORT *dest_ptr; UCS2_CHAR *dest_ptr;
USHORT dest_len; USHORT dest_len;
UCHAR *sjis_str; UCHAR *sjis_str;
USHORT sjis_len; USHORT sjis_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
USHORT *start; UCS2_CHAR *start;
WCHAR ch; UCS2_CHAR ch;
WCHAR wide; UCS2_CHAR wide;
UCHAR c1, c2; UCHAR c1, c2;
UCHAR tmp1, tmp2; UCHAR tmp1, tmp2;
USHORT src_start = sjis_len; USHORT src_start = sjis_len;
@ -201,20 +197,15 @@ USHORT CVJIS_sjis_to_unicode(obj, dest_ptr, dest_len, sjis_str, sjis_len,
/* Step 2: Convert from JIS code (in wide) to UNICODE */ /* Step 2: Convert from JIS code (in wide) to UNICODE */
if (table == 1) if (table == 1)
ch = ((USHORT *) obj->csconvert_datatable)[ ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide / 256]
(USHORT) + (wide % 256)];
wide /
256] +
(wide % 256)];
else { else {
assert(table == 2); assert(table == 2);
assert(wide <= 255); assert(wide <= 255);
ch = ch = sjis_to_unicode_mapping_array
sjis_to_unicode_mapping_array[sjis_to_unicode_map [sjis_to_unicode_map[(USHORT) wide / 256] + (wide % 256)];
[(USHORT) wide / 256]
+ (wide % 256)];
}; };
/* This is only important for bad-SJIS in input stream */ /* This is only important for bad-SJIS in input stream */
@ -223,7 +214,7 @@ USHORT CVJIS_sjis_to_unicode(obj, dest_ptr, dest_len, sjis_str, sjis_len,
break; break;
}; };
*dest_ptr++ = ch; *dest_ptr++ = ch;
dest_len -= 2; dest_len -= sizeof(*dest_ptr);
sjis_len -= this_len; sjis_len -= this_len;
} }
if (sjis_len && !*err_code) { if (sjis_len && !*err_code) {
@ -396,14 +387,14 @@ USHORT CVJIS_unicode_to_sjis(obj, sjis_str, sjis_len, unicode_str,
CSCONVERT obj; CSCONVERT obj;
UCHAR *sjis_str; UCHAR *sjis_str;
USHORT sjis_len; USHORT sjis_len;
USHORT *unicode_str; UCS2_CHAR *unicode_str;
USHORT unicode_len; USHORT unicode_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
UCHAR *start; UCHAR *start;
WCHAR jis_ch; UCS2_CHAR jis_ch;
WCHAR wide; UCS2_CHAR wide;
USHORT tmp1, tmp2; USHORT tmp1, tmp2;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
@ -426,21 +417,16 @@ USHORT CVJIS_unicode_to_sjis(obj, sjis_str, sjis_len, unicode_str,
/* Step 1: Convert from UNICODE to JIS code */ /* Step 1: Convert from UNICODE to JIS code */
wide = *unicode_str++; wide = *unicode_str++;
jis_ch = ((USHORT *) obj->csconvert_datatable)[ jis_ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide / 256]
(USHORT) + (wide % 256)];
wide /
256] +
(wide % 256)];
if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
/* Handle the non-JIS codes in SJIS (ASCII & half-width Kana) */ /* Handle the non-JIS codes in SJIS (ASCII & half-width Kana) */
jis_ch = jis_ch = sjis_from_unicode_mapping_array
sjis_from_unicode_mapping_array[sjis_from_unicode_map [sjis_from_unicode_map[(USHORT) wide / 256] + (wide % 256)];
[(USHORT) wide / 256]
+ (wide % 256)];
if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
*err_code = CS_CONVERT_ERROR; *err_code = CS_CONVERT_ERROR;
break; break;
@ -489,14 +475,14 @@ USHORT CVJIS_unicode_to_eucj(obj, eucj_str, eucj_len, unicode_str,
CSCONVERT obj; CSCONVERT obj;
UCHAR *eucj_str; UCHAR *eucj_str;
USHORT eucj_len; USHORT eucj_len;
USHORT *unicode_str; UCS2_CHAR *unicode_str;
USHORT unicode_len; USHORT unicode_len;
SSHORT *err_code; SSHORT *err_code;
USHORT *err_position; USHORT *err_position;
{ {
UCHAR *start; UCHAR *start;
WCHAR jis_ch; UCS2_CHAR jis_ch;
WCHAR wide; UCS2_CHAR wide;
USHORT tmp1, tmp2; USHORT tmp1, tmp2;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
@ -523,14 +509,10 @@ USHORT CVJIS_unicode_to_eucj(obj, eucj_str, eucj_len, unicode_str,
if (wide <= 0x007F) if (wide <= 0x007F)
jis_ch = wide; jis_ch = wide;
else else
jis_ch = ((USHORT *) obj->csconvert_datatable)[ jis_ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [(USHORT)wide / 256]
(USHORT) + (wide % 256)];
wide
/
256]
+ (wide % 256)];
if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((jis_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
*err_code = CS_CONVERT_ERROR; *err_code = CS_CONVERT_ERROR;
break; break;
@ -812,7 +794,7 @@ USHORT CVJIS_euc_byte2short(obj, dst, dst_len, src, src_len, err_code,
SSHORT CVJIS_euc_mbtowc(obj, wc, src, src_len) SSHORT CVJIS_euc_mbtowc(obj, wc, src, src_len)
CSCONVERT obj; CSCONVERT obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *src; UCHAR *src;
USHORT src_len; USHORT src_len;
{ {
@ -1002,7 +984,7 @@ USHORT CVJIS_sjis_byte2short(obj, dst, dst_len, src, src_len, err_code,
SSHORT CVJIS_sjis_mbtowc(obj, wc, src, src_len) SSHORT CVJIS_sjis_mbtowc(obj, wc, src, src_len)
CSCONVERT obj; CSCONVERT obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *src; UCHAR *src;
USHORT src_len; USHORT src_len;
{ {

View File

@ -41,16 +41,16 @@
USHORT CVKSC_ksc_to_unicode(obj, dest_ptr, dest_len, ksc_str, ksc_len, USHORT CVKSC_ksc_to_unicode(obj, dest_ptr, dest_len, ksc_str, ksc_len,
err_code, err_position) err_code, err_position)
CSCONVERT obj; CSCONVERT obj;
USHORT *dest_ptr; UCS2_CHAR *dest_ptr;
USHORT dest_len; USHORT dest_len;
UCHAR *ksc_str; UCHAR *ksc_str;
USHORT ksc_len; USHORT ksc_len;
short *err_code; short *err_code;
USHORT *err_position; USHORT *err_position;
{ {
USHORT *start; UCS2_CHAR *start;
WCHAR ch; UCS2_CHAR ch;
WCHAR wide; UCS2_CHAR wide;
UCHAR c1, c2; UCHAR c1, c2;
USHORT src_start = ksc_len; USHORT src_start = ksc_len;
USHORT this_len; USHORT this_len;
@ -66,7 +66,7 @@ USHORT CVKSC_ksc_to_unicode(obj, dest_ptr, dest_len, ksc_str, ksc_len,
*err_code = 0; *err_code = 0;
if (dest_ptr == NULL) if (dest_ptr == NULL)
return (ksc_len * 2); return (ksc_len * sizeof(UCS2_CHAR));
start = dest_ptr; start = dest_ptr;
while (ksc_len && dest_len > 1) { while (ksc_len && dest_len > 1) {
@ -106,7 +106,7 @@ USHORT CVKSC_ksc_to_unicode(obj, dest_ptr, dest_len, ksc_str, ksc_len,
break; break;
} }
*dest_ptr++ = ch; *dest_ptr++ = ch;
dest_len -= 2; dest_len -= sizeof(*dest_ptr);
ksc_len -= this_len; ksc_len -= this_len;
} }
@ -122,14 +122,14 @@ USHORT CVKSC_unicode_to_ksc(obj, ksc_str, ksc_len, unicode_str, unicode_len,
CSCONVERT obj; CSCONVERT obj;
UCHAR *ksc_str; UCHAR *ksc_str;
USHORT ksc_len; USHORT ksc_len;
USHORT *unicode_str; UCS2_CHAR *unicode_str;
USHORT unicode_len; USHORT unicode_len;
short *err_code; short *err_code;
USHORT *err_position; USHORT *err_position;
{ {
UCHAR *start; UCHAR *start;
WCHAR ksc_ch; UCS2_CHAR ksc_ch;
WCHAR wide; UCS2_CHAR wide;
int tmp1, tmp2; int tmp1, tmp2;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
@ -150,13 +150,9 @@ USHORT CVKSC_unicode_to_ksc(obj, ksc_str, ksc_len, unicode_str, unicode_len,
while (ksc_len && unicode_len > 1) { while (ksc_len && unicode_len > 1) {
wide = *unicode_str++; wide = *unicode_str++;
ksc_ch = ((USHORT *) obj->csconvert_datatable)[ ksc_ch = ((USHORT *) obj->csconvert_datatable)
((USHORT *) obj-> [((USHORT *) obj->csconvert_misc)
csconvert_misc)[ [wide / 256] + (wide % 256)];
(USHORT)
wide /
256] +
(wide % 256)];
if ((ksc_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) { if ((ksc_ch == CS_CANT_MAP) && !(wide == CS_CANT_MAP)) {
*err_code = CS_CONVERT_ERROR; *err_code = CS_CONVERT_ERROR;
break; break;
@ -283,7 +279,7 @@ USHORT CVKSC_ksc_byte2short(obj, dst, dst_len, src, src_len, err_code,
short CVKSC_ksc_mbtowc(obj, wc, src, src_len) short CVKSC_ksc_mbtowc(obj, wc, src, src_len)
CSCONVERT obj; CSCONVERT obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *src; UCHAR *src;
USHORT src_len; USHORT src_len;
{ {

View File

@ -93,10 +93,10 @@ TEXTTYPE_ENTRY(BIG5_init)
*/ */
STATIC USHORT big5_to_upper(obj, ch) STATIC USHORT big5_to_upper(obj, ch)
TEXTTYPE obj; TEXTTYPE obj;
WCHAR ch; UCS2_CHAR ch;
{ {
if (ch >= (WCHAR) ASCII_LOWER_A && ch <= (WCHAR) ASCII_LOWER_Z) if (ch >= (UCS2_CHAR) ASCII_LOWER_A && ch <= (UCS2_CHAR) ASCII_LOWER_Z)
return (ch - (WCHAR) ASCII_LOWER_A + (WCHAR) ASCII_UPPER_A); return (ch - (UCS2_CHAR) ASCII_LOWER_A + (UCS2_CHAR) ASCII_UPPER_A);
return ch; return ch;
} }
@ -151,9 +151,9 @@ STATIC SSHORT big5_str_to_upper(obj, iLen, pStr, iOutLen, pOutStr)
*/ */
STATIC USHORT big5_to_lower(obj, ch) STATIC USHORT big5_to_lower(obj, ch)
TEXTTYPE obj; TEXTTYPE obj;
WCHAR ch; UCS2_CHAR ch;
{ {
if (ch >= (WCHAR) ASCII_UPPER_A && ch <= (WCHAR) ASCII_UPPER_Z) if (ch >= (UCS2_CHAR) ASCII_UPPER_A && ch <= (UCS2_CHAR) ASCII_UPPER_Z)
return (ch - (WCHAR) ASCII_UPPER_A + (WCHAR) ASCII_LOWER_A); return (ch - (UCS2_CHAR) ASCII_UPPER_A + (UCS2_CHAR) ASCII_LOWER_A);
return ch; return ch;
} }

View File

@ -657,7 +657,7 @@ STATIC USHORT fam1_to_lower(obj, ch)
SSHORT LC_DOS_nc_mbtowc(obj, wc, ptr, count) SSHORT LC_DOS_nc_mbtowc(obj, wc, ptr, count)
TEXTTYPE obj; TEXTTYPE obj;
WCHAR *wc; UCS2_CHAR *wc;
UCHAR *ptr; UCHAR *ptr;
USHORT count; USHORT count;
{ {

View File

@ -112,10 +112,10 @@ TEXTTYPE_ENTRY(JIS230_init)
*/ */
STATIC USHORT sjis_to_upper(obj, ch) STATIC USHORT sjis_to_upper(obj, ch)
TEXTTYPE obj; TEXTTYPE obj;
WCHAR ch; UCS2_CHAR ch;
{ {
if (ch >= (WCHAR) ASCII_LOWER_A && ch <= (WCHAR) ASCII_LOWER_Z) if (ch >= (UCS2_CHAR) ASCII_LOWER_A && ch <= (UCS2_CHAR) ASCII_LOWER_Z)
return (ch - (WCHAR) ASCII_LOWER_A + (WCHAR) ASCII_UPPER_A); return (ch - (UCS2_CHAR) ASCII_LOWER_A + (UCS2_CHAR) ASCII_UPPER_A);
return ch; return ch;
} }
@ -170,9 +170,9 @@ STATIC SSHORT sjis_str_to_upper(obj, iLen, pStr, iOutLen, pOutStr)
*/ */
STATIC USHORT sjis_to_lower(obj, ch) STATIC USHORT sjis_to_lower(obj, ch)
TEXTTYPE obj; TEXTTYPE obj;
WCHAR ch; UCS2_CHAR ch;
{ {
if (ch >= (WCHAR) ASCII_UPPER_A && ch <= (WCHAR) ASCII_UPPER_Z) if (ch >= (UCS2_CHAR) ASCII_UPPER_A && ch <= (UCS2_CHAR) ASCII_UPPER_Z)
return (ch - (WCHAR) ASCII_UPPER_A + (WCHAR) ASCII_LOWER_A); return (ch - (UCS2_CHAR) ASCII_UPPER_A + (UCS2_CHAR) ASCII_LOWER_A);
return ch; return ch;
} }

View File

@ -105,7 +105,7 @@ TEXTTYPE_ENTRY(UNI201_init)
static SSHORT wc_mbtowc(obj, wc, p, n) static SSHORT wc_mbtowc(obj, wc, p, n)
TEXTTYPE *obj; TEXTTYPE *obj;
WCHAR *wc; UCS2_CHAR *wc;
NCHAR *p; NCHAR *p;
USHORT n; USHORT n;
{ {
@ -113,10 +113,10 @@ static SSHORT wc_mbtowc(obj, wc, p, n)
assert(wc); assert(wc);
assert(p); assert(p);
if (n < sizeof(WCHAR)) if (n < sizeof(UCS2_CHAR))
return -1; return -1;
*wc = *(WCHAR *) p; *wc = *(UCS2_CHAR *) p;
return sizeof(WCHAR); return sizeof(UCS2_CHAR);
} }

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.31 2003-02-16 16:55:57 alexpeshkoff Exp $ * $Id: evl.cpp,v 1.32 2003-02-18 05:24:34 aafemt Exp $
*/ */
/* /*
@ -160,12 +160,12 @@ static SSHORT sleuth(TDBB, JRD_NOD, DSC *, DSC *);
static BOOLEAN nc_sleuth_check(class TextType*, USHORT, UCHAR *, UCHAR *, UCHAR *, static BOOLEAN nc_sleuth_check(class TextType*, USHORT, UCHAR *, UCHAR *, UCHAR *,
UCHAR *); UCHAR *);
static BOOLEAN nc_sleuth_class(class TextType*, USHORT, UCHAR *, UCHAR *, UCHAR); static BOOLEAN nc_sleuth_class(class TextType*, USHORT, UCHAR *, UCHAR *, UCHAR);
static BOOLEAN wc_sleuth_check(class TextType*, USHORT, WCHAR *, WCHAR *, WCHAR *, static BOOLEAN wc_sleuth_check(class TextType*, USHORT, UCS2_CHAR *, UCS2_CHAR *,
WCHAR *); UCS2_CHAR *, UCS2_CHAR *);
static BOOLEAN wc_sleuth_class(class TextType*, USHORT, WCHAR *, WCHAR *, WCHAR); static BOOLEAN wc_sleuth_class(class TextType*, USHORT, UCS2_CHAR *, UCS2_CHAR *,
UCS2_CHAR);
static SSHORT string_boolean(TDBB, JRD_NOD, DSC *, DSC *); static SSHORT string_boolean(TDBB, JRD_NOD, DSC *, DSC *);
static SSHORT string_function(TDBB, JRD_NOD, SSHORT, UCHAR *, static SSHORT string_function(TDBB, JRD_NOD, SSHORT, UCHAR *, SSHORT, UCHAR *, USHORT);
SSHORT, UCHAR *, USHORT);
static DSC *substring(TDBB, VLU, DSC *, USHORT, USHORT); static DSC *substring(TDBB, VLU, DSC *, USHORT, USHORT);
static DSC *upcase(TDBB, DSC *, VLU); static DSC *upcase(TDBB, DSC *, VLU);
static DSC *internal_info(TDBB, DSC *, VLU); static DSC *internal_info(TDBB, DSC *, VLU);
@ -1869,9 +1869,9 @@ USHORT DLL_EXPORT EVL_mb_contains(TDBB tdbb,
* Functional description * Functional description
* *
**************************************/ **************************************/
USHORT buffer1[100], buffer2[100]; /* arbitrary size for optimization */ UCS2_CHAR buffer1[100], buffer2[100]; /* arbitrary size for optimization */
USHORT *pp1 = buffer1; UCS2_CHAR *pp1 = buffer1;
USHORT *pp2 = buffer2; UCS2_CHAR *pp2 = buffer2;
USHORT len1, len2; /* byte counts */ USHORT len1, len2; /* byte counts */
STR buf1, buf2; STR buf1, buf2;
USHORT ret_val; USHORT ret_val;
@ -1885,15 +1885,15 @@ USHORT DLL_EXPORT EVL_mb_contains(TDBB tdbb,
if (len1 > sizeof(buffer1)) { if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str(); buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data; pp1 = (UCS2_CHAR *) buf1->str_data;
} }
if (len2 > sizeof(buffer2)) { if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str(); buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data; pp2 = (UCS2_CHAR *) buf2->str_data;
} }
len1 = obj->to_wc((unsigned char*)pp1, len1, p1, l1, &err_code, &err_pos); len1 = obj->to_wc(pp1, len1, p1, l1, &err_code, &err_pos);
len2 = obj->to_wc((unsigned char*)pp2, len2, p2, l2, &err_code, &err_pos); len2 = obj->to_wc(pp2, len2, p2, l2, &err_code, &err_pos);
ret_val = EVL_wc_contains(tdbb, obj, pp1, len1, pp2, len2); ret_val = EVL_wc_contains(tdbb, obj, pp1, len1, pp2, len2);
@ -1910,7 +1910,7 @@ USHORT DLL_EXPORT EVL_mb_like(TDBB tdbb,
class TextType* obj, class TextType* obj,
UCHAR * p1, UCHAR * p1,
SSHORT l1, SSHORT l1,
UCHAR * p2, SSHORT l2, WCHAR escape_char) UCHAR * p2, SSHORT l2, UCS2_CHAR escape_char)
{ {
/************************************** /**************************************
* *
@ -1923,13 +1923,13 @@ USHORT DLL_EXPORT EVL_mb_like(TDBB tdbb,
* Front-end of like() in Japanese version. * Front-end of like() in Japanese version.
* *
* Prepare buffer of short, then "copy" char-based data * Prepare buffer of short, then "copy" char-based data
* into the new short-based buffer. Use the new buffer for * into the new ucs2-based buffer. Use the new buffer for
* later processing with wc_like(). * later processing with wc_like().
* *
**************************************/ **************************************/
USHORT buffer1[100], buffer2[100]; /* arbitrary size for optimization */ UCS2_CHAR buffer1[100], buffer2[100]; /* arbitrary size for optimization */
USHORT *pp1 = buffer1; UCS2_CHAR *pp1 = buffer1;
USHORT *pp2 = buffer2; UCS2_CHAR *pp2 = buffer2;
USHORT len1, len2; USHORT len1, len2;
STR buf1, buf2; STR buf1, buf2;
USHORT ret_val; USHORT ret_val;
@ -1942,15 +1942,16 @@ USHORT DLL_EXPORT EVL_mb_like(TDBB tdbb,
len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos); len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) { if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str(); buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data; pp1 = (UCS2_CHAR *) buf1->str_data;
} }
if (len2 > sizeof(buffer2)) { if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str(); buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data; pp2 = (UCS2_CHAR *) buf2->str_data;
} }
len1 = obj->to_wc((unsigned char*)pp1, len1, p1, l1, &err_code, &err_pos); len1 = obj->to_wc(pp1, len1, p1, l1, &err_code, &err_pos);
len2 = obj->to_wc((unsigned char*)pp2, len2, p2, l2, &err_code, &err_pos); len2 = obj->to_wc(pp2, len2, p2, l2, &err_code, &err_pos);
// CHECK ME: Shouldn't errors to be handled?
ret_val = EVL_wc_like(tdbb, obj, pp1, len1, pp2, len2, escape_char); ret_val = EVL_wc_like(tdbb, obj, pp1, len1, pp2, len2, escape_char);
@ -1980,9 +1981,9 @@ USHORT DLL_EXPORT EVL_mb_matches(TDBB tdbb,
* later processing with EVL_wc_matches(). * later processing with EVL_wc_matches().
* *
**************************************/ **************************************/
USHORT buffer1[100], buffer2[100]; /* arbitrary size for optimization */ UCS2_CHAR buffer1[100], buffer2[100]; /* arbitrary size for optimization */
USHORT *pp1 = buffer1; UCS2_CHAR *pp1 = buffer1;
USHORT *pp2 = buffer2; UCS2_CHAR *pp2 = buffer2;
USHORT len1, len2; USHORT len1, len2;
STR buf1, buf2; STR buf1, buf2;
USHORT ret_val; USHORT ret_val;
@ -1995,15 +1996,15 @@ USHORT DLL_EXPORT EVL_mb_matches(TDBB tdbb,
len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos); len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) { if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str(); buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data; pp1 = (UCS2_CHAR *) buf1->str_data;
} }
if (len2 > sizeof(buffer2)) { if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str(); buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data; pp2 = (UCS2_CHAR *) buf2->str_data;
} }
len1 = obj->to_wc((unsigned char*)pp1, len1, p1, l1, &err_code, &err_pos); len1 = obj->to_wc(pp1, len1, p1, l1, &err_code, &err_pos);
len2 = obj->to_wc((unsigned char*)pp2, len2, p2, l2, &err_code, &err_pos); len2 = obj->to_wc(pp2, len2, p2, l2, &err_code, &err_pos);
ret_val = EVL_wc_matches(tdbb, obj, pp1, len1, pp2, len2); ret_val = EVL_wc_matches(tdbb, obj, pp1, len1, pp2, len2);
@ -2036,8 +2037,8 @@ USHORT DLL_EXPORT EVL_mb_sleuth_check(TDBB tdbb,
* later processing with sleuth_check(). * later processing with sleuth_check().
* *
**************************************/ **************************************/
USHORT buffer1[100]; /* arbitrary size for optimization */ UCS2_CHAR buffer1[100]; /* arbitrary size for optimization */
USHORT *pp1 = buffer1; UCS2_CHAR *pp1 = buffer1;
USHORT len1; USHORT len1;
STR buf1; STR buf1;
USHORT ret_val; USHORT ret_val;
@ -2055,14 +2056,14 @@ USHORT DLL_EXPORT EVL_mb_sleuth_check(TDBB tdbb,
len1 = obj->to_wc(NULL, 0, search, search_bytes, &err_code, &err_pos); len1 = obj->to_wc(NULL, 0, search, search_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) { if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str(); buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data; pp1 = (UCS2_CHAR *) buf1->str_data;
} }
len1 = obj->to_wc((unsigned char*)pp1, len1, search, search_bytes, &err_code, &err_pos); len1 = obj->to_wc(pp1, len1, search, search_bytes, &err_code, &err_pos);
ret_val = ret_val =
EVL_wc_sleuth_check(tdbb, obj, 0, pp1, len1, EVL_wc_sleuth_check(tdbb, obj, 0, pp1, len1,
reinterpret_cast < USHORT * >(match), reinterpret_cast < UCS2_CHAR * >(match),
match_bytes); match_bytes);
if (pp1 != buffer1) if (pp1 != buffer1)
@ -2090,9 +2091,9 @@ USHORT DLL_EXPORT EVL_mb_sleuth_merge(TDBB tdbb,
* Front-end of sleuth_merge() in Japanese version. * Front-end of sleuth_merge() in Japanese version.
* *
**************************************/ **************************************/
USHORT buffer1[100], buffer2[100]; /* arbitrary size for optimization */ UCS2_CHAR buffer1[100], buffer2[100]; /* arbitrary size for optimization */
USHORT *pp1 = buffer1; UCS2_CHAR *pp1 = buffer1;
USHORT *pp2 = buffer2; UCS2_CHAR *pp2 = buffer2;
USHORT len1, len2; USHORT len1, len2;
STR buf1, buf2; STR buf1, buf2;
USHORT ret_val; USHORT ret_val;
@ -2109,22 +2110,19 @@ USHORT DLL_EXPORT EVL_mb_sleuth_merge(TDBB tdbb,
len2 = obj->to_wc(NULL, 0, control, control_bytes, &err_code, &err_pos); len2 = obj->to_wc(NULL, 0, control, control_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) { if (len1 > sizeof(buffer1)) {
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str(); buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data; pp1 = (UCS2_CHAR *) buf1->str_data;
} }
if (len2 > sizeof(buffer2)) { if (len2 > sizeof(buffer2)) {
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str(); buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data; pp2 = (UCS2_CHAR *) buf2->str_data;
} }
len1 = obj->to_wc((unsigned char*)pp1, len1, match, match_bytes, len1 = obj->to_wc(pp1, len1, match, match_bytes, &err_code, &err_pos);
&err_code, &err_pos); len2 = obj->to_wc(pp2, len2, control, control_bytes, &err_code, &err_pos);
len2 = obj->to_wc((unsigned char*)pp2, len2, control, control_bytes,
&err_code, &err_pos);
ret_val = EVL_wc_sleuth_merge(tdbb, obj, pp1, len1, pp2, ret_val = EVL_wc_sleuth_merge(tdbb, obj, pp1, len1, pp2, len2,
len2, reinterpret_cast < UCS2_CHAR * >(combined),
reinterpret_cast < USHORT * >(combined), combined_bytes);
combined_bytes);
if (pp1 != buffer1) if (pp1 != buffer1)
delete buf1; delete buf1;
@ -2214,8 +2212,8 @@ USHORT DLL_EXPORT EVL_nc_contains(TDBB tdbb_dummy,
USHORT DLL_EXPORT EVL_wc_contains(TDBB tdbb_dumm, USHORT DLL_EXPORT EVL_wc_contains(TDBB tdbb_dumm,
class TextType* obj, WCHAR * p1, USHORT l1, /* byte count */ class TextType* obj, UCS2_CHAR * p1, USHORT l1, /* byte count */
WCHAR * p2, USHORT l2) UCS2_CHAR * p2, USHORT l2)
{ {
/************************************** /**************************************
* *
@ -2226,7 +2224,7 @@ USHORT DLL_EXPORT EVL_wc_contains(TDBB tdbb_dumm,
* Functional description * Functional description
* *
**************************************/ **************************************/
WCHAR *q1, *q2, c1, c2; UCS2_CHAR *q1, *q2, c1, c2;
SSHORT l; SSHORT l;
while (l1 >= l2) { while (l1 >= l2) {
@ -2265,14 +2263,14 @@ USHORT DLL_EXPORT EVL_wc_contains(TDBB tdbb_dumm,
************************************** **************************************
*/ */
#define LIKENAME EVL_wc_like #define LIKENAME EVL_wc_like
#define LIKETYPE WCHAR #define LIKETYPE UCS2_CHAR
#define MATCHESNAME EVL_wc_matches #define MATCHESNAME EVL_wc_matches
#define MATCHESTYPE WCHAR #define MATCHESTYPE UCS2_CHAR
#define SLEUTHNAME EVL_wc_sleuth_check #define SLEUTHNAME EVL_wc_sleuth_check
#define SLEUTH_MERGE_NAME EVL_wc_sleuth_merge #define SLEUTH_MERGE_NAME EVL_wc_sleuth_merge
#define SLEUTH_AUX wc_sleuth_check #define SLEUTH_AUX wc_sleuth_check
#define SLEUTH_CLASS_NAME wc_sleuth_class #define SLEUTH_CLASS_NAME wc_sleuth_class
#define SLEUTHTYPE WCHAR #define SLEUTHTYPE UCS2_CHAR
#define EVL_LIKE_INCLUDED_BY_EVL_CPP #define EVL_LIKE_INCLUDED_BY_EVL_CPP
#include "../jrd/evl_like.cpp" #include "../jrd/evl_like.cpp"
@ -4557,7 +4555,7 @@ static SSHORT sleuth(TDBB tdbb, JRD_NOD node, DSC * desc1, DSC * desc2)
/* l2 is result's byte-count */ /* l2 is result's byte-count */
/* Note: resulting string from sleuth_merge is either WCHAR or NCHAR /* Note: resulting string from sleuth_merge is either UCS2_CHAR or NCHAR
and never Multibyte (see note in EVL_mb_sleuth_check) */ and never Multibyte (see note in EVL_mb_sleuth_check) */
if (desc1->dsc_dtype != dtype_blob) { if (desc1->dsc_dtype != dtype_blob) {
@ -4741,7 +4739,7 @@ static SSHORT string_function(
/* Handle LIKE and MATCHES*/ /* Handle LIKE and MATCHES*/
if (node->nod_type == nod_like) { if (node->nod_type == nod_like) {
WCHAR escape; UCS2_CHAR escape;
escape = 0; escape = 0;
/* ensure 3rd argument (escape char) is in operation text type */ /* ensure 3rd argument (escape char) is in operation text type */

View File

@ -52,7 +52,7 @@
USHORT LIKENAME(TDBB tdbb, class TextType* obj, LIKETYPE * p1, SSHORT l1_bytes, /* byte count */ USHORT LIKENAME(TDBB tdbb, class TextType* obj, LIKETYPE * p1, SSHORT l1_bytes, /* byte count */
LIKETYPE * p2, SSHORT l2_bytes, /* byte count */ LIKETYPE * p2, SSHORT l2_bytes, /* byte count */
WCHAR escape_char) UCS2_CHAR escape_char)
{ {
/************************************** /**************************************
* *
@ -72,7 +72,7 @@ USHORT LIKENAME(TDBB tdbb, class TextType* obj, LIKETYPE * p1, SSHORT l1_bytes,
* instead of UCHAR-based. * instead of UCHAR-based.
* *
* Note Bene: LIKETYPE is defined by including file (evl.c) to either * Note Bene: LIKETYPE is defined by including file (evl.c) to either
* WCHAR or NCHAR, depending on the varient being compiled here. * UCS2_CHAR or NCHAR, depending on the varient being compiled here.
* *
* (escape_char == 0) means no escape character is specified. * (escape_char == 0) means no escape character is specified.
* *
@ -93,13 +93,13 @@ USHORT LIKENAME(TDBB tdbb, class TextType* obj, LIKETYPE * p1, SSHORT l1_bytes,
while (l2-- > 0) { while (l2-- > 0) {
c = *p2++; c = *p2++;
if (escape_char && ((WCHAR) c == escape_char)) { if (escape_char && ((UCS2_CHAR) c == escape_char)) {
if (l2-- > 0) { if (l2-- > 0) {
c = *p2++; c = *p2++;
/* Note: SQL II says <escape_char><escape_char> is error condition */ /* Note: SQL II says <escape_char><escape_char> is error condition */
if (((WCHAR) c == escape_char) || if (((UCS2_CHAR) c == escape_char) ||
((WCHAR) c == (WCHAR) SQL_MATCH_ANY) || ((UCS2_CHAR) c == (UCS2_CHAR) SQL_MATCH_ANY) ||
((WCHAR) c == (WCHAR) SQL_MATCH_ONE)) ((UCS2_CHAR) c == (UCS2_CHAR) SQL_MATCH_ONE))
escape = TRUE; escape = TRUE;
} }
if (!escape) if (!escape)

View File

@ -143,7 +143,6 @@
typedef unsigned char FILECHAR; typedef unsigned char FILECHAR;
typedef USHORT UNICODE;
typedef USHORT fss_wchar_t; typedef USHORT fss_wchar_t;
typedef int fss_size_t; typedef int fss_size_t;
@ -161,16 +160,16 @@ static SSHORT internal_str_to_upper(TextType*, USHORT, UCHAR *, USHORT,
UCHAR *); UCHAR *);
static USHORT internal_string_to_key(TextType*, USHORT, UCHAR *, USHORT, static USHORT internal_string_to_key(TextType*, USHORT, UCHAR *, USHORT,
UCHAR *, USHORT); UCHAR *, USHORT);
static USHORT mb_to_wc(CsConvert*, WCHAR *, USHORT, MBCHAR *, USHORT, SSHORT *, static USHORT mb_to_wc(CsConvert*, UCS2_CHAR *, USHORT, MBCHAR *, USHORT, SSHORT *,
USHORT *); USHORT *);
static USHORT nc_to_wc(CsConvert*, WCHAR *, USHORT, UCHAR *, USHORT, SSHORT *, static USHORT nc_to_wc(CsConvert*, UCS2_CHAR *, USHORT, UCHAR *, USHORT, SSHORT *,
USHORT *); USHORT *);
static void pad_spaces(TDBB, CHARSET_ID, BYTE *, USHORT); static void pad_spaces(TDBB, CHARSET_ID, BYTE *, USHORT);
static USHORT wc_to_mb(CsConvert*, MBCHAR *, USHORT, WCHAR *, USHORT, SSHORT *, static USHORT wc_to_mb(CsConvert*, MBCHAR *, USHORT, UCS2_CHAR *, USHORT, SSHORT *,
USHORT *); USHORT *);
static USHORT wc_to_nc(CsConvert*, NCHAR *, USHORT, WCHAR *, USHORT, SSHORT *, static USHORT wc_to_nc(CsConvert*, NCHAR *, USHORT, UCS2_CHAR *, USHORT, SSHORT *,
USHORT *); USHORT *);
static USHORT wc_to_wc(CsConvert*, WCHAR *, USHORT, WCHAR *, USHORT, SSHORT *, static USHORT wc_to_wc(CsConvert*, UCS2_CHAR *, USHORT, UCS2_CHAR *, USHORT, SSHORT *,
USHORT *); USHORT *);
static CharSetContainer *internal_charset_container_lookup(TDBB, SSHORT, STATUS *); static CharSetContainer *internal_charset_container_lookup(TDBB, SSHORT, STATUS *);
@ -482,9 +481,9 @@ CHARSET_ID src_type, BYTE * src_ptr, USHORT src_len, FPTR_VOID err)
(SLONG) src_type, 0); (SLONG) src_type, 0);
/* /*
** allocate a temporary buffer that is large enough. 2 = sizeof WCHAR ** allocate a temporary buffer that is large enough.
*/ */
tmp_buffer = (BYTE *) FB_NEW(*getDefaultMemoryPool()) char[(SLONG) src_len * 2]; tmp_buffer = (BYTE *) FB_NEW(*getDefaultMemoryPool()) char[(SLONG) src_len * sizeof(UCS2_CHAR)];
cs_obj = from_cs->getConvToUnicode(); cs_obj = from_cs->getConvToUnicode();
assert(cs_obj != NULL); assert(cs_obj != NULL);
@ -836,7 +835,7 @@ int DLL_EXPORT INTL_defined_type(TDBB tdbb, STATUS * status, SSHORT t_type)
} }
WCHAR DLL_EXPORT INTL_getch(TDBB tdbb, UCS2_CHAR DLL_EXPORT INTL_getch(TDBB tdbb,
TextType* * obj, TextType* * obj,
SSHORT t_type, UCHAR ** ptr, USHORT * count) SSHORT t_type, UCHAR ** ptr, USHORT * count)
{ {
@ -851,7 +850,7 @@ WCHAR DLL_EXPORT INTL_getch(TDBB tdbb,
* *
**************************************/ **************************************/
SSHORT used; SSHORT used;
USHORT wc; UCS2_CHAR wc;
SET_TDBB(tdbb); SET_TDBB(tdbb);
@ -1401,7 +1400,7 @@ static USHORT internal_keylength(TextType* obj, USHORT iLength)
return (iLength); return (iLength);
} }
static USHORT nc_to_wc(CsConvert* obj, WCHAR * pWide, USHORT nWide, /* byte count */ static USHORT nc_to_wc(CsConvert* obj, UCS2_CHAR * pWide, USHORT nWide, /* byte count */
UCHAR * pNarrow, USHORT nNarrow, /* byte count */ UCHAR * pNarrow, USHORT nNarrow, /* byte count */
SSHORT * err_code, USHORT * err_position) SSHORT * err_code, USHORT * err_position)
{ {
@ -1412,9 +1411,10 @@ static USHORT nc_to_wc(CsConvert* obj, WCHAR * pWide, USHORT nWide, /* byte coun
************************************** **************************************
* *
* Functional description * Functional description
* Copies narrow chars buffer into wide chars buffer for charset NONE
* *
**************************************/ **************************************/
WCHAR *pStart; UCS2_CHAR *pStart;
UCHAR *pNarrowStart; UCHAR *pNarrowStart;
assert(obj != NULL); assert(obj != NULL);
@ -1424,12 +1424,12 @@ static USHORT nc_to_wc(CsConvert* obj, WCHAR * pWide, USHORT nWide, /* byte coun
*err_code = 0; *err_code = 0;
if (pWide == NULL) if (pWide == NULL)
return (2 * nNarrow); /* all cases */ return (sizeof(UCS2_CHAR) * nNarrow); /* all cases */
pStart = pWide; pStart = pWide;
pNarrowStart = pNarrow; pNarrowStart = pNarrow;
while (nWide-- > 1 && nNarrow) { while (nWide-- > 1 && nNarrow) {
/* YYY - Byte order issues here */ /* YYY - Byte order issues here */
*pWide++ = (WCHAR) * pNarrow++; *pWide++ = (UCS2_CHAR) * pNarrow++;
nWide--; nWide--;
nNarrow--; nNarrow--;
} }
@ -1535,7 +1535,7 @@ static void dump_latin(UCHAR * p, USHORT len)
} }
#endif #endif
unsigned short TextTypeNC::to_wc(unsigned char *pWideUC, unsigned short TextTypeNC::to_wc(UCS2_CHAR *pWideUC,
unsigned short nWide, unsigned short nWide,
unsigned char *pNarrow, unsigned char *pNarrow,
unsigned short nNarrow, unsigned short nNarrow,
@ -1551,7 +1551,7 @@ unsigned short TextTypeNC::to_wc(unsigned char *pWideUC,
* *
**************************************/ **************************************/
{ {
WCHAR *pStart, *pWide = (WCHAR*)pWideUC; UCS2_CHAR *pStart, *pWide = pWideUC;
UCHAR *pNarrowStart; UCHAR *pNarrowStart;
assert((pNarrow != NULL) || (pWide == NULL)); assert((pNarrow != NULL) || (pWide == NULL));
@ -1560,12 +1560,12 @@ unsigned short TextTypeNC::to_wc(unsigned char *pWideUC,
*err_code = 0; *err_code = 0;
if (pWide == NULL) if (pWide == NULL)
return (2 * nNarrow); /* all cases */ return (sizeof(UCS2_CHAR) * nNarrow); /* all cases */
pStart = pWide; pStart = pWide;
pNarrowStart = pNarrow; pNarrowStart = pNarrow;
while (nWide-- > 1 && nNarrow) { while (nWide-- > 1 && nNarrow) {
/* YYY - Byte order issues here */ /* YYY - Byte order issues here */
*pWide++ = (WCHAR) * pNarrow++; *pWide++ = (UCS2_CHAR) * pNarrow++;
nWide--; nWide--;
nNarrow--; nNarrow--;
} }
@ -1619,7 +1619,7 @@ unsigned short TextTypeNC::sleuth_merge(TDBB a, unsigned char *b,
return EVL_nc_sleuth_merge(a,this,b,c,d,e,f,g); return EVL_nc_sleuth_merge(a,this,b,c,d,e,f,g);
} }
unsigned short TextTypeNC::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short count) unsigned short TextTypeNC::mbtowc(UCS2_CHAR *wc, unsigned char *ptr, unsigned short count)
/************************************** /**************************************
* *
* i n t e r n a l _ n c _ m b t o w c * i n t e r n a l _ n c _ m b t o w c
@ -1689,7 +1689,7 @@ unsigned short TextTypeMB::sleuth_merge(TDBB a, unsigned char *b,
return EVL_mb_sleuth_merge(a,this,b,c,d,e,f,g); return EVL_mb_sleuth_merge(a,this,b,c,d,e,f,g);
} }
unsigned short TextTypeMB::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short count) unsigned short TextTypeMB::mbtowc(UCS2_CHAR *wc, unsigned char *ptr, unsigned short count)
{ {
/************************************** /**************************************
* *
@ -1710,7 +1710,7 @@ unsigned short TextTypeMB::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short
if (count >= 2) { if (count >= 2) {
if (wc) if (wc)
*wc = *(WCHAR *) ptr; *wc = *(UCS2_CHAR *) ptr;
return 2; return 2;
} }
if (wc) if (wc)
@ -1718,7 +1718,7 @@ unsigned short TextTypeMB::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short
return (unsigned short)-1; /* No more characters */ return (unsigned short)-1; /* No more characters */
} }
unsigned short TextTypeWC::to_wc(unsigned char *pDestUC, unsigned short TextTypeWC::to_wc(UCS2_CHAR *pDestUC,
unsigned short nDest, unsigned short nDest,
unsigned char *pSrcUC, unsigned char *pSrcUC,
unsigned short nSrc, unsigned short nSrc,
@ -1734,8 +1734,8 @@ unsigned short TextTypeWC::to_wc(unsigned char *pDestUC,
* Functional description * Functional description
* *
*************************************/ *************************************/
WCHAR *pStart, *pDest = (WCHAR*)pDestUC; UCS2_CHAR *pStart, *pDest = pDestUC;
WCHAR *pStart_src, *pSrc = (WCHAR*)pSrcUC; UCS2_CHAR *pStart_src, *pSrc = (UCS2_CHAR*)pSrcUC;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDest == NULL));
assert(err_code != NULL); assert(err_code != NULL);
@ -1765,7 +1765,7 @@ unsigned short TextTypeWC::contains(TDBB a, unsigned char *b,
unsigned char *d, unsigned char *d,
unsigned short e) unsigned short e)
{ {
return EVL_wc_contains(a,this,(WCHAR*)b,c,(WCHAR*)d,e); return EVL_wc_contains(a,this,(UCS2_CHAR*)b,c,(UCS2_CHAR*)d,e);
} }
unsigned short TextTypeWC::like(TDBB a, unsigned char *b, unsigned short TextTypeWC::like(TDBB a, unsigned char *b,
@ -1774,13 +1774,13 @@ unsigned short TextTypeWC::like(TDBB a, unsigned char *b,
short e, short e,
short f) short f)
{ {
return EVL_wc_like(a,this,(WCHAR*)b,c,(WCHAR*)d,e,f); return EVL_wc_like(a,this,(UCS2_CHAR*)b,c,(UCS2_CHAR*)d,e,f);
} }
unsigned short TextTypeWC::matches(TDBB a, unsigned char *b, short c, unsigned short TextTypeWC::matches(TDBB a, unsigned char *b, short c,
unsigned char *d, short e) unsigned char *d, short e)
{ {
return EVL_wc_matches(a,this,(WCHAR*)b,c,(WCHAR*)d,e); return EVL_wc_matches(a,this,(UCS2_CHAR*)b,c,(UCS2_CHAR*)d,e);
} }
unsigned short TextTypeWC::sleuth_check(TDBB a, unsigned short b, unsigned short TextTypeWC::sleuth_check(TDBB a, unsigned short b,
@ -1789,7 +1789,7 @@ unsigned short TextTypeWC::sleuth_check(TDBB a, unsigned short b,
unsigned char *e, unsigned char *e,
unsigned short f) unsigned short f)
{ {
return EVL_wc_sleuth_check(a,this,b,(WCHAR*)c,d,(WCHAR*)e,f); return EVL_wc_sleuth_check(a,this,b,(UCS2_CHAR*)c,d,(UCS2_CHAR*)e,f);
} }
unsigned short TextTypeWC::sleuth_merge(TDBB a, unsigned char *b, unsigned short TextTypeWC::sleuth_merge(TDBB a, unsigned char *b,
@ -1799,10 +1799,10 @@ unsigned short TextTypeWC::sleuth_merge(TDBB a, unsigned char *b,
unsigned char *f, unsigned char *f,
unsigned short g) unsigned short g)
{ {
return EVL_wc_sleuth_merge(a,this,(WCHAR*)b,c,(WCHAR*)d,e,(WCHAR*)f,g); return EVL_wc_sleuth_merge(a,this,(UCS2_CHAR*)b,c,(UCS2_CHAR*)d,e,(UCS2_CHAR*)f,g);
} }
unsigned short TextTypeWC::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short count) unsigned short TextTypeWC::mbtowc(UCS2_CHAR *wc, unsigned char *ptr, unsigned short count)
{ {
/************************************** /**************************************
* *
@ -1823,7 +1823,7 @@ unsigned short TextTypeWC::mbtowc(WCHAR *wc, unsigned char *ptr, unsigned short
if (count >= 2) { if (count >= 2) {
if (wc) if (wc)
*wc = *(WCHAR *) ptr; *wc = *(UCS2_CHAR *) ptr;
return 2; return 2;
} }
if (wc) if (wc)
@ -2017,7 +2017,7 @@ public:
(tt,a,b,c,d); (tt,a,b,c,d);
} }
unsigned short to_wc(unsigned char *a, unsigned short to_wc(UCS2_CHAR *a,
unsigned short b, unsigned short b,
unsigned char *c, unsigned char *c,
unsigned short d, unsigned short d,
@ -2027,18 +2027,18 @@ public:
assert(tt); assert(tt);
assert(tt->texttype_fn_to_wc); assert(tt->texttype_fn_to_wc);
return (*(reinterpret_cast return (*(reinterpret_cast
<USHORT (*)(TEXTTYPE,UCHAR*,USHORT,UCHAR*,USHORT,short*,USHORT*)> <USHORT (*)(TEXTTYPE,UCS2_CHAR*,USHORT,UCHAR*,USHORT,short*,USHORT*)>
(tt->texttype_fn_to_wc))) (tt->texttype_fn_to_wc)))
(tt,a,b,c,d,e,f); (tt,a,b,c,d,e,f);
} }
unsigned short mbtowc(WCHAR *a, unsigned char *b, unsigned short c) unsigned short mbtowc(UCS2_CHAR *a, unsigned char *b, unsigned short c)
{ {
assert(tt); assert(tt);
if (!tt->texttype_fn_mbtowc) if (!tt->texttype_fn_mbtowc)
return T::mbtowc(a,b,c); return T::mbtowc(a,b,c);
return (*(reinterpret_cast< return (*(reinterpret_cast<
USHORT (*)(TEXTTYPE, WCHAR*, UCHAR*, USHORT)> USHORT (*)(TEXTTYPE, UCS2_CHAR*, UCHAR*, USHORT)>
(tt->texttype_fn_mbtowc)))(tt,a,b,c); (tt->texttype_fn_mbtowc)))(tt,a,b,c);
} }

View File

@ -9,7 +9,6 @@
typedef USHORT fss_wchar_t; typedef USHORT fss_wchar_t;
typedef int fss_size_t; typedef int fss_size_t;
typedef unsigned char FILECHAR; typedef unsigned char FILECHAR;
typedef USHORT UNICODE;
// internal functions // internal functions
static fss_size_t fss_wctomb(UCHAR *, fss_wchar_t); static fss_size_t fss_wctomb(UCHAR *, fss_wchar_t);
@ -29,7 +28,7 @@ static unsigned short internal_unicode_to_fss(
short *, short *,
unsigned short *); unsigned short *);
static USHORT internal_fss_to_unicode ( static USHORT internal_fss_to_unicode (
UNICODE*, UCS2_CHAR*,
USHORT, USHORT,
NCHAR*, NCHAR*,
USHORT, USHORT,
@ -112,15 +111,15 @@ public:
unsigned char *d) unsigned char *d)
{ return internal_str_to_upper(a,b,c,d); } { return internal_str_to_upper(a,b,c,d); }
unsigned short to_wc(unsigned char *a, unsigned short to_wc(UCS2_CHAR *a,
unsigned short b, unsigned short b,
unsigned char *c, unsigned char *c,
unsigned short d, unsigned short d,
short *e, short *e,
unsigned short *f) unsigned short *f)
{ return internal_fss_to_unicode((UNICODE*)a,b,c,d,e,f); } { return internal_fss_to_unicode(a,b,c,d,e,f); }
unsigned short mbtowc(WCHAR *wc, unsigned char *p, unsigned short n) unsigned short mbtowc(UCS2_CHAR *wc, unsigned char *p, unsigned short n)
{ return fss_mbtowc(wc, p, n); } { return fss_mbtowc(wc, p, n); }
}; };
@ -409,7 +408,7 @@ public:
{ return FB_NEW(p) CharSet_Unicode(p); } { return FB_NEW(p) CharSet_Unicode(p); }
CharSet_Unicode(MemoryPool &p) : CharSet(CS_UNICODE_UCS2, "UNICODE_UCS2", 2, 2, 2, 0) CharSet_Unicode(MemoryPool &p) : CharSet(CS_UNICODE_UCS2, "UNICODE_UCS2", 2, 2, 2, 0)
{ {
static const WCHAR space = 0x0020; static const UCS2_CHAR space = 0x0020;
charset_space_character = (const char *) & space; /* 0x0020 */ charset_space_character = (const char *) & space; /* 0x0020 */
} }
}; };
@ -428,6 +427,21 @@ public:
/********************************************************************************/ /********************************************************************************/
#ifndef HAVE_SWAB
#ifdef HAVE__SWAB
#define swab _swab
#else // use generic swab(). Slow (but faster than previous implementation) and buggy
void swab(char * a, char * b, int n)
{
while(--n>0)
{
*b++ = a[1];
*b++ = *a++;
a++; n--;
}
}
#endif
#endif
unsigned short CsConvert_Unicode_Binary::convert( unsigned short CsConvert_Unicode_Binary::convert(
unsigned char *pDest, unsigned char *pDest,
@ -448,30 +462,26 @@ unsigned short CsConvert_Unicode_Binary::convert(
* byte stream. * byte stream.
* *
*************************************/ *************************************/
MBCHAR *pStart; unsigned short res;
WCHAR *pStart_src, *pSrc = (WCHAR*)pSrcUC;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrcUC != NULL) || (pDest == NULL));
assert(err_code != NULL); assert(err_code != NULL);
assert(err_position != NULL); assert(err_position != NULL);
*err_code = 0; *err_code = 0;
if (pDest == NULL) /* length estimate needed? */ if (pDest == NULL) /* length estimate needed? */
return (nSrc); return (nSrc);
pStart = pDest;
pStart_src = pSrc; assert(nSrc&1 == 0); // check for even length
while (nDest > 1 && nSrc > 1) {
*pDest++ = *pSrc / 256; if (nSrc>nDest) {
*pDest++ = *pSrc++ % 256;
nDest -= 2;
nSrc -= 2;
}
if (!*err_code && nSrc) {
*err_code = CS_TRUNCATION_ERROR; *err_code = CS_TRUNCATION_ERROR;
} }
*err_position = (pSrc - pStart_src) * sizeof(*pSrc); res = nSrc>nDest?nDest:nSrc;
swab((char *)pSrcUC,(char *)pDest,res);
*err_position = res;
return ((pDest - pStart) * sizeof(*pDest)); return res;
} }
@ -492,32 +502,30 @@ unsigned short CsConvert_Binary_Unicode::convert(
* Functional description * Functional description
* Convert a wc string from network form - high-endian * Convert a wc string from network form - high-endian
* byte stream. * byte stream.
* Symmetrical with CsConvert_Unicode_Binary::convert
* but really the same
* *
*************************************/ *************************************/
WCHAR *pStart, *pDest = (WCHAR*)pDestUC; unsigned short res;
MBCHAR *pStart_src;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDestUC == NULL));
assert(err_code != NULL); assert(err_code != NULL);
assert(err_position != NULL); assert(err_position != NULL);
*err_code = 0; *err_code = 0;
if (pDest == NULL) /* length estimate needed? */ if (pDestUC == NULL) /* length estimate needed? */
return (nSrc); return (nSrc);
pStart = pDest;
pStart_src = pSrc; assert(nSrc&1 == 0);
while (nDest > 1 && nSrc > 1) {
*pDest++ = *pSrc * 256 + *(pSrc + 1); if (nSrc>nDest) {
pSrc += 2;
nDest -= 2;
nSrc -= 2;
}
if (!*err_code && nSrc) {
*err_code = CS_TRUNCATION_ERROR; *err_code = CS_TRUNCATION_ERROR;
} }
*err_position = (pSrc - pStart_src) * sizeof(*pSrc); res = nSrc>nDest?nDest:nSrc;
swab((char *)pSrc,(char *)pDestUC,res);
*err_position = res;
return ((pDest - pStart) * sizeof(*pDest)); return res;
} }
unsigned short CsConvert_UFSS_Unicode::convert( unsigned short CsConvert_UFSS_Unicode::convert(
@ -528,7 +536,7 @@ unsigned short CsConvert_UFSS_Unicode::convert(
short *err_code, short *err_code,
unsigned short *err_position) unsigned short *err_position)
{ {
UNICODE *start, *dest_ptr = (UNICODE*)dest_ptrUC; UCS2_CHAR *start, *dest_ptr = (UCS2_CHAR*)dest_ptrUC;
USHORT src_start = src_len; USHORT src_start = src_len;
fss_size_t res; fss_size_t res;
@ -584,7 +592,7 @@ unsigned short CsConvert_Unicode_ASCII::convert(
* *
*************************************/ *************************************/
NCHAR *pStart; NCHAR *pStart;
WCHAR *pStart_src, *pSrc = (WCHAR*)pSrcUC; UCS2_CHAR *pStart_src, *pSrc = (UCS2_CHAR*)pSrcUC;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDest == NULL));
assert(err_code != NULL); assert(err_code != NULL);
@ -631,7 +639,7 @@ unsigned short CsConvert_ASCII_Unicode::convert(
* Byte values >= 128 create BAD_INPUT * Byte values >= 128 create BAD_INPUT
* *
*************************************/ *************************************/
WCHAR *pStart, *pDest = (WCHAR*)pDestUC; UCS2_CHAR *pStart, *pDest = (UCS2_CHAR*)pDestUC;
UCHAR *pStart_src; UCHAR *pStart_src;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDest == NULL));
@ -677,7 +685,7 @@ unsigned short CsConvert_Unicode_None::convert(
* *
**************************************/ **************************************/
NCHAR *pStart; NCHAR *pStart;
WCHAR *pStart_src, *pSrc = (WCHAR*)pSrcUC; UCS2_CHAR *pStart_src, *pSrc = (UCS2_CHAR*)pSrcUC;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDest == NULL));
assert(err_code != NULL); assert(err_code != NULL);
@ -725,7 +733,7 @@ unsigned short CsConvert_None_Unicode::convert(
* Byte values >= 128 create CONVERT ERROR * Byte values >= 128 create CONVERT ERROR
* *
*************************************/ *************************************/
WCHAR *pStart, *pDest = (WCHAR*)pDestUC; UCS2_CHAR *pStart, *pDest = (UCS2_CHAR*)pDestUC;
UCHAR *pStart_src; UCHAR *pStart_src;
assert((pSrc != NULL) || (pDest == NULL)); assert((pSrc != NULL) || (pDest == NULL));
@ -1148,7 +1156,7 @@ unsigned short internal_unicode_to_fss(
unsigned short *err_position) unsigned short *err_position)
{ {
MBCHAR *fss_str = (MBCHAR*)fss_strUC; MBCHAR *fss_str = (MBCHAR*)fss_strUC;
UNICODE *unicode_str = (UNICODE*)unicode_strUC; UCS2_CHAR *unicode_str = (UCS2_CHAR*)unicode_strUC;
UCHAR *start; UCHAR *start;
USHORT src_start = unicode_len; USHORT src_start = unicode_len;
UCHAR tmp_buffer[6]; UCHAR tmp_buffer[6];
@ -1193,14 +1201,14 @@ unsigned short internal_unicode_to_fss(
} }
static USHORT internal_fss_to_unicode ( static USHORT internal_fss_to_unicode (
UNICODE *dest_ptr, UCS2_CHAR *dest_ptr,
USHORT dest_len, /* BYTE count */ USHORT dest_len, /* BYTE count */
NCHAR *src_ptr, NCHAR *src_ptr,
USHORT src_len, USHORT src_len,
SSHORT *err_code, SSHORT *err_code,
USHORT *err_position) USHORT *err_position)
{ {
UNICODE *start; UCS2_CHAR *start;
USHORT src_start = src_len; USHORT src_start = src_len;
fss_size_t res; fss_size_t res;
@ -1522,7 +1530,7 @@ static USHORT cs_unicode_ucs2_init(CHARSET csptr, USHORT cs_id, USHORT dummy)
* Functional description * Functional description
* *
*************************************/ *************************************/
static const WCHAR space = 0x0020; static const UCS2_CHAR space = 0x0020;
csptr->charset_version = 40; csptr->charset_version = 40;
csptr->charset_id = CS_UNICODE; csptr->charset_id = CS_UNICODE;

View File

@ -29,7 +29,7 @@
typedef unsigned short CHARSET_ID; typedef unsigned short CHARSET_ID;
typedef unsigned short COLLATE_ID; typedef unsigned short COLLATE_ID;
typedef unsigned short TTYPE_ID; typedef unsigned short TTYPE_ID;
typedef unsigned short WCHAR; typedef unsigned short UCS2_CHAR;
typedef unsigned char NCHAR; typedef unsigned char NCHAR;
typedef unsigned char MBCHAR; typedef unsigned char MBCHAR;
typedef class tdbb *TDBB; typedef class tdbb *TDBB;
@ -74,12 +74,14 @@ public:
unsigned char*, unsigned char*,
unsigned short, unsigned short,
unsigned char*) = 0; unsigned char*) = 0;
virtual unsigned short to_wc(unsigned char*, /* SD: to_wc returns estimated or real length of the result string in bytes that is rather strange */
unsigned short, virtual unsigned short to_wc(UCS2_CHAR*, // destination buffer
unsigned char*, unsigned short, // length of the destination buffer in bytes
unsigned short, unsigned char*, // source buffer
short*, unsigned short, // length of source buffer in bytes
unsigned short*) = 0; short*, // variable to return error code
unsigned short*) = 0; // variable to return offset of the first
// unprocessed char
virtual unsigned short contains(TDBB, unsigned char*, virtual unsigned short contains(TDBB, unsigned char*,
unsigned short, unsigned short,
unsigned char*, unsigned char*,
@ -102,7 +104,7 @@ public:
unsigned short, unsigned short,
unsigned char*, unsigned char*,
unsigned short) = 0; unsigned short) = 0;
virtual unsigned short mbtowc(WCHAR*, unsigned char*, unsigned short) = 0; virtual unsigned short mbtowc(UCS2_CHAR*, unsigned char*, unsigned short) = 0;
//virtual short get_wchar(unsigned short*, unsigned char*, unsigned short) = 0; //virtual short get_wchar(unsigned short*, unsigned char*, unsigned short) = 0;
//unsigned short getVersion() { return texttype_version; } //unsigned short getVersion() { return texttype_version; }
@ -129,12 +131,13 @@ public:
TextType(type, name, cs_id, country, bpc) TextType(type, name, cs_id, country, bpc)
{} {}
unsigned short to_wc(unsigned char*, unsigned short to_wc(UCS2_CHAR*, // destination buffer
unsigned short, unsigned short, // length of the destination buffer in bytes
unsigned char*, unsigned char*, // source buffer
unsigned short, unsigned short, // length of source buffer in bytes
short*, short*, // variable to return error code
unsigned short*); unsigned short*); // variable to return offset of the first
// unprocessed char
unsigned short contains(TDBB, unsigned char*, unsigned short contains(TDBB, unsigned char*,
unsigned short, unsigned short,
unsigned char*, unsigned char*,
@ -157,7 +160,7 @@ public:
unsigned short, unsigned short,
unsigned char*, unsigned char*,
unsigned short); unsigned short);
unsigned short mbtowc(WCHAR*, unsigned char*, unsigned short); unsigned short mbtowc(UCS2_CHAR*, unsigned char*, unsigned short);
}; };
class TextTypeWC : public TextType class TextTypeWC : public TextType
@ -168,12 +171,13 @@ public:
TextType(type, name, cs_id, country, bpc) TextType(type, name, cs_id, country, bpc)
{} {}
unsigned short to_wc(unsigned char*, unsigned short to_wc(UCS2_CHAR*, // destination buffer
unsigned short, unsigned short, // length of the destination buffer in bytes
unsigned char*, unsigned char*, // source buffer
unsigned short, unsigned short, // length of source buffer in bytes
short*, short*, // variable to return error code
unsigned short*); unsigned short*); // variable to return offset of the first
// unprocessed char
unsigned short contains(TDBB, unsigned char*, unsigned short contains(TDBB, unsigned char*,
unsigned short, unsigned short,
unsigned char*, unsigned char*,
@ -196,7 +200,7 @@ public:
unsigned short, unsigned short,
unsigned char*, unsigned char*,
unsigned short); unsigned short);
unsigned short mbtowc(WCHAR*, unsigned char*, unsigned short); unsigned short mbtowc(UCS2_CHAR*, unsigned char*, unsigned short);
}; };
class TextTypeMB : public TextType class TextTypeMB : public TextType
@ -229,7 +233,7 @@ public:
unsigned short, unsigned short,
unsigned char*, unsigned char*,
unsigned short); unsigned short);
unsigned short mbtowc(WCHAR*, unsigned char*, unsigned short); unsigned short mbtowc(UCS2_CHAR*, unsigned char*, unsigned short);
}; };
#define TEXTTYPE_init 1 /* object has been init'ed */ #define TEXTTYPE_init 1 /* object has been init'ed */

View File

@ -53,7 +53,7 @@ typedef SSHORT COLLATE_ID;
typedef USHORT TTYPE_ID; typedef USHORT TTYPE_ID;
typedef SCHAR ASCII; typedef SCHAR ASCII;
typedef unsigned char NCHAR; /* Narrow Char */ typedef unsigned char NCHAR; /* Narrow Char */
typedef unsigned short WCHAR; /* Wide Char */ typedef unsigned short UCS2_CHAR; /* Not very Wide Char */
typedef unsigned char MBCHAR; /* Multibyte Char */ typedef unsigned char MBCHAR; /* Multibyte Char */
#define type_texttype 54 #define type_texttype 54

View File

@ -1,4 +1,4 @@
#ident "$Id: config.h.in,v 1.69 2003-02-13 22:49:16 bellardo Exp $" #ident "$Id: config.h.in,v 1.70 2003-02-18 05:24:35 aafemt Exp $"
/* /*
* 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports: * 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete ports:
@ -77,6 +77,8 @@
#undef HAVE_SIGACTION #undef HAVE_SIGACTION
#undef HAVE_SETITIMER #undef HAVE_SETITIMER
#undef HAVE_SNPRINTF #undef HAVE_SNPRINTF
#undef HAVE_SWAB
#undef HAVE__SWAB
#undef HAVE_MMAP #undef HAVE_MMAP
#undef HAVE_ATEXIT #undef HAVE_ATEXIT
#undef HAVE_ON_EXIT #undef HAVE_ON_EXIT