/* To get default time zone id */
i18n_timezone_h tmz;
char *timezone_id;
+ int timezone_id_len = 0;
i18n_uchar default_timezone_id[BUF_SIZE] = {0, };
ret = i18n_timezone_create_default(&tmz);
CHECK_ERROR("18n_timezone_create_default", ret);
ret = i18n_timezone_get_id(tmz, &timezone_id);
- i18n_ustring_copy_ua_n(default_timezone_id, timezone_id, strlen(timezone_id));
+ timezone_id_len = strlen(timezone_id);
+ i18n_ustring_copy_ua_n(default_timezone_id, timezone_id,
+ (timezone_id_len > BUF_SIZE - 1)? BUF_SIZE - 1 : timezone_id_len);
int pattern_len, len;
i18n_uchar pattern[BUF_SIZE], skeleton[BUF_SIZE];
{
assert_neq(dtpg, NULL);
const char *a_skeleton = "MMMdd";
+ const char *b_skeleton = "MMMM";
i18n_uchar skeleton[SKELETON_LEN] = { 0, };
+ i18n_uchar bskeleton[SKELETON_LEN] = { 0, };
i18n_uchar best_pattern[I18N_ret_LEN] = { 0, };
int skeleton_len;
int best_pattern_len;
capacity, &best_pattern_len);
assert_eq(ret, I18N_ERROR_NONE);
+ i18n_ustring_copy_ua(bskeleton, b_skeleton);
+ skeleton_len = i18n_ustring_get_length(bskeleton);
+ capacity = (int)(sizeof(best_pattern)/sizeof(best_pattern[0]));
+
+ ret = i18n_udatepg_get_best_pattern(dtpg, bskeleton, skeleton_len, best_pattern,
+ capacity, &best_pattern_len);
+ assert_eq(ret, I18N_ERROR_NONE);
+
return 0;
}