ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
CHECK_ERROR("i18n_udate_format_date", ret);
- char *s = (char *)malloc(BUF_SIZE * sizeof(char));
- i18n_ustring_copy_au(s, result);
+ char *s = (char *)calloc((BUF_SIZE + 1), sizeof(char));
+ i18n_ustring_copy_au_n(s, result, BUF_SIZE);
i18n_udate_destroy(format_h);
free(result);
ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
CHECK_ERROR("i18n_udate_format_date", ret);
- char s[BUF_SIZE];
- i18n_ustring_copy_au(s, result);
+ char s[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(s, result, BUF_SIZE);
free(result);
char *time_str, *date_str;
i18n_unumber_format_double(num_format, my_number, formatted_number, BUF_SIZE, NULL);
/* Display the formatting result. */
- char string[BUF_SIZE];
- i18n_ustring_copy_au(string, formatted_number);
+ char string[BUF_SIZE + 1];
+ i18n_ustring_copy_au_n(string, formatted_number, BUF_SIZE);
char *number_str;
number_str = __print_i18n_type_string("number_format", i);
CHECK_ERROR("18n_unumber_get_symbol", ret);
/* Display the formatted symbol. */
- char string[BUF_SIZE];
- i18n_ustring_copy_au(string, u_buffer);
+ char string[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(string, u_buffer, BUF_SIZE);
char *symbol_str;
symbol_str = __print_i18n_type_string("symbol", i+1);
int ret =
i18n_ulocale_get_display_name(default_locale, default_locale, name, BUF_SIZE, &name_len);
CHECK_ERROR("i18n_ulocale_get_display_name", ret);
- char name_ch[BUF_SIZE];
- i18n_ustring_copy_au(name_ch, name);
+ char name_ch[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(name_ch, name, BUF_SIZE);
printf("| Language display name | %s\n", name_ch);
i18n_ulocale_get_display_language(default_locale, default_locale, lang, BUF_SIZE);
/* Get the string representation of the obtained language. */
- char language[BUF_SIZE];
- i18n_ustring_copy_au(language, lang);
+ char language[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(language, lang, BUF_SIZE);
printf("| Full name | %s\n", language);
/* Get the obtained language code. */
}
result[end - start] = '\0';
i18n_ustring_copy_n(result, &string_to_examine[start], end-start);
- char str[BUF_SIZE];
- i18n_ustring_copy_au(str, result);
+ char str[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(str, result, BUF_SIZE);
free(result);
iter_type = __print_i18n_type_string("iter_type", i);
}
result[end - start] = '\0';
i18n_ustring_copy_n(result, &string_to_examine[start], end-start);
- char str[BUF_SIZE];
- i18n_ustring_copy_au(str, result);
+ char str[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(str, result, BUF_SIZE);
free(result);
iter_type = __print_i18n_type_string("iter_type", i);
i18n_ustring_to_upper(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, &error_code);
CHECK_ERROR("i18n_ustring_to_upper", error_code);
- char s[BUF_SIZE];
- i18n_ustring_copy_au(s, dest);
+ char s[BUF_SIZE + 1];
+ i18n_ustring_copy_au_n(s, dest, BUF_SIZE);
printf("| TO UPPER | %s\n", s);
/* To lower */
i18n_ustring_to_lower(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, &error_code);
CHECK_ERROR("i18n_ustring_to_lower", error_code);
- i18n_ustring_copy_au(s, dest);
+ i18n_ustring_copy_au_n(s, dest, BUF_SIZE);
printf("| to lower | %s\n", s);
/* To title */
i18n_ustring_to_title_new(dest, BUF_SIZE + 1, string_to_examine, BUF_SIZE, NULL, NULL);
CHECK_ERROR("i18n_ustring_to_title_new", error_code);
- i18n_ustring_copy_au(s, dest);
+ i18n_ustring_copy_au_n(s, dest, BUF_SIZE);
printf("| To Title | %s\n", s);
PRINT_ASCIIDOC_LOG("|===\n");
ret = i18n_udate_format_date(format_h, date_now, result, BUF_SIZE, NULL, &date_len);
CHECK_ERROR("i18n_udate_format_date", ret);
- char s[BUF_SIZE] = {0, };
- i18n_ustring_copy_au(s, result);
+ char s[BUF_SIZE +1] = {0, };
+ i18n_ustring_copy_au_n(s, result, BUF_SIZE);
printf("| Current time | %s\n", s);
/* Get the selected timezone ID. */
dst, &output_length);
CHECK_ERROR("i18n_ubidi_write_reordered", ret);
- char buffer[BUF_SIZE];
- i18n_ustring_copy_au(buffer, dst);
+ char buffer[BUF_SIZE +1];
+ i18n_ustring_copy_au_n(buffer, dst, BUF_SIZE);
printf("| %-46.46s | %-34.34s | %s \n", reordering_modes[i].display_name, reordering_options[j].display_name, buffer);
}
free(src);
free(number_to_convert);
return 0;
}
- char p_string[BUF_SIZE] = {0, };
- i18n_ustring_copy_au_n(p_string, str, BUF_SIZE - 1);
+ char p_string[BUF_SIZE+1] = {0, };
+ i18n_ustring_copy_au_n(p_string, str, BUF_SIZE);
printf(" Convert number : %s\n", p_string);
free(str);
PRINT_ASCIIDOC_LOG("|===\n");
free(number_to_convert);
return 0;
}
- char p_string[BUF_SIZE];
- i18n_ustring_copy_au_n(p_string, str, BUF_SIZE - 1);
+ char p_string[BUF_SIZE+1];
+ i18n_ustring_copy_au_n(p_string, str, BUF_SIZE);
printf(" Convert number : %s\n", p_string);
free(str);
PRINT_ASCIIDOC_LOG("|===\n");
error_code = i18n_plural_rules_select_double(rules, input, BUF_SIZE, buffer, &output_length);
CHECK_ERROR("i18n_plural_rules_select_double", error_code);
- char output_buffer[BUF_SIZE] = { 0 };
- i18n_ustring_copy_au_n(output_buffer, buffer, BUF_SIZE - 1);
+ char output_buffer[BUF_SIZE +1] = { 0 };
+ i18n_ustring_copy_au_n(output_buffer, buffer, BUF_SIZE);
printf("Matched rule: %s \n", output_buffer);
/* Release the rules as it is not needed anymore. */