JS_NewClassID(&js_collator_class_id);
JS_NewClass(JS_GetRuntime(ctx), js_collator_class_id, &js_collator_class);
+ JSCFunctionType ft = { .constructor_or_func_flags = js_collator_constructor };
+
if (JS_IsException(js_intl_new_constructor(ctx, intl_obj,
JS_INTL_CTOR_COLLATOR,
js_collator_class_id, "Collator",
- (JSCFunction *)js_collator_constructor, 0,
+ ft.generic, 0,
JS_CFUNC_constructor_or_func_flags, 0,
js_collator_static_funcs, countof(js_collator_static_funcs),
js_collator_proto_funcs, countof(js_collator_proto_funcs))))
JS_GetOpaque(argv[0], js_plainyearmonth_class_id) ||
JS_GetOpaque(argv[0], js_plainmonthday_class_id) ||
JS_GetOpaque(argv[0], js_plaindatetime_class_id)) {
- s_copy.timeZone = "+00:00";
+ s_copy.timeZone = (char *)"+00:00";
s_copy.timeZoneName = DTF_TIMEZONE_UNSET;
}
dtf_resolve_style_for_temporal(&s_copy, argv[0]);
JS_GetOpaque(argv[0], js_plainyearmonth_class_id) ||
JS_GetOpaque(argv[0], js_plainmonthday_class_id) ||
JS_GetOpaque(argv[0], js_plaindatetime_class_id)) {
- s_copy.timeZone = "+00:00";
+ s_copy.timeZone = (char *)"+00:00";
s_copy.timeZoneName = DTF_TIMEZONE_UNSET;
}
dtf_resolve_style_for_temporal(&s_copy, argv[0]);
JS_GetOpaque(argv[0], js_plainmonthday_class_id) ||
JS_GetOpaque(argv[0], js_plaindatetime_class_id)) {
s_copy = *s;
- s_copy.timeZone = "+00:00";
+ s_copy.timeZone = (char *)"+00:00";
s_copy.timeZoneName = DTF_TIMEZONE_UNSET;
s_use = &s_copy;
}
JSDateTimeFormatData *s = JS_GetOpaque2(ctx, unwrapped, js_datetimeformat_class_id);
JSDateTimeFormatData *s_use = s;
JSDateTimeFormatData s_copy;
- JSValue start_arr, end_arr, ret;
+ JSValue start_arr, end_arr, ret = JS_UNDEFINED;
double x, y;
int i, start_len, end_len;
uint32_t idx;
JS_GetOpaque(argv[0], js_plainmonthday_class_id) ||
JS_GetOpaque(argv[0], js_plaindatetime_class_id)) {
s_copy = *s;
- s_copy.timeZone = "+00:00";
+ s_copy.timeZone = (char *)"+00:00";
s_copy.timeZoneName = DTF_TIMEZONE_UNSET;
s_use = &s_copy;
}
{
JSValue len_val = JS_GetPropertyStr(ctx, start_arr, "length");
- if (!JS_IsException(len_val)) {
- JS_ToInt32(ctx, &start_len, len_val);
- JS_FreeValue(ctx, len_val);
- }
+ if (JS_IsException(len_val))
+ goto fail;
+ JS_ToInt32(ctx, &start_len, len_val);
+ JS_FreeValue(ctx, len_val);
}
{
JSValue len_val = JS_GetPropertyStr(ctx, end_arr, "length");
- if (!JS_IsException(len_val)) {
- JS_ToInt32(ctx, &end_len, len_val);
- JS_FreeValue(ctx, len_val);
- }
+ if (JS_IsException(len_val))
+ goto fail;
+ JS_ToInt32(ctx, &end_len, len_val);
+ JS_FreeValue(ctx, len_val);
}
for (j = 0; j < start_len && j < end_len; j++) {
JS_NewClassID(&js_datetimeformat_class_id);
JS_NewClass(JS_GetRuntime(ctx), js_datetimeformat_class_id, &js_datetimeformat_class);
+ JSCFunctionType ft = { .constructor_or_func_flags = js_datetimeformat_constructor };
+
if (JS_IsException(js_intl_new_constructor(ctx, intl_obj,
JS_INTL_CTOR_DATETIMEFORMAT,
js_datetimeformat_class_id, "DateTimeFormat",
- (JSCFunction *)js_datetimeformat_constructor, 0,
+ ft.generic, 0,
JS_CFUNC_constructor_or_func_flags, 0,
js_datetimeformat_static_funcs, countof(js_datetimeformat_static_funcs),
js_datetimeformat_proto_funcs, countof(js_datetimeformat_proto_funcs))))
break;
}
}
- subtags[0] = "sr";
+ subtags[0] = (char *)"sr";
if (!found_script) {
if (n > 1)
memmove(&subtags[2], &subtags[1], (size_t)(n - 1) * sizeof(char *));
- subtags[1] = "Latn";
+ subtags[1] = (char *)"Latn";
n++;
}
} else if (!strcasecmp(subtags[0], "cnr")) {
break;
}
}
- subtags[0] = "sr";
+ subtags[0] = (char *)"sr";
if (!found_region) {
if (insert_pos < n)
memmove(&subtags[insert_pos + 1], &subtags[insert_pos], (size_t)(n - insert_pos) * sizeof(char *));
- subtags[insert_pos] = "ME";
+ subtags[insert_pos] = (char *)"ME";
n++;
}
} else if (n == 2 && !strcasecmp(subtags[0], "hy") && !strcasecmp(subtags[1], "arevela")) {
if (has_alalc97 && has_hepburn) {
for (i = 0; i < base_end; i++) {
if (!strcmp(subtags[i], "hepburn")) {
- subtags[i] = "";
+ subtags[i] = (char *)"";
}
}
}
}
if (gf_variant >= 0) {
if (!strcasecmp(subtags[0], "art")) {
- subtags[0] = "jbo";
+ subtags[0] = (char *)"jbo";
} else if (!strcasecmp(subtags[0], "cel")) {
- subtags[0] = "xtg";
+ subtags[0] = (char *)"xtg";
} else if (!strcasecmp(subtags[0], "zh")) {
if (!strcasecmp(subtags[gf_variant], "guoyu"))
- subtags[0] = "zh";
+ subtags[0] = (char *)"zh";
else if (!strcasecmp(subtags[gf_variant], "hakka"))
- subtags[0] = "hak";
+ subtags[0] = (char *)"hak";
else if (!strcasecmp(subtags[gf_variant], "xiang"))
- subtags[0] = "hsn";
+ subtags[0] = (char *)"hsn";
}
- subtags[gf_variant] = "";
+ subtags[gf_variant] = (char *)"";
/* compact empty slots */
{
int j, k = 0;
if (var_start < tlang_end && tlang_end - var_start > 1)
qsort(&subtags[t_start + var_start], (size_t)(tlang_end - var_start), sizeof(char *), cmp_str);
if (!strcmp(subtags[t_start], "iw"))
- subtags[t_start] = "he";
+ subtags[t_start] = (char *)"he";
}
{
typedef struct { const char *key; int nvalues; const char *values[4]; } TFieldEntry;
JS_NewClassID(&js_numberformat_class_id);
JS_NewClass(JS_GetRuntime(ctx), js_numberformat_class_id, &js_numberformat_class);
+ JSCFunctionType ft = { .constructor_or_func_flags = js_numberformat_constructor };
+
if (JS_IsException(js_intl_new_constructor(ctx, intl_obj,
JS_INTL_CTOR_NUMBERFORMAT,
js_numberformat_class_id, "NumberFormat",
- (JSCFunction *)js_numberformat_constructor, 0,
+ ft.generic, 0,
JS_CFUNC_constructor_or_func_flags, 0,
js_numberformat_static_funcs, countof(js_numberformat_static_funcs),
js_numberformat_proto_funcs, countof(js_numberformat_proto_funcs))))