X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/fd0068a84e9996f225edba706498f6ed413d0673..46f4442e9a5a4f3b98b7c1083586332f6a8a99a4:/icuSources/i18n/ucsdet.cpp diff --git a/icuSources/i18n/ucsdet.cpp b/icuSources/i18n/ucsdet.cpp index 114f896f..d06dd336 100644 --- a/icuSources/i18n/ucsdet.cpp +++ b/icuSources/i18n/ucsdet.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** - * Copyright (C) 2005-2006, International Business Machines + * Copyright (C) 2005-2007, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** */ @@ -14,6 +14,8 @@ #include "cmemory.h" +U_NAMESPACE_USE + #define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) #define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type)) @@ -52,14 +54,7 @@ ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCo return; } - if (ucsd == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - CharsetDetector *csd = (CharsetDetector *) ucsd; - - csd->setText(textIn, len); + ((CharsetDetector *) ucsd)->setText(textIn, len); } U_CAPI const char * U_EXPORT2 @@ -69,14 +64,7 @@ ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status) return NULL; } - if (ucsm == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - - CharsetMatch *csm = (CharsetMatch *) ucsm; - - return csm->getName(); + return ((CharsetMatch *) ucsm)->getName(); } U_CAPI int32_t U_EXPORT2 @@ -86,14 +74,7 @@ ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status) return 0; } - if (ucsm == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - CharsetMatch *csm = (CharsetMatch *) ucsm; - - return csm->getConfidence(); + return ((CharsetMatch *) ucsm)->getConfidence(); } U_CAPI const char * U_EXPORT2 @@ -103,14 +84,7 @@ ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status) return NULL; } - if (ucsm == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - - CharsetMatch *csm = (CharsetMatch *) ucsm; - - return csm->getLanguage(); + return ((CharsetMatch *) ucsm)->getLanguage(); } U_CAPI const UCharsetMatch * U_EXPORT2 @@ -120,14 +94,7 @@ ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status) return NULL; } - if (ucsd == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - - CharsetDetector *csd = (CharsetDetector *) ucsd; - - return (const UCharsetMatch *) csd->detect(*status); + return (const UCharsetMatch *) ((CharsetDetector *) ucsd)->detect(*status); } U_CAPI void U_EXPORT2 @@ -137,14 +104,7 @@ ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t return; } - if (ucsd == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return; - } - - CharsetDetector *csd = (CharsetDetector *) ucsd; - - csd->setDeclaredEncoding(encoding,length); + ((CharsetDetector *) ucsd)->setDeclaredEncoding(encoding,length); } U_CAPI const UCharsetMatch** @@ -155,11 +115,6 @@ ucsdet_detectAll(UCharsetDetector *ucsd, return NULL; } - if (ucsd == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return NULL; - } - CharsetDetector *csd = (CharsetDetector *) ucsd; return (const UCharsetMatch**)csd->detectAll(*maxMatchesFound,*status); @@ -191,9 +146,7 @@ ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd) return FALSE; } - CharsetDetector *csd = (CharsetDetector *) ucsd; - - return csd->getStripTagsFlag(); + return ((CharsetDetector *) ucsd)->getStripTagsFlag(); } U_CAPI UBool U_EXPORT2 @@ -220,14 +173,7 @@ ucsdet_getUChars(const UCharsetMatch *ucsm, return 0; } - if (ucsm == NULL) { - *status = U_ILLEGAL_ARGUMENT_ERROR; - return 0; - } - - CharsetMatch *csm = (CharsetMatch *) ucsm; - - return csm->getUChars(buf, cap, status); + return ((CharsetMatch *) ucsm)->getUChars(buf, cap, status); } U_CDECL_END