diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index 2dd48a9389..531cee6c89 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -147,11 +147,11 @@ typedef unsigned char FILECHAR; static bool all_spaces(TDBB, CHARSET_ID, const BYTE*, USHORT, USHORT); static void pad_spaces(TDBB, CHARSET_ID, BYTE *, USHORT); -static void* lookup_init_function(USHORT, SSHORT, SSHORT); +static FPTR_SHORT lookup_init_function(USHORT, SSHORT, SSHORT); static void finish_texttype_init(TEXTTYPE); -static USHORT nc_to_wc(CSCONVERT, WCHAR *, USHORT, UCHAR *, USHORT, SSHORT *, +static USHORT nc_to_wc(CSCONVERT, UCS2_CHAR *, USHORT, UCHAR *, USHORT, SSHORT *, 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 *); /* Name of module that implements text-type (n) */ @@ -424,7 +424,7 @@ static void finish_texttype_init(TEXTTYPE txtobj) txtobj->texttype_flags |= TEXTTYPE_init; } -static void* lookup_init_function( +static FPTR_SHORT lookup_init_function( USHORT type, SSHORT parm1, SSHORT parm2) @@ -451,7 +451,7 @@ static void* lookup_init_function( * * ***************************************/ - USHORT (*function)(); + FPTR_SHORT function; if (!bcLoaded) { @@ -559,7 +559,7 @@ static void* lookup_init_function( && (function_block->fun_rpt[argcount].fun_desc.dsc_dtype == dtype_text)) { - return function_block->fun_entrypoint; + return (FPTR_SHORT)function_block->fun_entrypoint; } } return NULL; @@ -1520,8 +1520,8 @@ static USHORT nc_to_wc(CSCONVERT obj, UCS2_CHAR * pWide, USHORT nWide, /* byte c return ((pWide - pStart) * sizeof(*pWide)); } -static USHORT wc_to_wc(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count */ - WCHAR * pSrc, USHORT nSrc, /* byte count */ +static USHORT wc_to_wc(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte count */ + UCS2_CHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { /************************************** @@ -1533,8 +1533,8 @@ static USHORT wc_to_wc(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count * Functional description * *************************************/ - WCHAR *pStart; - WCHAR *pStart_src; + UCS2_CHAR *pStart; + UCS2_CHAR *pStart_src; assert(obj != NULL); assert((pSrc != NULL) || (pDest == NULL)); diff --git a/src/jrd/intl_builtin.cpp b/src/jrd/intl_builtin.cpp index 1e646ef304..70b6aa16df 100644 --- a/src/jrd/intl_builtin.cpp +++ b/src/jrd/intl_builtin.cpp @@ -50,7 +50,7 @@ typedef struct { SLONG lval; } Tab; -static CONST Tab tab[] = { +static const Tab tab[] = { { 0x80, 0x00, 0 * 6, 0x7F, 0 }, /* 1 byte sequence */ { 0xE0, 0xC0, 1 * 6, 0x7FF, 0x80 }, /* 2 byte sequence */ { 0xF0, 0xE0, 2 * 6, 0xFFFF, 0x800 }, /* 3 byte sequence */ @@ -122,7 +122,7 @@ static fss_size_t fss_wctomb(UCHAR * s, fss_wchar_t wc) } static SSHORT internal_fss_mbtowc(TEXTTYPE * obj, - WCHAR * wc, NCHAR * p, USHORT n) + UCS2_CHAR * wc, NCHAR * p, USHORT n) { /************************************** * @@ -408,7 +408,7 @@ static USHORT internal_ch_to_lower(TEXTTYPE obj, UCHAR ch) } SSHORT INTL_builtin_nc_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count) + UCS2_CHAR * wc, UCHAR * ptr, USHORT count) { /************************************** * @@ -439,7 +439,7 @@ SSHORT INTL_builtin_nc_mbtowc(TEXTTYPE obj, } SSHORT INTL_builtin_mb_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count) + UCS2_CHAR * wc, UCHAR * ptr, USHORT count) { /************************************** * @@ -461,7 +461,7 @@ SSHORT INTL_builtin_mb_mbtowc(TEXTTYPE obj, if (count >= 2) { if (wc) - *wc = *(WCHAR *) ptr; + *wc = *(UCS2_CHAR *) ptr; return 2; } if (wc) @@ -471,7 +471,7 @@ SSHORT INTL_builtin_mb_mbtowc(TEXTTYPE obj, SSHORT INTL_builtin_wc_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count) + UCS2_CHAR * wc, UCHAR * ptr, USHORT count) { /************************************** * @@ -493,7 +493,7 @@ SSHORT INTL_builtin_wc_mbtowc(TEXTTYPE obj, if (count >= 2) { if (wc) - *wc = *(WCHAR *) ptr; + *wc = *(UCS2_CHAR *) ptr; return 2; } if (wc) @@ -542,7 +542,7 @@ static USHORT internal_ch_copy(TEXTTYPE obj, UCHAR ch) } static USHORT wc_to_nc(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count */ - WCHAR * pSrc, USHORT nSrc, /* byte count */ + UCS2_CHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { /************************************** @@ -555,7 +555,7 @@ static USHORT wc_to_nc(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count * **************************************/ NCHAR *pStart; - WCHAR *pStart_src; + UCS2_CHAR *pStart_src; assert(obj != NULL); assert((pSrc != NULL) || (pDest == NULL)); @@ -585,7 +585,7 @@ static USHORT wc_to_nc(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count } -static USHORT mb_to_wc(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count */ +static USHORT mb_to_wc(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte count */ MBCHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { @@ -600,7 +600,7 @@ static USHORT mb_to_wc(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count * byte stream. * *************************************/ - WCHAR *pStart; + UCS2_CHAR *pStart; MBCHAR *pStart_src; assert(obj != NULL); @@ -629,7 +629,7 @@ static USHORT mb_to_wc(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count static USHORT wc_to_mb(CSCONVERT obj, MBCHAR * pDest, USHORT nDest, /* byte count */ - WCHAR * pSrc, USHORT nSrc, /* byte count */ + UCS2_CHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { /************************************** @@ -644,7 +644,7 @@ static USHORT wc_to_mb(CSCONVERT obj, MBCHAR * pDest, USHORT nDest, /* byte coun * *************************************/ MBCHAR *pStart; - WCHAR *pStart_src; + UCS2_CHAR *pStart_src; assert(obj != NULL); assert((pSrc != NULL) || (pDest == NULL)); @@ -818,7 +818,7 @@ BYTE * datatable, BYTE * datatable2) csptr->csconvert_misc = datatable2; } -static USHORT cvt_ascii_to_unicode(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count */ +static USHORT cvt_ascii_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte count */ UCHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { @@ -834,7 +834,7 @@ static USHORT cvt_ascii_to_unicode(CSCONVERT obj, WCHAR * pDest, USHORT nDest, / * Byte values >= 128 create BAD_INPUT * *************************************/ - WCHAR *pStart; + UCS2_CHAR *pStart; UCHAR *pStart_src; assert(obj != NULL); @@ -864,7 +864,7 @@ static USHORT cvt_ascii_to_unicode(CSCONVERT obj, WCHAR * pDest, USHORT nDest, / } static USHORT cvt_unicode_to_ascii(CSCONVERT obj, NCHAR * pDest, USHORT nDest, /* byte count */ - WCHAR * pSrc, USHORT nSrc, /* byte count */ + UCS2_CHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { /************************************** @@ -880,7 +880,7 @@ static USHORT cvt_unicode_to_ascii(CSCONVERT obj, NCHAR * pDest, USHORT nDest, / * *************************************/ NCHAR *pStart; - WCHAR *pStart_src; + UCS2_CHAR *pStart_src; assert(obj != NULL); assert((pSrc != NULL) || (pDest == NULL)); @@ -908,7 +908,7 @@ static USHORT cvt_unicode_to_ascii(CSCONVERT obj, NCHAR * pDest, USHORT nDest, / return ((pDest - pStart) * sizeof(*pDest)); } -static USHORT cvt_none_to_unicode(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* byte count */ +static USHORT cvt_none_to_unicode(CSCONVERT obj, UCS2_CHAR * pDest, USHORT nDest, /* byte count */ UCHAR * pSrc, USHORT nSrc, /* byte count */ SSHORT * err_code, USHORT * err_position) { @@ -924,7 +924,7 @@ static USHORT cvt_none_to_unicode(CSCONVERT obj, WCHAR * pDest, USHORT nDest, /* * Byte values >= 128 create CONVERT ERROR * *************************************/ - WCHAR *pStart; + UCS2_CHAR *pStart; UCHAR *pStart_src; assert(obj != NULL); diff --git a/src/jrd/intl_classes.h b/src/jrd/intl_classes.h index f8d8cc72b2..fcefc86fe5 100644 --- a/src/jrd/intl_classes.h +++ b/src/jrd/intl_classes.h @@ -35,7 +35,7 @@ public: TextType(struct texttype *_tt) : tt(_tt) {} // copy constructor - TextType(TextType& obj) : tt(obj.tt) {} + TextType(const TextType& obj) : tt(obj.tt) {} USHORT key_length(USHORT a) { assert(tt); @@ -215,26 +215,26 @@ public: assert(tt); return tt->texttype_bytes_per_char; } - friend bool operator ==(const TextType& tt1, const TextType& tt2); - friend bool operator !=(const TextType& tt1, const TextType& tt2); + + struct texttype *getStruct() const { return tt; } private: struct texttype *tt; }; static inline bool operator ==(const TextType& tt1, const TextType& tt2) { - return tt1.tt == tt2.tt; + return tt1.getStruct() == tt2.getStruct(); } static inline bool operator !=(const TextType& tt1, const TextType& tt2) { - return tt1.tt != tt2.tt; + return tt1.getStruct() != tt2.getStruct(); } class CsConvert { public: CsConvert(struct csconvert *_cnvt) : cnvt(_cnvt) {} - CsConvert(CsConvert& obj) : cnvt(obj.cnvt) {} + CsConvert(const CsConvert& obj) : cnvt(obj.cnvt) {} USHORT convert(UCHAR *a, USHORT b, @@ -253,25 +253,25 @@ public: const char *getName() const { assert(cnvt); return cnvt->csconvert_name; } CHARSET_ID getFromCS() const { assert(cnvt); return cnvt->csconvert_from; } CHARSET_ID getToCS() const { assert(cnvt); return cnvt->csconvert_to; } - friend bool operator ==(const CsConvert& cv1, const CsConvert& cv2); - friend bool operator !=(const CsConvert& cv1, const CsConvert& cv2); + + struct csconvert *getStruct() const { return cnvt; } private: struct csconvert *cnvt; }; static inline bool operator ==(const CsConvert& cv1, const CsConvert& cv2) { - return cv1.cnvt == cv2.cnvt; + return cv1.getStruct() == cv2.getStruct(); } static inline bool operator !=(const CsConvert& cv1, const CsConvert& cv2) { - return cv1.cnvt != cv2.cnvt; + return cv1.getStruct() != cv2.getStruct(); } class CharSet { public: CharSet(struct charset *_cs) : cs(_cs) {} - CharSet(CharSet &obj) : cs(obj.cs) {}; + CharSet(const CharSet &obj) : cs(obj.cs) {}; CHARSET_ID getId() const { assert(cs); return cs->charset_id; } const char *getName() const { assert(cs); return cs->charset_name; } @@ -281,20 +281,20 @@ public: const UCHAR *getSpace() const { assert(cs); return cs->charset_space_character; } CsConvert getConvToUnicode() { assert(cs); return &cs->charset_to_unicode; } + CsConvert getConvFromUnicode() { assert(cs); return &cs->charset_from_unicode; } - - friend bool operator ==(const CharSet& cs1, const CharSet& cs2); - friend bool operator !=(const CharSet& cs1, const CharSet& cs2); + + struct charset *getStruct() const { return cs; } private: struct charset *cs; }; static inline bool operator ==(const CharSet& cs1, const CharSet& cs2) { - return cs1.cs == cs2.cs; + return cs1.getStruct() == cs2.getStruct(); } static inline bool operator !=(const CharSet& cs1, const CharSet& cs2) { - return cs1.cs != cs2.cs; + return cs1.getStruct() != cs2.getStruct(); } #endif /* JRD_INTL_CLASSES_H */ diff --git a/src/jrd/intl_proto.h b/src/jrd/intl_proto.h index 3dfe74744e..6e12dffe49 100644 --- a/src/jrd/intl_proto.h +++ b/src/jrd/intl_proto.h @@ -50,11 +50,11 @@ UCHAR INTL_upper(TDBB, USHORT, UCHAR); // Built-in charsets interface FPTR_SHORT INTL_builtin_lookup(USHORT, SSHORT, SSHORT); SSHORT INTL_builtin_nc_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count); + UCS2_CHAR * wc, UCHAR * ptr, USHORT count); SSHORT INTL_builtin_mb_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count); + UCS2_CHAR * wc, UCHAR * ptr, USHORT count); SSHORT INTL_builtin_wc_mbtowc(TEXTTYPE obj, - WCHAR * wc, UCHAR * ptr, USHORT count); + UCS2_CHAR * wc, UCHAR * ptr, USHORT count); #endif // JRD_INTL_PROTO_H