From: JinWang An Date: Mon, 27 May 2024 06:32:16 +0000 (+0900) Subject: Fix example source code for matching API argument X-Git-Tag: accepted/tizen/8.0/unified/20240530.161328~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27b17315b786c27a0645690c240ad3338970ef3e;p=platform%2Fcore%2Fapi%2Fbase-utils.git Fix example source code for matching API argument Change-Id: Id219a070b654619cd2c723053358d9fda64900f9 Signed-off-by: JinWang An --- diff --git a/src/include/utils_i18n_timezone.h b/src/include/utils_i18n_timezone.h index b2fddbb..eb2e685 100644 --- a/src/include/utils_i18n_timezone.h +++ b/src/include/utils_i18n_timezone.h @@ -500,7 +500,7 @@ int i18n_timezone_set_id(i18n_timezone_h timezone, const char *timezone_id); * * int main() * { - * char *displayname; + * char *display_name; * i18n_timezone_h timezone = NULL; * i18n_error_code_e error_code; * char timezone_id[10]; @@ -509,18 +509,18 @@ int i18n_timezone_set_id(i18n_timezone_h timezone, const char *timezone_id); * snprintf(timezone_id, 10, (gmt<0)? "GMT%d:00" : "GMT+%d:00", gmt); * error_code = i18n_timezone_create(&timezone, timezone_id); * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_create: %d\n", error_code); - * return EXIT_FAILURE; + * printf("Error i18n_timezone_create: %d\n", error_code); + * return EXIT_FAILURE; * } * - * error_code = i18n_timezone_get_display_name(timezone, &displayname); + * error_code = i18n_timezone_get_display_name(timezone, &display_name); * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_get_display_name: %d\n", error_code); - * i18n_timezone_destroy(timezone); - * return EXIT_FAILURE; + * printf("Error i18n_timezone_get_display_name: %d\n", error_code); + * i18n_timezone_destroy(timezone); + * return EXIT_FAILURE; * } - * printf("Created %s timezone displayname: %s\n", timezone_id, displayname); - * free(displayname); + * printf("Created %s timezone display_name: %s\n", timezone_id, display_name); + * free(display_name); * i18n_timezone_destroy(timezone); * timezone = NULL; * } @@ -554,7 +554,7 @@ int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name * { * const char *language = I18N_ULOCALE_ENGLISH; * const char *country = "US"; - * char *displayname; + * char *display_name; * i18n_timezone_h timezone = NULL; * i18n_error_code_e error_code; * char timezone_id[10]; @@ -563,18 +563,18 @@ int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name * snprintf(timezone_id, 10, (gmt<0)? "GMT%d:00" : "GMT+%d:00", gmt); * error_code = i18n_timezone_create(&timezone, timezone_id); * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_create: %d\n", error_code); - * return EXIT_FAILURE; + * printf("Error i18n_timezone_create: %d\n", error_code); + * return EXIT_FAILURE; * } * - * error_code = i18n_timezone_get_display_name_with_locale(timezone, language, country, &displayname); + * error_code = i18n_timezone_get_display_name_with_locale(timezone, language, country, &display_name); * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_get_display_name_with_locale: %d\n", error_code); - * i18n_timezone_destroy(timezone); - * return EXIT_FAILURE; + * printf("Error i18n_timezone_get_display_name_with_locale: %d\n", error_code); + * i18n_timezone_destroy(timezone); + * return EXIT_FAILURE; * } - * printf("Created %s timezone displayname: %s\n", timezone_id, displayname); - * free(displayname); + * printf("Created %s timezone display_name: %s\n", timezone_id, display)name); + * free(display_name); * * i18n_timezone_destroy(timezone); * timezone = NULL; @@ -610,7 +610,7 @@ int i18n_timezone_get_display_name_with_locale(i18n_timezone_h timezone, const c * i18n_ubool daylight = true; * i18n_timezone_display_type_e type = I18N_TIMEZONE_DISPLAY_TYPE_SHORT; * i18n_error_code_e error_code; - * char *displayname; + * char *display_name; * char timezone_id[10]; * int gmt = -12; * for(; gmt < 15; gmt++) { @@ -618,19 +618,19 @@ int i18n_timezone_get_display_name_with_locale(i18n_timezone_h timezone, const c * snprintf(timezone_id, 10, (gmt<0)? "GMT%d:00" : "GMT+%d:00", gmt); * error_code = i18n_timezone_create(&timezone, timezone_id); * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_create: %d\n", error_code); - * return EXIT_FAILURE; + * printf("Error i18n_timezone_create: %d\n", error_code); + * return EXIT_FAILURE; * } * * for(; type <= I18N_TIMEZONE_DISPLAY_TYPE_GENERIC_LOCATION; type++) { - * error_code = i18n_timezone_get_display_name_with_type(timezone, daylight, type, &displayname); - * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_timezone_get_display_name_with_type: %d\n", error_code); - * i18n_timezone_destroy(timezone); - * return EXIT_FAILURE; - * } - * printf("Created %s timezone displayname: %s\n", timezone_id, displayname); - * free(displayname); + * error_code = i18n_timezone_get_display_name_with_type(timezone, daylight, type, &display_name); + * if (error_code!= I18N_ERROR_NONE) { + * printf("Error i18n_timezone_get_display_name_with_type: %d\n", error_code); + * i18n_timezone_destroy(timezone); + * return EXIT_FAILURE; + * } + * printf("Created %s timezone display_name: %s\n", timezone_id, display_name); + * free(display_name); * } * * error_code = i18n_timezone_destroy(timezone); @@ -672,7 +672,7 @@ int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_uboo * char *timezone_id = NULL; * const char *language = I18N_ULOCALE_ENGLISH; * const char *country = "US"; - * char *displayname; + * char *display_name; * * error_code = i18n_timezone_create_default(&timezone); * if (error_code!= I18N_ERROR_NONE) { @@ -680,7 +680,7 @@ int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_uboo * return EXIT_FAILURE; * } * - * error_code = i18n_timezone_get_display_name_with_type_locale(timezone, daylight, style, language, country, &displayname); + * error_code = i18n_timezone_get_display_name_with_type_locale(timezone, daylight, style, language, country, &display_name); * if (error_code!= I18N_ERROR_NONE) { * printf("Error i18n_timezone_get_display_name_with_type_locale: %d\n", error_code); * i18n_timezone_destroy(timezone); @@ -688,10 +688,10 @@ int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_uboo * } * * i18n_timezone_get_id(timezone, &timezone_id); - * printf("Created %s timezone displayname: %s\n", timezone_id, displayname); + * printf("Created %s timezone display_name: %s\n", timezone_id, display_name); * * i18n_timezone_destroy(timezone); - * free(displayname); + * free(display_name); * free(timezone_id); * * return EXIT_SUCCESS; diff --git a/src/include/utils_i18n_ubrk.h b/src/include/utils_i18n_ubrk.h index 1fa9568..3d6d4b3 100644 --- a/src/include/utils_i18n_ubrk.h +++ b/src/include/utils_i18n_ubrk.h @@ -73,7 +73,7 @@ int i18n_ubrk_create(i18n_ubreak_iterator_type_e type, const char *locale, const * @brief Opens a new #i18n_ubreak_iterator_h for locating text boundaries using specified breaking rules. * @remarks Error codes are described in #i18n_error_code_e description. * @since_tizen 2.3.1 - * @remarks The @a break_itr and @a parse_err should not be released. + * @remarks The @a break_iter and @a parse_err should not be released. * @param[in] rules A set of rules specifying the text breaking conventions. * @param[in] rules_length The number of characters in rules, or -1 if NULL-terminated. * @param[in] text The text to be iterated over. May be @c NULL, in which case i18n_ubrk_set_text() is diff --git a/src/include/utils_i18n_ucalendar.h b/src/include/utils_i18n_ucalendar.h index ab951be..1955afb 100644 --- a/src/include/utils_i18n_ucalendar.h +++ b/src/include/utils_i18n_ucalendar.h @@ -202,7 +202,7 @@ int i18n_ucalendar_destroy(i18n_ucalendar_h calendar); * i18n_error_code_e error_code; * * error_code = i18n_ucalendar_create(NULL, -1, I18N_ULOCALE_US, I18N_UCALENDAR_DEFAULT, &cal); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_create: %d\n", error_code); * return EXIT_FAILURE; * } @@ -210,7 +210,7 @@ int i18n_ucalendar_destroy(i18n_ucalendar_h calendar); * i18n_ucalendar_set_date_time(cal, 2000, 1, 1, 1, 1, 1); * * error_code = i18n_ucalendar_clone(cal, &identical_to_cal); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_clone: %d\n", error_code); * i18n_ucalendar_destroy(cal); * return EXIT_FAILURE; @@ -473,7 +473,7 @@ int32_t i18n_ucalendar_get_field_difference(i18n_ucalendar_h calendar, i18n_udat * i18n_uenumeration_h enumeration = NULL; * i18n_error_code_e error_code; * error_code = i18n_ucalendar_timezone_id_enumeration_create(I18N_UCALENDAR_ZONE_TYPE_ANY, "US", NULL, &enumeration); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_timezone_id_enumeration_create: %d\n", error_code); * return EXIT_FAILURE; * } @@ -503,7 +503,7 @@ int i18n_ucalendar_timezone_id_enumeration_create(i18n_system_timezone_type_e zo * i18n_uenumeration_h enumeration = NULL; * i18n_error_code_e error_code; * error_code = i18n_ucalendar_timezones_create(&enumeration); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_timezones_create: %d\n", error_code); * return EXIT_FAILURE; * } @@ -536,7 +536,7 @@ int i18n_ucalendar_timezones_create(i18n_uenumeration_h *enumeration); * i18n_uenumeration_h enumeration = NULL; * i18n_error_code_e error_code; * error_code = i18n_ucalendar_country_timezones_create("US", &enumeration); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_country_timezones_create: %d\n", error_code); * return EXIT_FAILURE; * } @@ -913,7 +913,7 @@ const char *i18n_ucalendar_get_type(const i18n_ucalendar_h calendar); * i18n_uenumeration_h enumeration = NULL; * * error_code = i18n_ucalendar_create(NULL, -1, I18N_ULOCALE_US, I18N_UCALENDAR_DEFAULT, &cal); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucalendar_create: %d\n", error_code); * return EXIT_FAILURE; * } diff --git a/src/include/utils_i18n_uchar_iter.h b/src/include/utils_i18n_uchar_iter.h index fb5a29b..1c35f08 100644 --- a/src/include/utils_i18n_uchar_iter.h +++ b/src/include/utils_i18n_uchar_iter.h @@ -71,13 +71,13 @@ extern "C" { * * int main() { * i18n_error_code_e error_code; - * i18n_uchar_iter_h uchar_iter = NULL; - * error_code = i18n_uchar_iter_create(&uchar_iter); + * i18n_iter_h iter = NULL; + * error_code = i18n_iter_create(&iter); * if (error_code != I18N_ERROR_NONE) { - * printf("Error i18n_uchar_iter_create: %d\n", error_code); + * printf("Error i18n_iter_create: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_uchar_iter_destroy(uchar_iter); + * i18n_iter_destroy(iter); * return EXIT_SUCCESS; * } * diff --git a/src/include/utils_i18n_ucnv.h b/src/include/utils_i18n_ucnv.h index bebfd87..61c8015 100644 --- a/src/include/utils_i18n_ucnv.h +++ b/src/include/utils_i18n_ucnv.h @@ -117,14 +117,14 @@ int i18n_ucnv_compare_names(const char *name1, const char *name2); * #include * #include * int main() { - * i18n_ucnv_h cnv; + * i18n_ucnv_h converter; * i18n_error_code_e error_code; - * error_code = i18n_ucnv_create("ibm-949", &cnv); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnv_create("ibm-949", &converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_create: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_ucnv_destroy(cnv); + * i18n_ucnv_destroy(converter); * return EXIT_SUCCESS; * } * @endcode @@ -159,15 +159,15 @@ int i18n_ucnv_create(const char *converter_name, i18n_ucnv_h *converter); * #include * #include * int main() { - * i18n_ucnv_h cnv; + * i18n_ucnv_h converter; * i18n_error_code_e error_code; - * i18n_uchar converter_name[] = {0x0069, 0x0062, 0x006d, 0x002d, 0x0039, 0x0034, 0x0033, 0x0000}; - * error_code = i18n_ucnv_create_unicode(converter_name, &cnv); - * if (error_code!= I18N_ERROR_NONE) { + * i18n_uchar name[] = {0x0069, 0x0062, 0x006d, 0x002d, 0x0039, 0x0034, 0x0033, 0x0000}; + * error_code = i18n_ucnv_create_unicode(name, &converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_create: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_ucnv_destroy(cnv); + * i18n_ucnv_destroy(converter); * return EXIT_SUCCESS; * } * @endcode @@ -210,18 +210,18 @@ int i18n_ucnv_create_unicode(const i18n_uchar *name, i18n_ucnv_h *converter); * #include * #include * int main() { - * i18n_ucnv_h cnv; + * i18n_ucnv_h converter; * i18n_error_code_e error_code; * int32_t ccsids[] = {37, 850, 943, 949, 950, 1047, 1252, 1392, 33722}; * * for (int i = 0; i < 9; ++i) * { - * error_code = i18n_ucnv_create_ccsid(ccsids[i], I18N_UCNV_IBM, &cnv); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnv_create_ccsid(ccsids[i], I18N_UCNV_IBM, &converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_create_ccsid: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_ucnv_destroy(cnv); + * i18n_ucnv_destroy(converter); * } * return EXIT_SUCCESS; * } @@ -256,14 +256,14 @@ int i18n_ucnv_create_ccsid(int32_t codepage, i18n_ucnv_platform_e platform, i18n * #include * #include * int main() { - * i18n_ucnv_h cnv; + * i18n_ucnv_h converter; * i18n_error_code_e error_code; - * error_cod e= i18n_ucnv_create_package("", "", &cnv); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnv_create_package("", "", &converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_create_package: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_ucnv_destroy(cnv); + * i18n_ucnv_destroy(converter); * return EXIT_SUCCESS; * } * @endcode @@ -285,22 +285,22 @@ int i18n_ucnv_create_package(const char *package_name, const char *converter_nam * #include * #include * int main() { - * i18n_ucnv_h cnv; - * i18n_ucnv_h cnv2; + * i18n_ucnv_h converter; + * i18n_ucnv_h cloned_converter; * i18n_error_code_e error_code; - * error_code= i18n_ucnv_create("iso-8859-3", &cnv); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnv_create("iso-8859-3", &converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_create: %d\n", error_code); * return EXIT_FAILURE; * } - * error_code= i18n_ucnv_safe_clone(cnv, &cnv2); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnv_safe_clone(converter, &cloned_converter); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnv_safe_clone: %d\n", error_code); - * i18n_ucnv_destroy(cnv); + * i18n_ucnv_destroy(converter); * return EXIT_FAILURE; * } - * i18n_ucnv_destroy(cnv); - * i18n_ucnv_destroy(cnv2); + * i18n_ucnv_destroy(converter); + * i18n_ucnv_destroy(cloned_converter); * return EXIT_SUCCESS; * } * @endcode diff --git a/src/include/utils_i18n_ucnvsel.h b/src/include/utils_i18n_ucnvsel.h index 5e7182c..93b838b 100644 --- a/src/include/utils_i18n_ucnvsel.h +++ b/src/include/utils_i18n_ucnvsel.h @@ -131,46 +131,35 @@ int i18n_ucnvsel_serialize(const i18n_uconverter_selector_h sel, void *buffer, i * const char *char_str = "Hello World!"; * const i18n_uchar string[20] = {0,}; * i18n_error_code_e error_code; - * int32_t len; + * int32_t length; * - * error_code = i18n_ucalendar_timezone_id_enumeration_create(I18N_UCALENDAR_ZONE_TYPE_ANY, "US", NULL, &enumeration); - * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_ucalendar_timezone_id_enumeration_create: %d\n", error_code); - * return EXIT_FAILURE; - * } - * - * i18n_ustring_from_UTF8((i18n_uchar *)string, I18N_UPRV_LENGTHOF(string), &len, char_str, 5, &error_code); - * if (error_code!= I18N_ERROR_NONE) { + * i18n_ustring_from_UTF8((i18n_uchar *)string, I18N_UPRV_LENGTHOF(string), &length, char_str, 5, &error_code); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ustring_from_UTF8: %d\n", error_code); - * i18n_uenumeration_destroy(enumeration); * return EXIT_FAILURE; * } * * error_code = i18n_uset_create_empty(&excluded_set); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create_empty: %d\n", error_code); - * i18n_uenumeration_destroy(enumeration); * return EXIT_FAILURE; * } * * error_code = i18n_ucnvsel_create(NULL, 0, excluded_set, I18N_UCNV_ROUNDTRIP_AND_FALLBACK_SET, &sel); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnvsel_create: %d\n", error_code); - * i18n_uset_destroy(excluded_set); - * i18n_uenumeration_destroy(enumeration); + * i18n_uset_destroy(excluded_set); * return EXIT_FAILURE; * } * - * error_code = i18n_ucnvsel_select_for_string(sel, string, len, &enumeration); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnvsel_select_for_string(sel, string, length, &enumeration); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnvsel_select_for_string: %d\n", error_code); - * i18n_uenumeration_destroy(enumeration); - * i18n_uset_destroy(excluded_set); + * i18n_uset_destroy(excluded_set); * i18n_ucnvsel_destroy(sel); * return EXIT_FAILURE; * } * - * i18n_uenumeration_destroy(enumeration); * i18n_uset_destroy(excluded_set); * i18n_ucnvsel_destroy(sel); * return EXIT_SUCCESS; @@ -193,9 +182,9 @@ int i18n_ucnvsel_select_for_string(const i18n_uconverter_selector_h sel, const i * * @code * #include + * #include * #include * #include - * #define I18N_UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) * * int main() { * i18n_uenumeration_h enumeration = NULL; @@ -204,34 +193,27 @@ int i18n_ucnvsel_select_for_string(const i18n_uconverter_selector_h sel, const i * const char *string = "Hello World!"; * i18n_error_code_e error_code; * - * error_code = i18n_ucalendar_timezone_id_enumeration_create(I18N_UCALENDAR_ZONE_TYPE_ANY, "US", NULL, &enumeration); - * if (error_code!= I18N_ERROR_NONE) { - * printf("Error i18n_ucalendar_timezone_id_enumeration_create: %d\n", error_code); - * return EXIT_FAILURE; - * } - * * error_code = i18n_uset_create_empty(&excluded_set); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } * * error_code = i18n_ucnvsel_create(NULL, 0, excluded_set, I18N_UCNV_ROUNDTRIP_AND_FALLBACK_SET, &sel); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnvsel_create: %d\n", error_code); - * i18n_uset_destroy(excluded_set); + * i18n_uset_destroy(excluded_set); * return EXIT_FAILURE; * } * - * error_code = i18n_ucnvsel_select_for_utf8(sel, string, 5, &enumeration); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucnvsel_select_for_utf8(sel, string, strlen(string), &enumeration); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucnvsel_select_for_utf8: %d\n", error_code); - * i18n_uset_destroy(excluded_set); + * i18n_uset_destroy(excluded_set); * i18n_ucnvsel_destroy(sel); * return EXIT_FAILURE; * } * - * i18n_uenumeration_destroy(enumeration); * i18n_uset_destroy(excluded_set); * i18n_ucnvsel_destroy(sel); * return EXIT_SUCCESS; diff --git a/src/include/utils_i18n_ucollator.h b/src/include/utils_i18n_ucollator.h index 2775ea4..f873126 100644 --- a/src/include/utils_i18n_ucollator.h +++ b/src/include/utils_i18n_ucollator.h @@ -186,21 +186,23 @@ int i18n_ucollator_create(const char *locale, i18n_ucollator_h *collator); * @code * #include * #include + * #include * #include * int main() { * i18n_error_code_e error_code; - * i18n_ucollator_h coll = NULL; + * i18n_ucollator_h collator = NULL; * i18n_uparse_error_s parse_error; - * i18n_uchar uchar_rules[128]; + * const char *test_rules = "&9 < a, A < b, B < c, C; ch, cH, Ch, CH < d, D, e, E"; + * i18n_uchar rules[128]; * - * i18n_ustring_copy_ua(uchar_rules, rules); - * error_code = i18n_ucollator_create_rules(uchar_rules, -1, I18N_UCOLLATOR_ON, I18N_UCOLLATOR_DEFAULT_STRENGTH, - * &parse_error, &coll); - * if (error_code!= I18N_ERROR_NONE) { + * i18n_ustring_copy_ua(rules, test_rules); + * error_code = i18n_ucollator_create_rules(rules, strlen(test_rules), I18N_UCOLLATOR_ON, I18N_UCOLLATOR_DEFAULT_STRENGTH, + * &parse_error, &collator); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_create_rules: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_ucollator_destroy(coll); + * i18n_ucollator_destroy(collator); * return EXIT_SUCCESS; * } * @endcode @@ -528,10 +530,15 @@ int i18n_ucollator_get_display_name(const char *obj_locale, const char *disp_loc * @retval #I18N_ERROR_NONE Successful * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter * @code + * i18n_error_code_e error_code; * const char *locale = NULL; * int32_t locale_index = 0; * * i18n_ucollator_get_available(locale_index, &locale); + * if (error_code != I18N_ERROR_NONE) { + * printf("Error i18n_ucollator_get_available: %d\n", error_code); + * return EXIT_FAILURE; + * } * @endcode */ int i18n_ucollator_get_available(int32_t locale_index, const char **locale); @@ -568,7 +575,7 @@ int i18n_ucollator_count_available(int32_t *n_available); * i18n_uenumeration_h locales; * * error_code = i18n_ucollator_create_available_locales(&locales); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_create_available_locales: %d\n", error_code); * return EXIT_FAILURE; * } @@ -599,7 +606,7 @@ int i18n_ucollator_create_available_locales(i18n_uenumeration_h *locales); * i18n_uenumeration_h keywords; * * error_code = i18n_ucollator_get_keywords(&keywords); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_get_keywords: %d\n", error_code); * return EXIT_FAILURE; * } @@ -629,14 +636,14 @@ int i18n_ucollator_get_keywords(i18n_uenumeration_h *keywords); * #include * int main() { * i18n_error_code_e error_code; - * i18n_uenumeration_h keyword_values; + * i18n_uenumeration_h keyword; * - * error_code = i18n_ucollator_get_keyword_values("collation", &keyword_values); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucollator_get_keyword_values("collation", &keyword); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_get_keyword_values: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_uenumeration_destroy(keyword_values); + * i18n_uenumeration_destroy(keyword); * return EXIT_SUCCESS; * } * @endcode @@ -671,7 +678,7 @@ int i18n_ucollator_get_keyword_values(const char *keyword, i18n_uenumeration_h * * i18n_uenumeration_h keywords; * * error_code = i18n_ucollator_get_keyword_values_for_locale("collation", "en_US", false, &keywords); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_get_keyword_values_for_locale: %d\n", error_code); * return EXIT_FAILURE; * } @@ -991,22 +998,22 @@ int i18n_ucollator_get_variable_top(i18n_ucollator_h collator, uint32_t *weight) * #include * int main() { * i18n_error_code_e error_code; - * i18n_ucollator_h coll = NULL; - * i18n_ucollator_h clone_coll = NULL; + * i18n_ucollator_h collator = NULL; + * i18n_ucollator_h clone = NULL; * - * error_code = i18n_ucollator_create("en_US", &coll ); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucollator_create("en_US", &collator); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_create: %d\n", error_code); * return EXIT_FAILURE; * } - * error_code = i18n_ucollator_safe_clone(coll, &clone_coll); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_ucollator_safe_clone(collator, &clone); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_ucollator_safe_clone: %d\n", error_code); - * i18n_ucollator_destroy(coll); + * i18n_ucollator_destroy(collator); * return EXIT_FAILURE; * } - * i18n_ucollator_destroy(coll); - * i18n_ucollator_destroy(clone_coll); + * i18n_ucollator_destroy(clone); + * i18n_ucollator_destroy(collator); * return EXIT_SUCCESS; * } * @endcode diff --git a/src/include/utils_i18n_udate.h b/src/include/utils_i18n_udate.h index 41f1266..f0c1683 100644 --- a/src/include/utils_i18n_udate.h +++ b/src/include/utils_i18n_udate.h @@ -275,21 +275,21 @@ int i18n_udate_to_calendar_date_field(i18n_udate_format_field_e field, i18n_ucal * int32_t tz_id_length = -1; * const i18n_uchar *pattern = NULL; * int32_t pattern_length = 0; - * i18n_udate_format_h clone = NULL; + * i18n_udate_format_h format_clone = NULL; * * error_code = i18n_udate_create(time_style, date_style, locale, tz_id, tz_id_length, pattern, pattern_length, &format); - * if(I18N_ERROR_NONE != error_code) { + * if(error_code != I18N_ERROR_NONE) { * printf("Error i18n_udate_create: %d\n", error_code); * return EXIT_FAILURE; * } * - * error_code = i18n_udate_clone(format, &clone); - * if(I18N_ERROR_NONE != error_code) { + * error_code = i18n_udate_clone(format, &format_clone); + * if(error_code != I18N_ERROR_NONE) { * printf("Error i18n_udate_clone : %d\n", error_code); * i18n_udate_destroy(format); * return EXIT_FAILURE; * } - * i18n_udate_destroy(clone); + * i18n_udate_destroy(format_clone); * i18n_udate_destroy(format); * return EXIT_SUCCESS; * } diff --git a/src/include/utils_i18n_udatepg.h b/src/include/utils_i18n_udatepg.h index 26f779c..21953d4 100644 --- a/src/include/utils_i18n_udatepg.h +++ b/src/include/utils_i18n_udatepg.h @@ -235,7 +235,7 @@ int i18n_udatepg_get_best_pattern(i18n_udatepg_h dtpg, const i18n_uchar *skeleto * i18n_error_code_e error_code; * i18n_udatepg_h dtpg = NULL; * error_code = i18n_udatepg_create_empty(&dtpg); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } @@ -266,18 +266,18 @@ int i18n_udatepg_create_empty(i18n_udatepg_h *dtpg); * i18n_udatepg_h dtpg = NULL; * i18n_udatepg_h dtpg_clone = NULL; * error_code = i18n_udatepg_create_empty(&dtpg); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } * error_code = i18n_udatepg_clone(dtpg, &dtpg_clone); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_clone: %d\n", error_code); * i18n_udatepg_destroy(dtpg); * return EXIT_FAILURE; * } - * i18n_udatepg_destroy(dtpg); * i18n_udatepg_destroy(dtpg_clone); + * i18n_udatepg_destroy(dtpg); * return EXIT_SUCCESS; * } * @endcode @@ -644,14 +644,14 @@ int32_t i18n_udatepg_replace_field_types_with_options(i18n_udatepg_h dtpg, const * int main() { * i18n_error_code_e error_code; * i18n_uenumeration_h skeletons = NULL; - * i18n_udatepg_h dtpg = NULL; + * i18n_udatepg_h dtpg = NULL; * error_code = i18n_udatepg_create_empty(&dtpg); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } * error_code = i18n_udatepg_skeletons_create(dtpg, &skeletons); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_skeletons_create: %d\n", error_code); * i18n_udatepg_destroy(dtpg); * return EXIT_FAILURE; @@ -681,20 +681,20 @@ int i18n_udatepg_skeletons_create(const i18n_udatepg_h dtpg, i18n_uenumeration_h * #include * int main() { * i18n_error_code_e error_code; - * i18n_uenumeration_h skeletons = NULL; - * i18n_udatepg_h dtpg = NULL; + * i18n_uenumeration_h enumeration = NULL; + * i18n_udatepg_h dtpg = NULL; * error_code = i18n_udatepg_create_empty(&dtpg); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } - * error_code = i18n_udatepg_base_skeletons_create(dtpg, &skeletons); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_udatepg_base_skeletons_create(dtpg, &enumeration); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_udatepg_base_skeletons_create: %d\n", error_code); * i18n_udatepg_destroy(dtpg); * return EXIT_FAILURE; * } - * i18n_uenumeration_destroy(skeletons); + * i18n_uenumeration_destroy(enumeration); * i18n_udatepg_destroy(dtpg); * return EXIT_SUCCESS; * } diff --git a/src/include/utils_i18n_unumber.h b/src/include/utils_i18n_unumber.h index 5c341f0..2993d6f 100644 --- a/src/include/utils_i18n_unumber.h +++ b/src/include/utils_i18n_unumber.h @@ -160,22 +160,22 @@ int i18n_unumber_get_symbol(const i18n_unumber_format_h fmt, i18n_unumber_format * #include * int main() { * i18n_error_code_e error_code; - * i18n_unumber_format_h num_format = NULL; - * i18n_unumber_format_h num_format_clone = NULL; + * i18n_unumber_format_h fmt = NULL; + * i18n_unumber_format_h fmt_clone = NULL; * - * error_code = i18n_unumber_create(I18N_UNUMBER_DECIMAL, NULL, -1, I18N_ULOCALE_US, NULL, &num_format); - * if(I18N_ERROR_NONE != error_code) { - * printf("Error i18n_unumber_create: %d\n", error_code); + * error_code = i18n_unumber_create(I18N_UNUMBER_DECIMAL, NULL, -1, I18N_ULOCALE_US, NULL, &fmt); + * if(error_code != I18N_ERROR_NONE) { + * printf("Error i18n_unumber_create: %d\n", error_code); * return EXIT_FAILURE; - * } + * } * - * error_code = i18n_unumber_clone(num_format, &num_format_clone); - * if(I18N_ERROR_NONE != error_code) { - * printf("Error i18n_unumber_clone: %d\n", error_code); + * error_code = i18n_unumber_clone(fmt, &fmt_clone); + * if(error_code != I18N_ERROR_NONE) { + * printf("Error i18n_unumber_clone: %d\n", error_code); * return EXIT_FAILURE; - * } - * i18n_unumber_destroy(num_format_clone); - * i18n_unumber_destroy(num_format); + * } + * i18n_unumber_destroy(fmt_clone); + * i18n_unumber_destroy(fmt); * return EXIT_SUCCESS; * } * @endcode diff --git a/src/include/utils_i18n_unumsys.h b/src/include/utils_i18n_unumsys.h index e8d951f..a23c257 100644 --- a/src/include/utils_i18n_unumsys.h +++ b/src/include/utils_i18n_unumsys.h @@ -87,7 +87,7 @@ int i18n_unumsys_create(const char *locale, i18n_unumsys_h *unumsys); * i18n_unumsys_h unumsys; * i18n_error_code_e error_code; * error_code = i18n_unumsys_create("latn", &unumsys); - * if(I18N_ERROR_NONE != error_code) { + * if(error_code != I18N_ERROR_NONE) { * printf("Error i18n_unumsys_create: %d\n", error_code); * return EXIT_FAILURE; * } diff --git a/src/include/utils_i18n_uset.h b/src/include/utils_i18n_uset.h index 6c30128..65e6bfd 100644 --- a/src/include/utils_i18n_uset.h +++ b/src/include/utils_i18n_uset.h @@ -68,7 +68,7 @@ extern "C" { * i18n_uset_h uset = NULL; * i18n_error_code_e error_code; * error_code = i18n_uset_create_empty(&uset); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create_empty: %d\n", error_code); * return EXIT_FAILURE; * } @@ -101,17 +101,17 @@ int i18n_uset_create_empty(i18n_uset_h *set); * #include * #include * int main() { - * i18n_uset_h uset = NULL; + * i18n_uset_h set = NULL; * i18n_uchar32 start = 0x41; * i18n_uchar32 end = 0x50; * * i18n_error_code_e error_code; - * error_code = i18n_uset_create(start, end, &uset); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_create(start, end, &set); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create: %d\n", error_code); * return EXIT_FAILURE; * } - * i18n_uset_destroy(uset); + * i18n_uset_destroy(set); * return EXIT_SUCCESS; * } * @endcode @@ -138,21 +138,21 @@ int i18n_uset_create(i18n_uchar32 start, i18n_uchar32 end, i18n_uset_h *set); * #include * #include * int main() { - * const char *pattern = "[:Hyphen:]"; - * i18n_uchar *_pattern = NULL; - * i18n_uset_h uset = NULL; + * const char *pattern_ascii = "[:Hyphen:]"; + * i18n_uchar *pattern = NULL; + * i18n_uset_h set = NULL; * i18n_error_code_e error_code; * - * _pattern = (i18n_uchar *)calloc(strlen(pattern) + 1, sizeof(i18n_uchar)); - * i18n_ustring_copy_ua(_pattern, pattern); + * pattern = (i18n_uchar *)calloc(strlen(pattern_ascii), sizeof(i18n_uchar)); + * i18n_ustring_copy_ua(pattern, pattern_ascii); * - * error_code = i18n_uset_create_pattern(_pattern, 10, &uset); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_create_pattern(pattern, 10, &set); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create_pattern: %d\n", error_code); * return EXIT_FAILURE; * } - * free(_pattern); - * i18n_uset_destroy(uset); + * free(pattern); + * i18n_uset_destroy(set); * return EXIT_SUCCESS; * } * @endcode @@ -181,21 +181,21 @@ int i18n_uset_create_pattern(const i18n_uchar *pattern, int32_t pattern_length, * #include * #include * int main() { - * const char *pattern = "[:Hyphen:]"; - * i18n_uchar *_pattern = NULL; - * i18n_uset_h uset = NULL; + * const char *pattern_ascii = "[:Hyphen:]"; + * i18n_uchar *pattern = NULL; + * i18n_uset_h set = NULL; * i18n_error_code_e error_code; * - * _pattern = (i18n_uchar *)calloc(strlen(pattern) + 1, sizeof(i18n_uchar)); - * i18n_ustring_copy_ua(_pattern, pattern); + * pattern = (i18n_uchar *)calloc(strlen(pattern_ascii) + 1, sizeof(i18n_uchar)); + * i18n_ustring_copy_ua(pattern, pattern_ascii); * - * error_code = i18n_uset_create_pattern_options(_pattern, 10, I18N_USET_IGNORE_SPACE, &uset); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_create_pattern_options(pattern, strlen(pattern_ascii), I18N_USET_IGNORE_SPACE, &set); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create_pattern: %d\n", error_code); * return EXIT_FAILURE; * } - * free(_pattern); - * i18n_uset_destroy(uset); + * free(pattern); + * i18n_uset_destroy(set); * return EXIT_SUCCESS; * } * @endcode @@ -234,25 +234,25 @@ int i18n_uset_destroy(i18n_uset_h set); * #include * #include * int main() { - * i18n_uset_h uset = NULL; - * i18n_uset_h uset_c = NULL; + * i18n_uset_h set = NULL; + * i18n_uset_h set_clone = NULL; * i18n_uchar32 start = 0x41; * i18n_uchar32 end = 0x50; * i18n_error_code_e error_code; * - * error_code = i18n_uset_create(start, end, &uset); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_create(start, end, &set); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create: %d\n", error_code); * return EXIT_FAILURE; * } - * error_code = i18n_uset_clone(uset, &uset_c); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_clone(set, &set_clone); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_clone: %d\n", error_code); - * i18n_uset_destroy(uset); + * i18n_uset_destroy(set); * return EXIT_FAILURE; * } - * i18n_uset_destroy(uset); - * i18n_uset_destroy(uset_c); + * i18n_uset_destroy(set_clone); + * i18n_uset_destroy(set); * return EXIT_SUCCESS; * } * @endcode @@ -317,25 +317,25 @@ int i18n_uset_freeze(i18n_uset_h set); * #include * #include * int main() { - * i18n_uset_h uset = NULL; - * i18n_uset_h uset_c = NULL; + * i18n_uset_h set = NULL; + * i18n_uset_h set_clone = NULL; * i18n_uchar32 start = 0x41; * i18n_uchar32 end = 0x50; * i18n_error_code_e error_code; * - * error_code = i18n_uset_create(start, end, &uset); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_create(start, end, &set); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create: %d\n", error_code); * return EXIT_FAILURE; * } - * error_code = i18n_uset_clone_as_thawed(uset, &uset_c); - * if (error_code!= I18N_ERROR_NONE) { + * error_code = i18n_uset_clone_as_thawed(set, &set_clone); + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_clone_as_thawed: %d\n", error_code); - * i18n_uset_destroy(uset); + * i18n_uset_destroy(set); * return EXIT_FAILURE; * } - * i18n_uset_destroy(uset); - * i18n_uset_destroy(uset_c); + * i18n_uset_destroy(set); + * i18n_uset_destroy(set_clone); * return EXIT_SUCCESS; * } * @endcode diff --git a/src/include/utils_i18n_utext.h b/src/include/utils_i18n_utext.h index 1bf42b7..7b83126 100644 --- a/src/include/utils_i18n_utext.h +++ b/src/include/utils_i18n_utext.h @@ -173,7 +173,7 @@ int i18n_utext_create_for_UTF8(i18n_utext_h uta, const char *s, int64_t length, * i18n_error_code_e error_code; * i18n_uchar uString[] = {0x41, 0x42, 0x43, 0}; * error_code = i18n_utext_create_for_uchars(NULL, uString, -1, &utb); - * if (error_code!= I18N_ERROR_NONE) { + * if (error_code != I18N_ERROR_NONE) { * printf("Error i18n_uset_create: %d\n", error_code); * return EXIT_FAILURE; * }