mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-25 01:23:03 +01:00
Minimizing casts.
This commit is contained in:
parent
7b8862029f
commit
e1f337e951
@ -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<char*>(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<const unsigned char*>(src),
|
||||
pByte->dsc_length,
|
||||
reinterpret_cast<unsigned char*>(dest),
|
||||
key_type);
|
||||
outlen = obj->string_to_key(len, src, pByte->dsc_length, dest, key_type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ typedef Firebird::HalfStaticArray<unsigned char, SHA_DIGESTSIZE> BinHash;
|
||||
void base64(Firebird::string& b64, const BinHash& bin)
|
||||
{
|
||||
b64.erase();
|
||||
const unsigned char* f = reinterpret_cast<const unsigned char*>(bin.begin());
|
||||
const unsigned char* f = bin.begin();
|
||||
for (int i = bin.getCount(); i > 0; i -= 3, f += 3)
|
||||
{
|
||||
if (i >= 3)
|
||||
|
@ -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<char*>(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<UCHAR*>(*dpb);
|
||||
p = reinterpret_cast<char*>(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<char*>(new_dpb);
|
||||
*dpb_size = p - new_dpb;
|
||||
*dpb = reinterpret_cast<SCHAR*>(new_dpb);
|
||||
}
|
||||
|
||||
|
@ -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<const UCHAR*>(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)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user