From: ByungWoo Lee Date: Tue, 7 Jul 2015 00:48:32 +0000 (+0900) Subject: Implementation fixes corresponding to UTC tests fixes. X-Git-Tag: accepted/tizen/mobile/20150707.035110^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F43002%2F1;p=platform%2Fcore%2Fapi%2Fbase-utils.git Implementation fixes corresponding to UTC tests fixes. Modify description of i18n_udate_to_calendar_date_field. Change-Id: I00dd32d6cb14fb57b4699bc01565d5f8752666a7 --- diff --git a/src/include/mobile/utils_i18n_udate.h b/src/include/mobile/utils_i18n_udate.h index 911a934..3db5542 100644 --- a/src/include/mobile/utils_i18n_udate.h +++ b/src/include/mobile/utils_i18n_udate.h @@ -237,9 +237,10 @@ int i18n_udate_format_date ( const i18n_udate_format_h format, i18n_udate date_t * @details Note: since the mapping is many-to-one, there is no inverse mapping. * @since_tizen 2.3.1 * - * @param[in] field The #i18n_udate_format_h to map. + * @param[in] field The #i18n_udate_format_h to map. + * #I18N_UDATE_FORMAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD, #I18N_UDATE_FORMAT_TIMEZONE_ISO_FIELD, + * #I18N_UDATE_FORMAT_TIMEZONE_ISO_LOCAL_FIELD and #I18N_UDATE_FORMAT_FIELD_COUNT are not supported. * @param[out] date_field_type A pointer to the #i18n_ucalendar_date_fields_e. - * This will be #I18N_UCALENDAR_FIELD_COUNT in case of error (e.g. the input field is #I18N_UDATE_FORMAT_FIELD_COUNT). * * @return Error code. * @retval #I18N_ERROR_NONE Successful diff --git a/src/include/wearable/utils_i18n_udate.h b/src/include/wearable/utils_i18n_udate.h index 911a934..3db5542 100644 --- a/src/include/wearable/utils_i18n_udate.h +++ b/src/include/wearable/utils_i18n_udate.h @@ -237,9 +237,10 @@ int i18n_udate_format_date ( const i18n_udate_format_h format, i18n_udate date_t * @details Note: since the mapping is many-to-one, there is no inverse mapping. * @since_tizen 2.3.1 * - * @param[in] field The #i18n_udate_format_h to map. + * @param[in] field The #i18n_udate_format_h to map. + * #I18N_UDATE_FORMAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD, #I18N_UDATE_FORMAT_TIMEZONE_ISO_FIELD, + * #I18N_UDATE_FORMAT_TIMEZONE_ISO_LOCAL_FIELD and #I18N_UDATE_FORMAT_FIELD_COUNT are not supported. * @param[out] date_field_type A pointer to the #i18n_ucalendar_date_fields_e. - * This will be #I18N_UCALENDAR_FIELD_COUNT in case of error (e.g. the input field is #I18N_UDATE_FORMAT_FIELD_COUNT). * * @return Error code. * @retval #I18N_ERROR_NONE Successful diff --git a/src/utils_i18n_timezone.cpp b/src/utils_i18n_timezone.cpp index 18b09fd..26c77d9 100755 --- a/src/utils_i18n_timezone.cpp +++ b/src/utils_i18n_timezone.cpp @@ -203,7 +203,11 @@ int i18n_timezone_set_default( i18n_timezone_h timezone ) const char* i18n_timezone_get_tzdata_version(void) { UErrorCode status = U_ZERO_ERROR; - return TimeZone::getTZDataVersion(status); + const char* tzver = TimeZone::getTZDataVersion(status); + + set_last_result(_i18n_error_mapping(status)); + + return tzver; } int i18n_timezone_get_region(const char *timezone_id, char *region, int32_t *region_len, int32_t region_capacity) diff --git a/src/utils_i18n_ubrk.c b/src/utils_i18n_ubrk.c index 77dd4f7..7f222d2 100644 --- a/src/utils_i18n_ubrk.c +++ b/src/utils_i18n_ubrk.c @@ -168,6 +168,11 @@ int32_t i18n_ubrk_following (i18n_ubreak_iterator_h break_iter, int32_t offset) const char *i18n_ubrk_get_available (int32_t index) { + if(index < 0) { + set_last_result(I18N_ERROR_INVALID_PARAMETER); + return NULL; + } + set_last_result(I18N_ERROR_NONE); return ubrk_getAvailable(index); } diff --git a/src/utils_i18n_udate.c b/src/utils_i18n_udate.c index 17d0dc2..0bdb159 100644 --- a/src/utils_i18n_udate.c +++ b/src/utils_i18n_udate.c @@ -177,6 +177,11 @@ int i18n_udate_set_number_format ( i18n_udate_format_h format, const i18n_unumbe const char *i18n_udate_get_available ( int32_t locale_index ) { + if(locale_index < 0) { + set_last_result(I18N_ERROR_INVALID_PARAMETER); + return NULL; + } + set_last_result(I18N_ERROR_NONE); return udat_getAvailable(locale_index); } diff --git a/src/utils_i18n_ulocale.c b/src/utils_i18n_ulocale.c index 6a0df9c..aa1973f 100755 --- a/src/utils_i18n_ulocale.c +++ b/src/utils_i18n_ulocale.c @@ -65,6 +65,11 @@ int i18n_ulocale_get_display_name (const char *locale_id, const char *in_locale_ const char* i18n_ulocale_get_available (int32_t n) { + if(n < 0){ + set_last_result(I18N_ERROR_INVALID_PARAMETER); + return NULL; + } + set_last_result(I18N_ERROR_NONE); return uloc_getAvailable(n); } diff --git a/src/utils_i18n_unumber.c b/src/utils_i18n_unumber.c index eb22dc7..b6bbf22 100755 --- a/src/utils_i18n_unumber.c +++ b/src/utils_i18n_unumber.c @@ -250,6 +250,11 @@ int i18n_unumber_apply_pattern (i18n_unumber_format_h format, i18n_ubool localiz const char *i18n_unumber_get_available (int32_t locale_index) { + if(locale_index < 0) { + set_last_result(I18N_ERROR_INVALID_PARAMETER); + return NULL; + } + set_last_result(I18N_ERROR_NONE); return unum_getAvailable(locale_index); } diff --git a/src/utils_i18n_ustring.c b/src/utils_i18n_ustring.c index cafd076..1ba6126 100644 --- a/src/utils_i18n_ustring.c +++ b/src/utils_i18n_ustring.c @@ -196,7 +196,7 @@ int32_t i18n_ustring_spn ( const i18n_uchar *string, const i18n_uchar *match_set i18n_uchar* i18n_ustring_tokenizer_r ( i18n_uchar *src, const i18n_uchar *delim, i18n_uchar **save_state ) { - if(src == NULL && save_state == NULL) { + if((src == NULL && save_state == NULL) || delim == NULL) { set_last_result(I18N_ERROR_INVALID_PARAMETER); return NULL; }