diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index 7f0200d618..60d8be8d6c 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -1114,8 +1114,6 @@ USHORT INTL_string_to_key(thread_db* tdbb, * Return the length of the resulting byte string. * **************************************/ - UCHAR pad_char; - USHORT ttype; SET_TDBB(tdbb); @@ -1127,6 +1125,9 @@ USHORT INTL_string_to_key(thread_db* tdbb, fb_assert(pByte->dsc_address != NULL); fb_assert(pByte->dsc_dtype == dtype_text); + UCHAR pad_char; + USHORT ttype; + switch (idxType) { case idx_string: @@ -1154,7 +1155,7 @@ USHORT INTL_string_to_key(thread_db* tdbb, USHORT len = MOV_make_string2(tdbb, pString, ttype, &src, temp); USHORT outlen; - char* dest = reinterpret_cast(pByte->dsc_address); + UCHAR* dest = pByte->dsc_address; USHORT destLen = pByte->dsc_length; switch (ttype) @@ -1166,21 +1167,17 @@ USHORT INTL_string_to_key(thread_db* tdbb, while (len-- && destLen-- > 0) *dest++ = *src++; /* strip off ending pad characters */ - while (dest > (const char*)pByte->dsc_address) { + while (dest > pByte->dsc_address) { if (*(dest - 1) == pad_char) dest--; else break; } - outlen = (dest - (const char*)pByte->dsc_address); + outlen = (dest - pByte->dsc_address); break; default: TextType* obj = INTL_texttype_lookup(tdbb, ttype); - outlen = obj->string_to_key(len, - reinterpret_cast(src), - pByte->dsc_length, - reinterpret_cast(dest), - key_type); + outlen = obj->string_to_key(len, src, pByte->dsc_length, dest, key_type); break; } diff --git a/src/jrd/sha.cpp b/src/jrd/sha.cpp index d0552ce3a1..328d46ec7d 100644 --- a/src/jrd/sha.cpp +++ b/src/jrd/sha.cpp @@ -351,7 +351,7 @@ typedef Firebird::HalfStaticArray BinHash; void base64(Firebird::string& b64, const BinHash& bin) { b64.erase(); - const unsigned char* f = reinterpret_cast(bin.begin()); + const unsigned char* f = bin.begin(); for (int i = bin.getCount(); i > 0; i -= 3, f += 3) { if (i >= 3) diff --git a/src/jrd/utl.cpp b/src/jrd/utl.cpp index e86239a9da..b2712e8378 100644 --- a/src/jrd/utl.cpp +++ b/src/jrd/utl.cpp @@ -317,7 +317,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...) * **************************************/ SSHORT length; - char* p = 0; + UCHAR* p = 0; const char* q; va_list args; USHORT type; @@ -367,7 +367,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...) /* Note: gds__free done by GPRE generated code */ new_dpb = (UCHAR*)gds__alloc((SLONG)(sizeof(UCHAR) * new_dpb_length)); - p = reinterpret_cast(new_dpb); + p = new_dpb; /* FREE: done by client process in GPRE generated code */ if (!new_dpb) { /* NOMEM: don't trash existing dpb */ @@ -394,7 +394,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...) // tail, it would be a memory failure, unless the caller lies and is // always passing a dpb bigger than *dpb_size. new_dpb = reinterpret_cast(*dpb); - p = reinterpret_cast(new_dpb + *dpb_size); + p = new_dpb + *dpb_size; } if (!*dpb_size) @@ -419,9 +419,9 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...) { length = strlen(q); fb_assert(type <= CHAR_MAX); - *p++ = (char) type; + *p++ = (UCHAR) type; fb_assert(length <= CHAR_MAX); - *p++ = (char) length; + *p++ = (UCHAR) length; while (length--) *p++ = *q++; } @@ -434,7 +434,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...) } va_end(args); - *dpb_size = p - reinterpret_cast(new_dpb); + *dpb_size = p - new_dpb; *dpb = reinterpret_cast(new_dpb); } diff --git a/src/jrd/why.cpp b/src/jrd/why.cpp index 20ba99fe0c..b71702721e 100644 --- a/src/jrd/why.cpp +++ b/src/jrd/why.cpp @@ -1863,7 +1863,7 @@ ISC_STATUS API_ROUTINE GDS_CREATE_DATABASE(ISC_STATUS* user_status, PathName org_filename(file_name, file_length ? file_length : strlen(file_name)); ClumpletWriter newDpb(ClumpletReader::Tagged, MAX_DPB_SIZE, - reinterpret_cast(dpb), dpb_length, isc_dpb_version1); + dpb, dpb_length, isc_dpb_version1); bool utfFilename = newDpb.find(isc_dpb_utf8_filename); @@ -5639,7 +5639,7 @@ static void release_dsql_support(sqlda_sup& dasup) } -static void save_error_string(ISC_STATUS * status) +static void save_error_string(ISC_STATUS* status) { /************************************** *