|
From: Adriano d. S. F. <asf...@us...> - 2007-11-30 16:18:07
|
Build Version : T2.1.0.17409 Firebird 2.1 Beta 2 (writeBuildNum.sh,v 1.17567 2007/11/30 16:18:06 asfernandes ) Update of /cvsroot/firebird/firebird2/src/jrd In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv24253/src/jrd Modified Files: Tag: B3_0_Transition evl.cpp intl.cpp intl_proto.h Log Message: Cleanup in LOWER and UPPER functions Index: evl.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/evl.cpp,v retrieving revision 1.230.2.2 retrieving revision 1.230.2.3 diff -b -U3 -r1.230.2.2 -r1.230.2.3 --- evl.cpp 25 Nov 2007 20:17:32 -0000 1.230.2.2 +++ evl.cpp 30 Nov 2007 16:18:03 -0000 1.230.2.3 @@ -152,7 +152,6 @@ static void init_agg_distinct(thread_db*, const jrd_nod*); static dsc* lock_state(thread_db*, jrd_nod*, impure_value*); static dsc* low_up_case(thread_db*, const dsc*, impure_value*, - int (*intl_str_to_case)(thread_db*, DSC*), ULONG (TextType::*tt_str_to_case)(ULONG, const UCHAR*, ULONG, UCHAR*)); static dsc* multiply(const dsc*, impure_value*, const jrd_nod*); static dsc* multiply2(const dsc*, impure_value*, const jrd_nod*); @@ -1139,10 +1138,10 @@ return substring(tdbb, impure, values[0], values[1], values[2]); case nod_upcase: - return low_up_case(tdbb, values[0], impure, INTL_str_to_upper, &TextType::str_to_upper); + return low_up_case(tdbb, values[0], impure, &TextType::str_to_upper); case nod_lowcase: - return low_up_case(tdbb, values[0], impure, INTL_str_to_lower, &TextType::str_to_lower); + return low_up_case(tdbb, values[0], impure, &TextType::str_to_lower); case nod_cast: return cast(tdbb, values[0], node, impure); @@ -3840,7 +3839,6 @@ static dsc* low_up_case(thread_db* tdbb, const dsc* value, impure_value* impure, - int (*intl_str_to_case)(thread_db*, DSC*), ULONG (TextType::*tt_str_to_case)(ULONG, const UCHAR*, ULONG, UCHAR*)) { /************************************** @@ -3855,6 +3853,8 @@ **************************************/ SET_TDBB(tdbb); + TextType* textType = INTL_texttype_lookup(tdbb, value->getTextType()); + if (value->dsc_dtype == dtype_blob) { EVL_make_value(tdbb, value, impure); @@ -3862,7 +3862,6 @@ if (value->dsc_sub_type != isc_blob_text) return &impure->vlu_desc; - TextType* textType = INTL_texttype_lookup(tdbb, value->dsc_blob_ttype()); CharSet* charSet = textType->getCharSet(); blb* blob = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, @@ -3903,7 +3902,11 @@ INTL_ASSIGN_TTYPE(&desc, ttype); EVL_make_value(tdbb, &desc, impure); - intl_str_to_case(tdbb, &impure->vlu_desc); + if (value->isText()) + { + (textType->*tt_str_to_case)(desc.dsc_length, impure->vlu_desc.dsc_address, + desc.dsc_length, impure->vlu_desc.dsc_address); + } } return &impure->vlu_desc; Index: intl.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/intl.cpp,v retrieving revision 1.96.2.3 retrieving revision 1.96.2.4 diff -b -U3 -r1.96.2.3 -r1.96.2.4 --- intl.cpp 25 Nov 2007 20:17:33 -0000 1.96.2.3 +++ intl.cpp 30 Nov 2007 16:18:03 -0000 1.96.2.4 @@ -1173,112 +1173,6 @@ } -int INTL_str_to_upper(thread_db* tdbb, DSC * pString) -{ -/************************************** - * - * I N T L _ s t r _ t o _ u p p e r - * - ************************************** - * - * Functional description - * Given an input string, convert it to uppercase - * - **************************************/ - SET_TDBB(tdbb); - - fb_assert(pString != NULL); - fb_assert(pString->dsc_address != NULL); - - UCHAR* src; - UCHAR buffer[MAX_KEY]; - USHORT ttype; - USHORT len = - CVT_get_string_ptr(pString, &ttype, &src, - reinterpret_cast<vary*>(buffer), - sizeof(buffer), ERR_post); - - UCHAR* dest; - switch (ttype) { - case ttype_binary: - /* cannot uppercase binary strings */ - break; - - case ttype_none: - case ttype_ascii: - dest = src; - while (len--) { - *dest++ = UPPER7(*src); - src++; - } - break; - - default: - TextType* obj = INTL_texttype_lookup(tdbb, ttype); - obj->str_to_upper(len, src, len, src); // ASF: this works for all cases? (src and dst buffers are the same) - break; - } -/* - * Added to remove compiler errors. Callers are not checking - * the return code from this function 4/5/95. -*/ - return (0); -} - - -int INTL_str_to_lower(thread_db* tdbb, DSC * pString) -{ -/************************************** - * - * I N T L _ s t r _ t o _ l o w e r - * - ************************************** - * - * Functional description - * Given an input string, convert it to lowercase - * - **************************************/ - SET_TDBB(tdbb); - - fb_assert(pString != NULL); - fb_assert(pString->dsc_address != NULL); - - UCHAR* src; - UCHAR buffer[MAX_KEY]; - USHORT ttype; - USHORT len = - CVT_get_string_ptr(pString, &ttype, &src, - reinterpret_cast<vary*>(buffer), - sizeof(buffer), ERR_post); - - UCHAR* dest; - switch (ttype) { - case ttype_binary: - /* cannot lowercase binary strings */ - break; - - case ttype_none: - case ttype_ascii: - dest = src; - while (len--) { - *dest++ = LOWWER7(*src); - src++; - } - break; - - default: - TextType* obj = INTL_texttype_lookup(tdbb, ttype); - obj->str_to_lower(len, src, len, src); // ASF: this works for all cases? (src and dst buffers are the same) - break; - } -/* - * Added to remove compiler errors. Callers are not checking - * the return code from this function 4/5/95. -*/ - return (0); -} - - static bool all_spaces( thread_db* tdbb, CHARSET_ID charset, Index: intl_proto.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/intl_proto.h,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -b -U3 -r1.21 -r1.21.2.1 --- intl_proto.h 15 Apr 2007 15:57:05 -0000 1.21 +++ intl_proto.h 30 Nov 2007 16:18:03 -0000 1.21.2.1 @@ -51,8 +51,6 @@ bool INTL_texttype_validate(Jrd::thread_db*, const SubtypeInfo*); void INTL_pad_spaces(Jrd::thread_db*, dsc*, UCHAR*, ULONG); USHORT INTL_string_to_key(Jrd::thread_db*, USHORT, const dsc*, dsc*, USHORT); -int INTL_str_to_upper(Jrd::thread_db*, dsc*); -int INTL_str_to_lower(Jrd::thread_db*, dsc*); // Built-in charsets/texttypes interface INTL_BOOL INTL_builtin_lookup_charset(charset* cs, const ASCII* charset_name, const ASCII* config_info); |