Modify the value of I18N_WARNING_SORT_KEY_TOO_SHORT 20/43420/1 accepted/tizen/mobile/20150709.054434 accepted/tizen/tv/20150709.054451 accepted/tizen/wearable/20150709.054501 submit/tizen/20150709.043730
authorByungWoo Lee <bw1212.lee@samsung.com>
Thu, 9 Jul 2015 04:18:14 +0000 (13:18 +0900)
committerByungWoo Lee <bw1212.lee@samsung.com>
Thu, 9 Jul 2015 04:18:14 +0000 (13:18 +0900)
Change-Id: I4a49844d764708a4ff4e68555d20c37a258d60ed

18 files changed:
packaging/capi-base-utils.spec
src/include/mobile/utils_i18n.h
src/include/mobile/utils_i18n_timezone.h
src/include/mobile/utils_i18n_types.h
src/include/mobile/utils_i18n_ubrk.h
src/include/mobile/utils_i18n_ustring.h
src/include/wearable/utils_i18n.h
src/include/wearable/utils_i18n_timezone.h
src/include/wearable/utils_i18n_types.h
src/include/wearable/utils_i18n_ubrk.h
src/include/wearable/utils_i18n_ucollator.h
src/include/wearable/utils_i18n_uenumeration.h
src/utils_i18n_timezone.cpp
src/utils_i18n_ucalendar.c
src/utils_i18n_udate.c
src/utils_i18n_ulocale.c
src/utils_i18n_unumber.c
src/utils_i18n_uset.c

index ebe41b5b53bfed583291996efc1a2fae89a5c5be..c2978cf640a5bf7774ab45c1efad209d9712880e 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-base-utils
 Summary:    Base Utils
-Version:    1.0.0
+Version:    1.0.1
 Release:    1
 Group:      Base
 License:    Apache-2.0 and ICU
index 49629f49ad1fa0cbeeb2d5e1af36063bf14a48d8..f0040d2dc1863a0774840ba5b56ab258c9117de4 100755 (executable)
@@ -87,7 +87,7 @@ extern "C" {
  * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_UDATE_MODULE</td>
- *    <td>Udate module consists of functions that convert dates and times from their 
+ *    <td>Udate module consists of functions that convert dates and times from their
              internal representations to textual form and back again in a language-independent manner.</td>
  * </tr>
  * <tr>
@@ -233,11 +233,6 @@ extern "C" {
  * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE</td>
- *    <td>#i18n_timezone_in_daylight_time</td>
- *    <td>inDaylightTime</td>
- * </tr>
- * <tr>
- *    <td>@ref CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE</td>
  *    <td>#i18n_timezone_has_same_rule</td>
  *    <td>hasSameRules</td>
  * </tr>
@@ -463,7 +458,7 @@ extern "C" {
  * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_USEARCH_MODULE</td>
- *    <td>#i18n_usearch_create</td>
+ *    <td>#i18n_usearch_create_new</td>
  *    <td>usearch_open</td>
  * </tr>
  * <tr>
@@ -535,7 +530,7 @@ extern "C" {
  *    <td>@ref CAPI_BASE_UTILS_I18N_USTRING_MODULE</td>
  *    <td>#i18n_ustring_r_string</td>
  *    <td>u_strrstr</td>
- * </tr> 
+ * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_USTRING_MODULE</td>
  *    <td>#i18n_ustring_find_last</td>
@@ -713,7 +708,7 @@ extern "C" {
  * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_USTRING_MODULE</td>
- *    <td>#i18n_ustring_to_title</td>
+ *    <td>#i18n_ustring_to_title_new</td>
  *    <td>u_strToTitle</td>
  * </tr>
  * <tr>
@@ -778,7 +773,7 @@ extern "C" {
  * </tr>
  * </table>
  */
+
 #ifdef __cplusplus
 }
 #endif
index 1b97acec612dc4d13fd221bca7841f7bbe29d7e3..32aa638cb3aca149c7419583f96098641cb0cb46 100755 (executable)
@@ -250,7 +250,8 @@ const char* i18n_timezone_get_tzdata_version(void);
  * @param[in]  timezone_id The system time zone ID.
  * @param[out] region Output buffer for receiving the region code.
  * @param[out] region_len The length of the region code.
- * @param[in]  region_capacity The size of the output buffer.
+ * @param[in]  region_capacity The size of the output buffer. If it is lower than required @a region buffer size,
+ *                             then I18N_ERROR_BUFFER_OVERFLOW error is returned.
  *
  * @return the version string, such as "2007f"
  */
@@ -346,8 +347,8 @@ int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[in] timezone The i18n_timezone_h to get a display name.
- * @param[in] language The language in which to supply the display name.
- * @param[in] country The country in which to supply the display name.
+ * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale.
+ * @param[in] country The country in which to supply the display name. This parameter can be NULL.
  * @param[out] display_name The human-readable name of this time zone in the default locale.
  *
  * @retval #I18N_ERROR_NONE Successful
@@ -378,8 +379,8 @@ int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_uboo
  * @param[in] timezone The i18n_timezone_h to get a display name.
  * @param[in] daylight If true, display_name is filled with the daylight savings name.
  * @param[in] style The style displayed on.
- * @param[in] language The language in which to supply the display name.
- * @param[in] country The country in which to supply the display name.
+ * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale.
+ * @param[in] country The country in which to supply the display name. This parameter can be NULL.
  * @param[out] display_name The human-readable name of this time zone in the default locale.
  *
  * @retval #I18N_ERROR_NONE Successful
index 58b08be17ca7398c8de2c2cd85c393c3e0c8a183..beee7fb56785985224dd3205decaf6647c1a925b 100644 (file)
@@ -83,7 +83,7 @@ typedef enum {
     I18N_WARNING_STRING_NOT_TERMINATED      = TIZEN_ERROR_UTILITY_ICU | 0x1D,     /**< String not terminated with NULL. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_STD3_ASCII_RULES             = TIZEN_ERROR_UTILITY_ICU | 0x1E,     /**< Argument does not satisfy STD3 rules. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_UNASSIGNED                   = TIZEN_ERROR_UTILITY_ICU | 0x1F,     /**< Unassigned code points are found. @if MOBILE (Since 2.3.1) @endif*/
-    I18N_WARNING_SORT_KEY_TOO_SHORT         = -123,                               /**< Number of levels requested in getBound is higher than the number of levels in the sort key. @if MOBILE (Since 2.3.1) @endif*/
+    I18N_WARNING_SORT_KEY_TOO_SHORT         = TIZEN_ERROR_UTILITY_ICU | 0x20,     /**< Number of levels requested in getBound is higher than the number of levels in the sort key. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_UNKNOWN                      = TIZEN_ERROR_UNKNOWN,                /**< Unknown error. @if MOBILE (Since 2.3.1) @endif*/
 } i18n_error_code_e;
 
index 059ab8730b47e4b4198d1b7c74d82e94db08c532..bdda0b4478ac3262ef949f74c15ae7eb47cdc78c 100755 (executable)
@@ -60,7 +60,8 @@ extern "C" {
  * #I18N_UBRK_LINE, #I18N_UBRK_SENTENCE
  * @param[in] locale        The locale specifying the text-breaking conventions.
  *                          If @c NULL, the default locale will be used.
- * @param[in] text          The text to be iterated over.
+ * @param[in] text          The text to be iterated over. May be @c NULL, then the iterator will be created without any text.
+ *                          The text can be set later with i18n_ubrk_set_text() function.
  * @param[in] text_length   The number of characters in text, or -1 if NULL-terminated.
  * @param[out] break_iter   A pointer to the #i18n_ubreak_iterator_h for the specified locale.
  * @return The obtained error code.
index b29871b39330d18bf46335c374c227c06d83cf5d..91bf3e93cbd85c85d82900878072f08aa6087746 100644 (file)
@@ -1006,7 +1006,7 @@ int32_t i18n_ustring_to_title ( i18n_uchar *dest, int32_t dest_capacity, const i
  * algorithm of Unicode TR 21.\n
  * The result may be longer or shorter than the original.
  * The source string and the destination buffer are allowed to overlap.
- * @since_tizen MOBILE 2.3.1
+ * @since_tizen 2.3.1
  *
  * @param[out] dest A buffer for the result string.\n
  * The result will be zero-terminated if the buffer is large enough.
index 921688f7c71e2d85b4ce4f075e44edcaa50cc6cc..f0040d2dc1863a0774840ba5b56ab258c9117de4 100755 (executable)
@@ -233,11 +233,6 @@ extern "C" {
  * </tr>
  * <tr>
  *    <td>@ref CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE</td>
- *    <td>#i18n_ucalendar_is_in_daylight_time</td>
- *    <td>inDaylightTime</td>
- * </tr>
- * <tr>
- *    <td>@ref CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE</td>
  *    <td>#i18n_timezone_has_same_rule</td>
  *    <td>hasSameRules</td>
  * </tr>
index 1ae023e081b0cbcf98d244d8fb542ee6f789523a..391b343b9d18c4c6a2e49af6458107b5637c0dbf 100755 (executable)
@@ -250,7 +250,8 @@ const char* i18n_timezone_get_tzdata_version(void);
  * @param[in]  timezone_id The system time zone ID.
  * @param[out] region Output buffer for receiving the region code.
  * @param[out] region_len The length of the region code.
- * @param[in]  region_capacity The size of the output buffer.
+ * @param[in]  region_capacity The size of the output buffer. If it is lower than required @a region buffer size,
+ *                             then I18N_ERROR_BUFFER_OVERFLOW error is returned.
  *
  * @return the version string, such as "2007f"
  */
@@ -346,8 +347,8 @@ int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @param[in] timezone The i18n_timezone_h to get a display name.
- * @param[in] language The language in which to supply the display name.
- * @param[in] country The country in which to supply the display name.
+ * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale.
+ * @param[in] country The country in which to supply the display name. This parameter can be NULL.
  * @param[out] display_name The human-readable name of this time zone in the default locale.
  *
  * @retval #I18N_ERROR_NONE Successful
@@ -378,8 +379,8 @@ int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_uboo
  * @param[in] timezone The i18n_timezone_h to get a display name.
  * @param[in] daylight If true, display_name is filled with the daylight savings name.
  * @param[in] style The style displayed on.
- * @param[in] language The language in which to supply the display name.
- * @param[in] country The country in which to supply the display name.
+ * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale.
+ * @param[in] country The country in which to supply the display name. This parameter can be NULL.
  * @param[out] display_name The human-readable name of this time zone in the default locale.
  *
  * @retval #I18N_ERROR_NONE Successful
index 58b08be17ca7398c8de2c2cd85c393c3e0c8a183..beee7fb56785985224dd3205decaf6647c1a925b 100644 (file)
@@ -83,7 +83,7 @@ typedef enum {
     I18N_WARNING_STRING_NOT_TERMINATED      = TIZEN_ERROR_UTILITY_ICU | 0x1D,     /**< String not terminated with NULL. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_STD3_ASCII_RULES             = TIZEN_ERROR_UTILITY_ICU | 0x1E,     /**< Argument does not satisfy STD3 rules. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_UNASSIGNED                   = TIZEN_ERROR_UTILITY_ICU | 0x1F,     /**< Unassigned code points are found. @if MOBILE (Since 2.3.1) @endif*/
-    I18N_WARNING_SORT_KEY_TOO_SHORT         = -123,                               /**< Number of levels requested in getBound is higher than the number of levels in the sort key. @if MOBILE (Since 2.3.1) @endif*/
+    I18N_WARNING_SORT_KEY_TOO_SHORT         = TIZEN_ERROR_UTILITY_ICU | 0x20,     /**< Number of levels requested in getBound is higher than the number of levels in the sort key. @if MOBILE (Since 2.3.1) @endif*/
     I18N_ERROR_UNKNOWN                      = TIZEN_ERROR_UNKNOWN,                /**< Unknown error. @if MOBILE (Since 2.3.1) @endif*/
 } i18n_error_code_e;
 
index 059ab8730b47e4b4198d1b7c74d82e94db08c532..bdda0b4478ac3262ef949f74c15ae7eb47cdc78c 100755 (executable)
@@ -60,7 +60,8 @@ extern "C" {
  * #I18N_UBRK_LINE, #I18N_UBRK_SENTENCE
  * @param[in] locale        The locale specifying the text-breaking conventions.
  *                          If @c NULL, the default locale will be used.
- * @param[in] text          The text to be iterated over.
+ * @param[in] text          The text to be iterated over. May be @c NULL, then the iterator will be created without any text.
+ *                          The text can be set later with i18n_ubrk_set_text() function.
  * @param[in] text_length   The number of characters in text, or -1 if NULL-terminated.
  * @param[out] break_iter   A pointer to the #i18n_ubreak_iterator_h for the specified locale.
  * @return The obtained error code.
index 0721d6879035f8d7494038dea2042e55dccd900a..cd129da932ad17b24afac242d963444f59c456bf 100755 (executable)
@@ -68,7 +68,7 @@ extern "C" {
     dlog_print(DLOG_INFO, LOG_TAG, "%s %s %s\n", src, result == 1 ? "is equal to" : "is not equal to", target );    // tizen is not equal to bada
 
     // destroys the collator
-    i18n_ucollator_destroy( coll );  
+    i18n_ucollator_destroy( coll );
  * @endcode
  * @section CAPI_BASE_UTILS_I18N_UCOLLATOR_MODULE_SAMPLE_CODE_2 Sample Code 2
  * @brief Sorts in ascending order on the given data using string_ucollator
@@ -115,7 +115,7 @@ extern "C" {
     for ( i = 0; i < sizeof( src ) / sizeof( src[0] ); i++ ) {
         dlog_print(DLOG_INFO, LOG_TAG, "%s\n", src[i] );
     }    // ariplane    banana    cat
- * @endcode 
+ * @endcode
  */
 
 /**
@@ -141,7 +141,7 @@ extern "C" {
  */
 int i18n_ucollator_create ( const char *locale, i18n_ucollator_h *collator );
 
-/** 
+/**
  * @brief Closes a i18n_ucollator_h.
  * @details Once closed, a string_ucollator_h should not be used. Every an open collator should be closed. Otherwise, a memory leak will result.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 3be1937c16cbf33fab8e989d77adcfa4f677e3cc..05285eb80060008f9188dc0219cfb63883a053b8 100755 (executable)
@@ -51,7 +51,7 @@ extern "C" {
  * @brief Disposes of resources in use by the iterator.
  * @details If @c enumeration is <code>NULL</code>, does nothing. After this call, any <code>char*</code> or <code>i18n_uchar*</code> returned
  *          by i18n_uenumeration_unext() or i18n_uenumeration_next() is invalid.
- * @remarks Error codes are described in Exceptions section.
+ * @remarks Error codes are described in #i18n_error_code_e description.
  * @since_tizen 2.3.1
  *
  * @param[in] enumeration    An #i18n_uenumeration_h to destroy
@@ -132,7 +132,7 @@ const char *i18n_uenumeration_next ( i18n_uenumeration_h enumeration, int32_t *r
 /**
  * @brief Resets the iterator to the current list of service IDs.
  * @details This re-establishes sync with the service and rewinds the iterator to start at the first element.
- * @remarks Error codes are described in Exceptions section and #i18n_error_code_e description.
+ * @remarks Error codes are described in #i18n_error_code_e description.
  * @since_tizen 2.3.1
  *
  * @param[in] enumeration      An #i18n_uenumeration_h
@@ -140,7 +140,6 @@ const char *i18n_uenumeration_next ( i18n_uenumeration_h enumeration, int32_t *r
  * @return The obtained error code.
  * @retval #I18N_ERROR_NONE Successful
  * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
- * @retval #I18N_ERROR_ENUM_OUT_OF_SYNC The iterator is out of sync
  */
 int i18n_uenumeration_reset ( i18n_uenumeration_h enumeration );
 
@@ -148,7 +147,7 @@ int i18n_uenumeration_reset ( i18n_uenumeration_h enumeration );
  * @brief Given an array of <code>const i18n_uchar*</code> strings, return an #i18n_uenumeration_h.
  * @details String pointers from 0..count-1 must not be <code>NULL</code>.
  *          Do not free or modify either the string array or the characters it points to until this object has been destroyed with i18n_uenumeration_destroy().
- * @remarks Error codes are described in Exceptions section and #i18n_error_code_e description.
+ * @remarks Error codes are described in #i18n_error_code_e description.
  * @since_tizen 2.3.1
  *
  * @param[in] strings     An array of const <code>i18n_uchar*</code> strings (each null terminated). All storage is owned by the caller.
@@ -167,7 +166,7 @@ int i18n_uenumeration_uchar_strings_enumeration_create(const i18n_uchar *const s
  * @brief Given an array of <code>const char*</code> strings (invariant chars only), return an #i18n_uenumeration_h.
  * @details String pointers from 0..count-1 must not be <code>NULL</code>.
  *          Do not free or modify either the string array or the characters it points to until this object has been destroyed with i18n_uenumeration_destroy().
- * @remarks Error codes are described in Exceptions section and #i18n_error_code_e description.
+ * @remarks Error codes are described in #i18n_error_code_e description.
  * @since_tizen 2.3.1
  *
  * @param[in] strings     A array of <code>char*</code> strings (each null terminated). All storage is owned by the caller.
index 26c77d9474e84ee8e56ec6bb2307706d93f42254..ad5de02e2f78b205a59f337994dcb83e23ac22ec 100755 (executable)
@@ -212,7 +212,8 @@ const char* i18n_timezone_get_tzdata_version(void)
 
 int i18n_timezone_get_region(const char *timezone_id, char *region, int32_t *region_len, int32_t region_capacity)
 {
-    retv_if(timezone_id == NULL, I18N_ERROR_INVALID_PARAMETER);
+    retv_if(timezone_id == NULL || region == NULL || region_len == NULL, I18N_ERROR_INVALID_PARAMETER);
+
     UErrorCode status = U_ZERO_ERROR;
     const UnicodeString id(timezone_id);
     *region_len = TimeZone::getRegion(id, region, region_capacity, status);
@@ -223,7 +224,8 @@ int i18n_timezone_get_region(const char *timezone_id, char *region, int32_t *reg
 
 int i18n_timezone_get_offset_with_date(i18n_timezone_h timezone, i18n_udate date, i18n_ubool local, int32_t *raw_offset, int32_t *dst_offset)
 {
-    retv_if(timezone == NULL, I18N_ERROR_INVALID_PARAMETER);
+    retv_if(timezone == NULL || raw_offset == NULL || dst_offset == NULL, I18N_ERROR_INVALID_PARAMETER);
+
     UErrorCode status = U_ZERO_ERROR;
     ((TimeZone*)timezone)->getOffset( date, local, *raw_offset, *dst_offset, status );
 
@@ -241,7 +243,8 @@ int i18n_timezone_set_raw_offset(i18n_timezone_h timezone, int32_t offset_millis
 
 int i18n_timezone_get_raw_offset(i18n_timezone_h timezone, int32_t *offset_milliseconds)
 {
-    retv_if(timezone == NULL, I18N_ERROR_INVALID_PARAMETER);
+    retv_if(timezone == NULL || offset_milliseconds == NULL, I18N_ERROR_INVALID_PARAMETER);
+
     *offset_milliseconds = ((TimeZone*)timezone)->getRawOffset();
 
     return I18N_ERROR_NONE;
index 77c588f2dac08e960ece3b2040d5407a4de7e76a..6de7b6ba5242f8dc0066dd0e9bac8a0d75b23c46 100644 (file)
@@ -385,12 +385,34 @@ int32_t i18n_ucalendar_get_limit ( const i18n_ucalendar_h calendar, i18n_ucalend
         set_last_result(I18N_ERROR_INVALID_PARAMETER);
         return 0;
     }
-    i18n_error_code_e i18n_error;
-    UErrorCode icu_error = U_ZERO_ERROR;
-    int32_t result_ucal_getLimit = ucal_getLimit(calendar, field, type, &icu_error);
-    ERR("ErrorCode : %d", icu_error);
-    ERR_MAPPING(icu_error, i18n_error);
-    set_last_result(i18n_error);
+
+    int32_t result_ucal_getLimit = 0;
+    switch (field) {
+        case I18N_UCALENDAR_YEAR_WOY:
+        case I18N_UCALENDAR_DOW_LOCAL:
+        case I18N_UCALENDAR_EXTENDED_YEAR:
+        case I18N_UCALENDAR_JULIAN_DAY:
+        case I18N_UCALENDAR_MILLISECONDS_IN_DAY:
+        case I18N_UCALENDAR_IS_LEAP_MONTH:
+        case I18N_UCALENDAR_FIELD_COUNT:
+            {
+                set_last_result(I18N_ERROR_INVALID_PARAMETER);
+                ERR("Unsupported filed");
+                break;               
+            }
+        default:
+            {
+                i18n_error_code_e i18n_error = I18N_ERROR_NONE;
+                UErrorCode icu_error = U_ZERO_ERROR;
+                int32_t limit = ucal_getLimit(calendar, field, type, &icu_error);
+                ERR("ErrorCode : %d", icu_error);
+                ERR_MAPPING(icu_error, i18n_error);
+                set_last_result(i18n_error);
+                if(i18n_error == I18N_ERROR_NONE)
+                    result_ucal_getLimit = limit;                
+            }
+    }
+
     return result_ucal_getLimit;
 }
 
index 0bdb1598b536a25481be42aaf9d70eac465d6513..cf44f444237f7fec2687aba39f71037fb6b6a023 100644 (file)
@@ -59,7 +59,18 @@ int i18n_udate_to_calendar_date_field ( i18n_udate_format_field_e field, i18n_uc
     {
         return I18N_ERROR_INVALID_PARAMETER;
     }
-    *date_field_type = (i18n_ucalendar_date_fields_e)udat_toCalendarDateField(field);
+
+    switch (field) {
+        case I18N_UDATE_FORMAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD:
+        case I18N_UDATE_FORMAT_TIMEZONE_ISO_FIELD:
+        case I18N_UDATE_FORMAT_TIMEZONE_ISO_LOCAL_FIELD:
+        case I18N_UDATE_FORMAT_FIELD_COUNT:
+            ERR("Unsupported filed");
+            return I18N_ERROR_INVALID_PARAMETER;
+        default:
+            *date_field_type = (i18n_ucalendar_date_fields_e)udat_toCalendarDateField(field);
+    }
+
     return I18N_ERROR_NONE;
 }
 
@@ -97,7 +108,7 @@ int i18n_udate_parse ( const i18n_udate_format_h format, const i18n_uchar *text,
 
 int i18n_udate_parse_calendar (const i18n_udate_format_h format, i18n_ucalendar_h * calendar, const i18n_uchar *text, int32_t text_length, int32_t *parse_pos )
 {
-    if (format == NULL || calendar == NULL || text == NULL)
+    if (format == NULL || calendar == NULL || text == NULL || text_length < -1)
     {
         return I18N_ERROR_INVALID_PARAMETER;
     }
@@ -135,7 +146,7 @@ int i18n_udate_set_lenient ( i18n_udate_format_h format, i18n_ubool is_lenient )
 
 int i18n_udate_get_calendar ( const i18n_udate_format_h format, i18n_ucalendar_h *calendar)
 {
-    if (format == NULL)
+    if (format == NULL || calendar == NULL)
     {
         return I18N_ERROR_INVALID_PARAMETER;
     }
@@ -283,7 +294,7 @@ int32_t i18n_udate_count_symbols ( const i18n_udate_format_h format, i18n_udate_
 
 int i18n_udate_set_symbols ( i18n_udate_format_h format, i18n_udate_format_symbol_type_e type, int32_t symbol_index, i18n_uchar *value, int32_t value_length )
 {
-    if (format == NULL)
+    if (format == NULL || symbol_index < 0)
     {
         return I18N_ERROR_INVALID_PARAMETER;
     }
index aa1973f9c0c714eae94c2166555c9923a5e8a1af..ff1b2e56c5af2b554c7af705db9f86dd8c6bb8fd 100755 (executable)
@@ -47,8 +47,18 @@ int i18n_ulocale_get_language (const char *locale_id, char *language, int32_t la
 
 int32_t i18n_ulocale_get_country (const char *locale_id, char *country, int32_t country_capacity, int *error)
 {
-    int32_t result = uloc_getCountry(locale_id, country, country_capacity, error);
-    *error = _i18n_error_mapping(*error);
+    if(NULL == country) {
+        if(NULL != error) {
+            *error = I18N_ERROR_INVALID_PARAMETER;
+        }
+        return 0;
+    }
+
+    UErrorCode icu_error = U_ZERO_ERROR;
+    int32_t result = uloc_getCountry(locale_id, country, country_capacity, &icu_error);
+    if(NULL != error) {
+        *error = _i18n_error_mapping(icu_error);
+    }
 
     return result;
 }
@@ -291,7 +301,7 @@ int i18n_ulocale_keywords_create (const char *locale_id, i18n_uenumeration_h *en
 int32_t i18n_ulocale_get_keyword_value (const char *locale_id, const char *keyword_name, char *buffer,
         int32_t buffer_capacity)
 {
-    if(NULL == keyword_name || NULL == buffer || buffer_capacity < 0){
+    if(NULL == locale_id || NULL == keyword_name || NULL == buffer || buffer_capacity < 0){
         set_last_result(I18N_ERROR_INVALID_PARAMETER);
         return -1;
     }
index b6bbf22b2d7bfb7f0015a7e8a5a4e5c83f25e8ef..cda3dd988e11beb4897d365f90d88457e160b6dc 100755 (executable)
@@ -40,7 +40,7 @@ int i18n_unumber_destroy (i18n_unumber_format_h fmt)
 
 int i18n_unumber_get_symbol (const i18n_unumber_format_h fmt, i18n_unumber_format_symbol_e symbol, i18n_uchar *buffer, int32_t size, int32_t *len_symbol)
 {
-    retv_if(fmt == NULL, I18N_ERROR_INVALID_PARAMETER);
+    retv_if(fmt == NULL || len_symbol == NULL, I18N_ERROR_INVALID_PARAMETER);
 
     UErrorCode icu_error = U_ZERO_ERROR;
     *len_symbol = unum_getSymbol(fmt, symbol, buffer, size, &icu_error);
@@ -115,7 +115,7 @@ int32_t i18n_unumber_format_double (const i18n_unumber_format_h fmt, double numb
 
 int32_t i18n_unumber_format_decimal (const i18n_unumber_format_h fmt, const char *number, int32_t length, i18n_uchar *result, int32_t result_length, i18n_ufield_position_h pos)
 {
-    if(fmt == NULL) {
+    if(fmt == NULL || number == NULL) {
         set_last_result(I18N_ERROR_INVALID_PARAMETER);
         return 0;
     }
@@ -217,7 +217,7 @@ int32_t i18n_unumber_parse_decimal (const i18n_unumber_format_h fmt, const i18n_
 
 double i18n_unumber_parse_double_currency (const i18n_unumber_format_h fmt, const i18n_uchar *text, int32_t text_length, int32_t *parse_pos, i18n_uchar *currency)
 {
-    if(fmt == NULL || text == NULL) {
+    if(fmt == NULL || text == NULL || currency == NULL) {
         set_last_result(I18N_ERROR_INVALID_PARAMETER);
         return 0;
     }
@@ -234,7 +234,7 @@ double i18n_unumber_parse_double_currency (const i18n_unumber_format_h fmt, cons
 
 int i18n_unumber_apply_pattern (i18n_unumber_format_h format, i18n_ubool localized, const i18n_uchar *pattern, int32_t pattern_length, i18n_uparse_error_s* parse_error)
 {
-    if(format == NULL) {
+    if(format == NULL || pattern == NULL || pattern_length < -1) {
         return I18N_ERROR_INVALID_PARAMETER;
     }
 
index ef109dd00220d77b5acb109877654c39800f4ed9..b8e6f897bd21bab2adb244077b04d5dbfd2a22a7 100644 (file)
@@ -84,7 +84,7 @@ int i18n_uset_destroy ( i18n_uset_h set )
 int i18n_uset_clone ( const i18n_uset_h set, i18n_uset_h *set_clone )
 {
     set_last_result(I18N_ERROR_NONE);
-    if (set == NULL) {
+    if (set == NULL || set_clone == NULL) {
         return I18N_ERROR_INVALID_PARAMETER;
     }
     *set_clone = (i18n_uset_h)uset_clone((const USet*)set);
@@ -114,7 +114,7 @@ int i18n_uset_freeze ( i18n_uset_h set )
 int i18n_uset_clone_as_thawed ( const i18n_uset_h set, i18n_uset_h *set_copy )
 {
     set_last_result(I18N_ERROR_NONE);
-    if (set == NULL) {
+    if (set == NULL || set_copy == NULL) {
         return I18N_ERROR_INVALID_PARAMETER;
     }
     *set_copy = (i18n_uset_h)uset_cloneAsThawed((const USet*)set);
@@ -482,7 +482,7 @@ int32_t i18n_uset_get_item_count ( const i18n_uset_h set )
 int32_t i18n_uset_get_item ( const i18n_uset_h set, int32_t item_index, i18n_uchar32 *start, i18n_uchar32 *end,
         i18n_uchar *str, int32_t str_capacity )
 {
-    if (set == NULL || (item_index < 0 || item_index > uset_getItemCount((const USet*)set)-1)) {
+    if (set == NULL || (item_index < 0 || item_index > uset_getItemCount((const USet*)set)-1) || start == NULL || end == NULL) {
        set_last_result(I18N_ERROR_INVALID_PARAMETER);
        return 0;
     }