#define DEBUG_FLAG 0
static int ASCIIDOC_FLAG = 0;
-#define BUF_SIZE 64
+#define BUF_SIZE 1000
#define MS_TO_MIN 60000
#define MS_TO_HOUR 3600000
}
#define COPY_STR(dst, src, dst_len) do { \
- strncpy((dst), (src), (dst_len)); \
- (dst)[(dst_len) - 1] = '\0'; \
+ strncpy((dst), (src), (dst_len + 1)); \
+ (dst)[(dst_len)] = '\0'; \
} while (0)
#define PRINT_ASCIIDOC_LOG(fmt) if (ASCIIDOC_FLAG) printf(fmt)
printf(" Day - Formatting\n");
PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
PRINT_ASCIIDOC_LOG("|===\n");
- printf("| # | %-11.11s | %-11.11s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
+ printf("| # | %s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
for (i = 0; i < 7; i++) {
f_narrow = _date_basic_format_convert("EEEEE", i, "day");
f_short = _date_basic_format_convert("EEE", i, "day");
f_long = _date_basic_format_convert("EEEE", i, "day");
- printf("| %d | %-11.1s | %-11.3s | %s\n", i, f_narrow, f_short, f_long);
+ printf("| %d | %s | %s | %s\n", i, f_narrow, f_short, f_long);
}
PRINT_ASCIIDOC_LOG("|===\n");
printf(" Day - Stand-alone\n");
PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
PRINT_ASCIIDOC_LOG("|===\n");
- printf("| # | %-11.11s | %-11.11s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
+ printf("| # | %-s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
for (i = 0; i < 7; i++) {
s_narrow = _date_basic_format_convert("ccccc", i, "day");
s_short = _date_basic_format_convert("ccc", i, "day");
s_long = _date_basic_format_convert("cccc", i, "day");
- printf("| %d | %-11.1s | %-11.3s | %s\n", i, s_narrow, s_short, s_long);
+ printf("| %d | %s | %s | %s\n", i, s_narrow, s_short, s_long);
}
PRINT_ASCIIDOC_LOG("|===\n");
printf(" Month - Formatting\n");
PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
PRINT_ASCIIDOC_LOG("|===\n");
- printf("| # | %-11.11s | %-11.11s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
+ printf("| # | %-s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
for (i = 0; i < 12; i++) {
f_narrow = _date_basic_format_convert("MMMMM", i, "month");
f_short = _date_basic_format_convert("MMM", i, "month");
f_long = _date_basic_format_convert("MMMM", i, "month");
- printf("| %-2d | %-11.11s | %-11.11s | %-11.11s\n", i, f_narrow, f_short, f_long);
+ printf("| %-2d | %s | %s | %s\n", i, f_narrow, f_short, f_long);
}
PRINT_ASCIIDOC_LOG("|===\n");
printf(" Month - Stand-alone\n");
PRINT_ASCIIDOC_LOG("\n[options=\"header\"]\n");
PRINT_ASCIIDOC_LOG("|===\n");
- printf("| # | %-11.11s | %-11.11s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
+ printf("| # | %s | %s | %s \n", "Narrow Names" , "Short Names" , "Long Names");
for (i = 0; i < 12; i++) {
s_narrow = _date_basic_format_convert("LLLLL", i, "month");
s_short = _date_basic_format_convert("LLL", i, "month");
s_long = _date_basic_format_convert("LLLL", i, "month");
- printf("| %-2d | %-11.1s | %-11.3s | %s\n", i, s_narrow, s_short, s_long);
+ printf("| %-2d | %s | %s | %s\n", i, s_narrow, s_short, s_long);
}
PRINT_ASCIIDOC_LOG("|===\n");
PRINT_DEBUG_LOG("Date from strptime, year:%d month:%d day:%d hour:%d minute:%d second:%d.\n", result.tm_year, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec);
/*create i18n_ucalendar_h */
- ret = i18n_ucalendar_create(0, -1, "en_US", I18N_UCALENDAR_DEFAULT, &ucal);
+ ret = i18n_ucalendar_create(0, -1, NULL, I18N_UCALENDAR_DEFAULT, &ucal);
if (ret) {
printf("i18n_ucalendar_create failed.\n");
return -1;
/* Displays the first element in the given text */
for (i = 0; i <= I18N_UBRK_SENTENCE; i++) {
+ iter_type = NULL;
error_code = i18n_ubrk_create(i, default_locale, string_to_examine, -1, &boundary);
CHECK_ERROR("i18n_ubrk_create", error_code);
int32_t start = i18n_ubrk_first(boundary);
iter_type = __print_i18n_type_string("iter_type", i);
printf("| %-19.19s | %s\n", iter_type, str);
+ free(iter_type);
}
PRINT_ASCIIDOC_LOG("|===\n");
printf("| %-19.19s | %s\n", "ITER Last", "VALUE");
/* Displays the last element in the given text */
for (i = 0; i <= I18N_UBRK_SENTENCE; i++) {
+ iter_type = NULL;
error_code = i18n_ubrk_create(i, default_locale, string_to_examine, -1, &boundary);
CHECK_ERROR("i18n_ubrk_create", error_code);
int32_t end = i18n_ubrk_last(boundary);
iter_type = __print_i18n_type_string("iter_type", i);
printf("| %-19.19s | %s\n", iter_type, str);
+ free(iter_type);
}
PRINT_ASCIIDOC_LOG("|===\n");
- free(iter_type);
free(string_to_examine);
error_code = i18n_ubrk_destroy(boundary);
CHECK_ERROR("i18n_ubrk_destroy", error_code);
void testDatentime(char *input, char *locale)
{
- int ret = 0, i = 0;
+ int ret = 0, i = 0;
int loc_count;
if (!locale) {