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

Fixed gcc warning, avoid a lot of casts

This commit is contained in:
alexpeshkoff 2009-01-13 16:21:15 +00:00
parent cf90eca00f
commit 3f13437f2a
7 changed files with 28 additions and 26 deletions

View File

@ -37,7 +37,7 @@ ULONG CVBIG5_big5_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -118,7 +118,7 @@ ULONG CVBIG5_unicode_to_big5(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_unicode_str != NULL || big5_str == NULL);
fb_assert(err_code != NULL);

View File

@ -37,7 +37,7 @@ ULONG CVGB_gb2312_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -118,7 +118,7 @@ ULONG CVGB_unicode_to_gb2312(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_unicode_str != NULL || gb_str == NULL);
fb_assert(err_code != NULL);

View File

@ -42,8 +42,7 @@ namespace
static UConverter* create_converter(csconvert* cv, UErrorCode* status)
{
UConverter* conv = ucnv_open(
static_cast<CsConvertImpl*>(cv->csconvert_impl)->cs->charset_name, status);
UConverter* conv = ucnv_open(cv->csconvert_impl->cs->charset_name, status);
const void* oldContext;
UConverterFromUCallback oldFromAction;
@ -72,7 +71,7 @@ static UConverter* create_converter(csconvert* cv, UErrorCode* status)
static void convert_destroy(csconvert* cv)
{
delete static_cast<CsConvertImpl*>(cv->csconvert_impl);
delete cv->csconvert_impl;
}
@ -91,8 +90,7 @@ static ULONG unicode_to_icu(csconvert* cv,
if (dst == NULL)
{
return srcLen / sizeof(UChar) *
static_cast<CsConvertImpl*>(cv->csconvert_impl)->cs->charset_max_bytes_per_char;
return srcLen / sizeof(UChar) * cv->csconvert_impl->cs->charset_max_bytes_per_char;
}
UErrorCode status = U_ZERO_ERROR;
@ -146,8 +144,7 @@ static ULONG icu_to_unicode(csconvert* cv,
if (dst == NULL)
{
return srcLen / static_cast<CsConvertImpl*>(cv->csconvert_impl)->cs->charset_min_bytes_per_char *
sizeof(UChar);
return srcLen / cv->csconvert_impl->cs->charset_min_bytes_per_char * sizeof(UChar);
}
UErrorCode status = U_ZERO_ERROR;
@ -193,12 +190,12 @@ void CVICU_convert_init(charset* cs)
cs->charset_to_unicode.csconvert_fn_convert = icu_to_unicode;
cs->charset_to_unicode.csconvert_fn_destroy = convert_destroy;
cs->charset_to_unicode.csconvert_impl = new CsConvertImpl();
static_cast<CsConvertImpl*>(cs->charset_to_unicode.csconvert_impl)->cs = cs;
cs->charset_to_unicode.csconvert_impl->cs = cs;
cs->charset_from_unicode.csconvert_version = CSCONVERT_VERSION_1;
cs->charset_from_unicode.csconvert_name = "UNICODE->ICU";
cs->charset_from_unicode.csconvert_fn_convert = unicode_to_icu;
cs->charset_from_unicode.csconvert_fn_destroy = convert_destroy;
cs->charset_from_unicode.csconvert_impl = new CsConvertImpl();
static_cast<CsConvertImpl*>(cs->charset_from_unicode.csconvert_impl)->cs = cs;
cs->charset_from_unicode.csconvert_impl->cs = cs;
}

View File

@ -39,7 +39,7 @@ ULONG CVJIS_eucj_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -139,7 +139,7 @@ ULONG CVJIS_sjis_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(sjis_str != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -401,7 +401,7 @@ ULONG CVJIS_unicode_to_sjis(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_unicode_str != NULL || sjis_str == NULL);
fb_assert(err_code != NULL);
@ -482,7 +482,7 @@ ULONG CVJIS_unicode_to_eucj(csconvert* obj, ULONG unicode_len, const UCHAR* p_un
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_unicode_str != NULL || eucj_str == NULL);
fb_assert(err_code != NULL);

View File

@ -43,7 +43,7 @@ ULONG CVKSC_ksc_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -123,7 +123,7 @@ ULONG CVKSC_unicode_to_ksc(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_unicode_str != NULL || ksc_str == NULL);
fb_assert(err_code != NULL);

View File

@ -39,8 +39,8 @@ void CV_convert_init(csconvert* csptr,
csptr->csconvert_fn_convert = cvt_fn;
csptr->csconvert_fn_destroy = CV_convert_destroy;
csptr->csconvert_impl = new CsConvertImpl();
static_cast<CsConvertImpl*>(csptr->csconvert_impl)->csconvert_datatable = (const BYTE*) datatable;
static_cast<CsConvertImpl*>(csptr->csconvert_impl)->csconvert_misc = (const BYTE*) datatable2;
csptr->csconvert_impl->csconvert_datatable = (const BYTE*) datatable;
csptr->csconvert_impl->csconvert_misc = (const BYTE*) datatable2;
}
@ -54,7 +54,7 @@ ULONG CV_unicode_to_nc(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -105,7 +105,7 @@ ULONG CV_wc_to_wc(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(p_src_ptr != NULL || p_dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -161,7 +161,7 @@ ULONG CV_nc_to_unicode(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || dest_ptr == NULL);
fb_assert(err_code != NULL);
@ -247,7 +247,7 @@ ULONG eight_bit_convert(csconvert* obj,
{
fb_assert(obj != NULL);
CsConvertImpl* impl = static_cast<CsConvertImpl*>(obj->csconvert_impl);
CsConvertImpl* impl = obj->csconvert_impl;
fb_assert(src_ptr != NULL || dest_ptr == NULL);
fb_assert(err_code != NULL);

View File

@ -211,10 +211,15 @@ typedef void (*pfn_INTL_cv_destroy) (
/* csconvert version */
#define CSCONVERT_VERSION_1 1
namespace
{
struct CsConvertImpl; // forward declaration - refers to diff struct in diff modules!
}
struct csconvert
{
USHORT csconvert_version;
void* csconvert_impl;
CsConvertImpl* csconvert_impl;
/* Used only for debugging purposes. Should contain string in form
<source_charset>-><destination_charset>. For example "WIN1251->DOS866"