jscript: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0af6002a3b
commit
29ea8b42db
|
@ -1,6 +1,8 @@
|
||||||
MODULE = jscript.dll
|
MODULE = jscript.dll
|
||||||
IMPORTS = oleaut32 ole32 user32 advapi32
|
IMPORTS = oleaut32 ole32 user32 advapi32
|
||||||
|
|
||||||
|
EXTRADLLFLAGS = -mno-cygwin
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
activex.c \
|
activex.c \
|
||||||
array.c \
|
array.c \
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include "jscript.h"
|
#include "jscript.h"
|
||||||
#include "objsafe.h"
|
#include "objsafe.h"
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -356,7 +354,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
|
||||||
|
|
||||||
jsstr_release(sep_str);
|
jsstr_release(sep_str);
|
||||||
}else {
|
}else {
|
||||||
hres = array_join(ctx, jsthis, length, default_separatorW, strlenW(default_separatorW), r);
|
hres = array_join(ctx, jsthis, length, default_separatorW, lstrlenW(default_separatorW), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -939,7 +937,7 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
return throw_type_error(ctx, JS_E_ARRAY_EXPECTED, NULL);
|
return throw_type_error(ctx, JS_E_ARRAY_EXPECTED, NULL);
|
||||||
|
|
||||||
return array_join(ctx, &array->dispex, array->length, default_separatorW,
|
return array_join(ctx, &array->dispex, array->length, default_separatorW,
|
||||||
strlenW(default_separatorW), r);
|
lstrlenW(default_separatorW), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
|
static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
|
||||||
|
@ -1179,7 +1177,7 @@ static HRESULT Array_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
return array_join(ctx, &array->dispex, array->length, default_separatorW,
|
return array_join(ctx, &array->dispex, array->length, default_separatorW,
|
||||||
strlenW(default_separatorW), r);
|
lstrlenW(default_separatorW), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Array_destructor(jsdisp_t *dispex)
|
static void Array_destructor(jsdisp_t *dispex)
|
||||||
|
@ -1193,10 +1191,10 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
|
||||||
const WCHAR *ptr = name;
|
const WCHAR *ptr = name;
|
||||||
DWORD id = 0;
|
DWORD id = 0;
|
||||||
|
|
||||||
if(!isdigitW(*ptr))
|
if(!iswdigit(*ptr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while(*ptr && isdigitW(*ptr)) {
|
while(*ptr && iswdigit(*ptr)) {
|
||||||
id = id*10 + (*ptr-'0');
|
id = id*10 + (*ptr-'0');
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsign
|
||||||
|
|
||||||
static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str)
|
static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str)
|
||||||
{
|
{
|
||||||
return compiler_alloc_string_len(ctx, str, strlenW(str));
|
return compiler_alloc_string_len(ctx, str, lstrlenW(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ensure_bstr_slot(compiler_ctx_t *ctx)
|
static BOOL ensure_bstr_slot(compiler_ctx_t *ctx)
|
||||||
|
@ -1419,7 +1419,7 @@ static HRESULT compile_continue_statement(compiler_ctx_t *ctx, branch_statement_
|
||||||
for(iter = ctx->stat_ctx; iter; iter = iter->next) {
|
for(iter = ctx->stat_ctx; iter; iter = iter->next) {
|
||||||
if(iter->continue_label)
|
if(iter->continue_label)
|
||||||
pop_ctx = iter;
|
pop_ctx = iter;
|
||||||
if(iter->labelled_stat && !strcmpW(iter->labelled_stat->identifier, stat->identifier))
|
if(iter->labelled_stat && !lstrcmpW(iter->labelled_stat->identifier, stat->identifier))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,7 +1465,7 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
|
||||||
|
|
||||||
if(stat->identifier) {
|
if(stat->identifier) {
|
||||||
for(pop_ctx = ctx->stat_ctx; pop_ctx; pop_ctx = pop_ctx->next) {
|
for(pop_ctx = ctx->stat_ctx; pop_ctx; pop_ctx = pop_ctx->next) {
|
||||||
if(pop_ctx->labelled_stat && !strcmpW(pop_ctx->labelled_stat->identifier, stat->identifier)) {
|
if(pop_ctx->labelled_stat && !lstrcmpW(pop_ctx->labelled_stat->identifier, stat->identifier)) {
|
||||||
assert(pop_ctx->break_label);
|
assert(pop_ctx->break_label);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1549,7 +1549,7 @@ static HRESULT compile_labelled_statement(compiler_ctx_t *ctx, labelled_statemen
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
for(iter = ctx->stat_ctx; iter; iter = iter->next) {
|
for(iter = ctx->stat_ctx; iter; iter = iter->next) {
|
||||||
if(iter->labelled_stat && !strcmpW(iter->labelled_stat->identifier, stat->identifier)) {
|
if(iter->labelled_stat && !lstrcmpW(iter->labelled_stat->identifier, stat->identifier)) {
|
||||||
WARN("Label %s redefined\n", debugstr_w(stat->identifier));
|
WARN("Label %s redefined\n", debugstr_w(stat->identifier));
|
||||||
return JS_E_LABEL_REDEFINED;
|
return JS_E_LABEL_REDEFINED;
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1825,7 @@ static HRESULT compile_statement(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx,
|
||||||
static int function_local_cmp(const void *key, const struct wine_rb_entry *entry)
|
static int function_local_cmp(const void *key, const struct wine_rb_entry *entry)
|
||||||
{
|
{
|
||||||
function_local_t *local = WINE_RB_ENTRY_VALUE(entry, function_local_t, entry);
|
function_local_t *local = WINE_RB_ENTRY_VALUE(entry, function_local_t, entry);
|
||||||
return strcmpW(key, local->name);
|
return CompareStringOrdinal(key, -1, local->name, -1, FALSE) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline function_local_t *find_local(compiler_ctx_t *ctx, const WCHAR *name)
|
static inline function_local_t *find_local(compiler_ctx_t *ctx, const WCHAR *name)
|
||||||
|
@ -2382,7 +2382,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
|
||||||
const WCHAR *ptr = args, *ptr2;
|
const WCHAR *ptr = args, *ptr2;
|
||||||
unsigned arg_cnt = 0;
|
unsigned arg_cnt = 0;
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
if(!*ptr) {
|
if(!*ptr) {
|
||||||
if(args_size)
|
if(args_size)
|
||||||
|
@ -2391,16 +2391,16 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if(!isalphaW(*ptr) && *ptr != '_') {
|
if(!iswalpha(*ptr) && *ptr != '_') {
|
||||||
FIXME("expected alpha or '_': %s\n", debugstr_w(ptr));
|
FIXME("expected alpha or '_': %s\n", debugstr_w(ptr));
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr2 = ptr;
|
ptr2 = ptr;
|
||||||
while(isalnumW(*ptr) || *ptr == '_')
|
while(iswalnum(*ptr) || *ptr == '_')
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr && *ptr != ',' && !isspaceW(*ptr)) {
|
if(*ptr && *ptr != ',' && !iswspace(*ptr)) {
|
||||||
FIXME("unexpected har %s\n", debugstr_w(ptr));
|
FIXME("unexpected har %s\n", debugstr_w(ptr));
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -2412,7 +2412,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
|
||||||
}
|
}
|
||||||
arg_cnt++;
|
arg_cnt++;
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
if(!*ptr)
|
if(!*ptr)
|
||||||
break;
|
break;
|
||||||
|
@ -2422,7 +2422,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -542,16 +540,16 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!show_offset)
|
if(!show_offset)
|
||||||
sprintfW(buf, formatNoOffsetW, week, month, day,
|
swprintf(buf, ARRAY_SIZE(buf), formatNoOffsetW, week, month, day,
|
||||||
(int)hour_from_time(time), (int)min_from_time(time),
|
(int)hour_from_time(time), (int)min_from_time(time),
|
||||||
(int)sec_from_time(time), year, formatAD?ADW:BCW);
|
(int)sec_from_time(time), year, formatAD?ADW:BCW);
|
||||||
else if(offset)
|
else if(offset)
|
||||||
sprintfW(buf, formatW, week, month, day,
|
swprintf(buf, ARRAY_SIZE(buf), formatW, week, month, day,
|
||||||
(int)hour_from_time(time), (int)min_from_time(time),
|
(int)hour_from_time(time), (int)min_from_time(time),
|
||||||
(int)sec_from_time(time), sign, offset/60, offset%60,
|
(int)sec_from_time(time), sign, offset/60, offset%60,
|
||||||
year, formatAD?ADW:BCW);
|
year, formatAD?ADW:BCW);
|
||||||
else
|
else
|
||||||
sprintfW(buf, formatUTCW, week, month, day,
|
swprintf(buf, ARRAY_SIZE(buf), formatUTCW, week, month, day,
|
||||||
(int)hour_from_time(time), (int)min_from_time(time),
|
(int)hour_from_time(time), (int)min_from_time(time),
|
||||||
(int)sec_from_time(time), year, formatAD?ADW:BCW);
|
(int)sec_from_time(time), year, formatAD?ADW:BCW);
|
||||||
|
|
||||||
|
@ -658,15 +656,16 @@ static HRESULT Date_toISOString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
|
||||||
|
|
||||||
if(year < 0) {
|
if(year < 0) {
|
||||||
*p++ = '-';
|
*p++ = '-';
|
||||||
p += sprintfW(p, long_year_formatW, -(int)year);
|
p += swprintf(p, ARRAY_SIZE(buf) - 1, long_year_formatW, -(int)year);
|
||||||
}else if(year > 9999) {
|
}else if(year > 9999) {
|
||||||
*p++ = '+';
|
*p++ = '+';
|
||||||
p += sprintfW(p, long_year_formatW, (int)year);
|
p += swprintf(p, ARRAY_SIZE(buf) - 1, long_year_formatW, (int)year);
|
||||||
}else {
|
}else {
|
||||||
p += sprintfW(p, short_year_formatW, (int)year);
|
p += swprintf(p, ARRAY_SIZE(buf), short_year_formatW, (int)year);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintfW(p, formatW, (int)month_from_time(date->time) + 1, (int)date_from_time(date->time),
|
swprintf(p, ARRAY_SIZE(buf) - (p - buf), formatW,
|
||||||
|
(int)month_from_time(date->time) + 1, (int)date_from_time(date->time),
|
||||||
(int)hour_from_time(date->time), (int)min_from_time(date->time),
|
(int)hour_from_time(date->time), (int)min_from_time(date->time),
|
||||||
(int)sec_from_time(date->time), (int)ms_from_time(date->time));
|
(int)sec_from_time(date->time), (int)ms_from_time(date->time));
|
||||||
|
|
||||||
|
@ -745,7 +744,7 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, jsva
|
||||||
|
|
||||||
day = date_from_time(date->time);
|
day = date_from_time(date->time);
|
||||||
|
|
||||||
sprintfW(buf, formatAD ? formatADW : formatBCW, week, day, month, year,
|
swprintf(buf, ARRAY_SIZE(buf), formatAD ? formatADW : formatBCW, week, day, month, year,
|
||||||
(int)hour_from_time(date->time), (int)min_from_time(date->time),
|
(int)hour_from_time(date->time), (int)min_from_time(date->time),
|
||||||
(int)sec_from_time(date->time));
|
(int)sec_from_time(date->time));
|
||||||
|
|
||||||
|
@ -822,7 +821,7 @@ static HRESULT dateobj_to_date_string(DateInstance *date, jsval_t *r)
|
||||||
|
|
||||||
day = date_from_time(time);
|
day = date_from_time(time);
|
||||||
|
|
||||||
sprintfW(buf, formatAD ? formatADW : formatBCW, week, month, day, year);
|
swprintf(buf, ARRAY_SIZE(buf), formatAD ? formatADW : formatBCW, week, month, day, year);
|
||||||
|
|
||||||
date_str = jsstr_alloc(buf);
|
date_str = jsstr_alloc(buf);
|
||||||
if(!date_str)
|
if(!date_str)
|
||||||
|
@ -883,11 +882,11 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
|
||||||
else sign = '-';
|
else sign = '-';
|
||||||
|
|
||||||
if(offset)
|
if(offset)
|
||||||
sprintfW(buf, formatW, (int)hour_from_time(time),
|
swprintf(buf, ARRAY_SIZE(buf), formatW, (int)hour_from_time(time),
|
||||||
(int)min_from_time(time), (int)sec_from_time(time),
|
(int)min_from_time(time), (int)sec_from_time(time),
|
||||||
sign, offset/60, offset%60);
|
sign, offset/60, offset%60);
|
||||||
else
|
else
|
||||||
sprintfW(buf, formatUTCW, (int)hour_from_time(time),
|
swprintf(buf, ARRAY_SIZE(buf), formatUTCW, (int)hour_from_time(time),
|
||||||
(int)min_from_time(time), (int)sec_from_time(time));
|
(int)min_from_time(time), (int)sec_from_time(time));
|
||||||
|
|
||||||
date_str = jsstr_alloc(buf);
|
date_str = jsstr_alloc(buf);
|
||||||
|
@ -2075,7 +2074,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
for(i=0; i<input_len; i++) {
|
for(i=0; i<input_len; i++) {
|
||||||
if(input[i] == '(') nest_level++;
|
if(input[i] == '(') nest_level++;
|
||||||
else if(input[i] == ')') nest_level--;
|
else if(input[i] == ')') nest_level--;
|
||||||
else if(!nest_level) parse[parse_len++] = toupperW(input[i]);
|
else if(!nest_level) parse[parse_len++] = towupper(input[i]);
|
||||||
}
|
}
|
||||||
parse[parse_len] = 0;
|
parse[parse_len] = 0;
|
||||||
|
|
||||||
|
@ -2102,16 +2101,16 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<parse_len;) {
|
for(i=0; i<parse_len;) {
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i] == ',') {
|
if(parse[i] == ',') {
|
||||||
while(parse[i] == ',') i++;
|
while(parse[i] == ',') i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parse[i]>='0' && parse[i]<='9') {
|
if(parse[i]>='0' && parse[i]<='9') {
|
||||||
int tmp = atoiW(&parse[i]);
|
int tmp = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
|
|
||||||
if(parse[i] == ':') {
|
if(parse[i] == ':') {
|
||||||
/* Time */
|
/* Time */
|
||||||
|
@ -2121,17 +2120,17 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
hour = tmp;
|
hour = tmp;
|
||||||
|
|
||||||
while(parse[i] == ':') i++;
|
while(parse[i] == ':') i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i]>='0' && parse[i]<='9') {
|
if(parse[i]>='0' && parse[i]<='9') {
|
||||||
min = atoiW(&parse[i]);
|
min = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
while(parse[i] == ':') i++;
|
while(parse[i] == ':') i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i]>='0' && parse[i]<='9') {
|
if(parse[i]>='0' && parse[i]<='9') {
|
||||||
sec = atoiW(&parse[i]);
|
sec = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2144,17 +2143,17 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
|
|
||||||
month = tmp-1;
|
month = tmp-1;
|
||||||
|
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
while(parse[i]=='-' || parse[i]=='/') i++;
|
while(parse[i]=='-' || parse[i]=='/') i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i]<'0' || parse[i]>'9') break;
|
if(parse[i]<'0' || parse[i]>'9') break;
|
||||||
day = atoiW(&parse[i]);
|
day = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
|
|
||||||
while(parse[i]=='-' || parse[i]=='/') i++;
|
while(parse[i]=='-' || parse[i]=='/') i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i]<'0' || parse[i]>'9') break;
|
if(parse[i]<'0' || parse[i]>'9') break;
|
||||||
year = atoiW(&parse[i]);
|
year = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
|
|
||||||
if(tmp >= 70){
|
if(tmp >= 70){
|
||||||
|
@ -2189,9 +2188,9 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
if(parse[i] == '-') positive = FALSE;
|
if(parse[i] == '-') positive = FALSE;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
while(isspaceW(parse[i])) i++;
|
while(iswspace(parse[i])) i++;
|
||||||
if(parse[i]<'0' || parse[i]>'9') break;
|
if(parse[i]<'0' || parse[i]>'9') break;
|
||||||
offset = atoiW(&parse[i]);
|
offset = wcstol(&parse[i], NULL, 10);
|
||||||
while(parse[i]>='0' && parse[i]<='9') i++;
|
while(parse[i]>='0' && parse[i]<='9') i++;
|
||||||
|
|
||||||
if(offset<24) offset *= 60;
|
if(offset<24) offset *= 60;
|
||||||
|
@ -2270,7 +2269,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
|
||||||
size -= i;
|
size -= i;
|
||||||
|
|
||||||
for(j=0; j<ARRAY_SIZE(string_ids); j++)
|
for(j=0; j<ARRAY_SIZE(string_ids); j++)
|
||||||
if(!strncmpiW(&parse[i], strings[j], size)) break;
|
if(!wcsnicmp(&parse[i], strings[j], size)) break;
|
||||||
|
|
||||||
if(j < 12) {
|
if(j < 12) {
|
||||||
if(set_month) break;
|
if(set_month) break;
|
||||||
|
|
|
@ -117,7 +117,7 @@ HRESULT decode_source(WCHAR *code)
|
||||||
static const WCHAR decode_endW[] = {'^','#','~','@'};
|
static const WCHAR decode_endW[] = {'^','#','~','@'};
|
||||||
|
|
||||||
while(*src) {
|
while(*src) {
|
||||||
if(!strncmpW(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
|
if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
|
||||||
DWORD len, i, j=0, csum, s=0;
|
DWORD len, i, j=0, csum, s=0;
|
||||||
|
|
||||||
src += ARRAY_SIZE(decode_beginW);
|
src += ARRAY_SIZE(decode_beginW);
|
||||||
|
@ -165,7 +165,7 @@ HRESULT decode_source(WCHAR *code)
|
||||||
return JS_E_INVALID_CHAR;
|
return JS_E_INVALID_CHAR;
|
||||||
src += 8;
|
src += 8;
|
||||||
|
|
||||||
if(strncmpW(src, decode_endW, ARRAY_SIZE(decode_endW)))
|
if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)))
|
||||||
return JS_E_INVALID_CHAR;
|
return JS_E_INVALID_CHAR;
|
||||||
src += ARRAY_SIZE(decode_endW);
|
src += ARRAY_SIZE(decode_endW);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "jscript.h"
|
#include "jscript.h"
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||||
|
@ -94,7 +93,7 @@ static const builtin_prop_t *find_builtin_prop(jsdisp_t *This, const WCHAR *name
|
||||||
while(min <= max) {
|
while(min <= max) {
|
||||||
i = (min+max)/2;
|
i = (min+max)/2;
|
||||||
|
|
||||||
r = strcmpW(name, This->builtin_info->props[i].name);
|
r = CompareStringOrdinal(name, -1, This->builtin_info->props[i].name, -1, FALSE) - 2;
|
||||||
if(!r) {
|
if(!r) {
|
||||||
/* Skip prop if it's available only in higher compatibility mode. */
|
/* Skip prop if it's available only in higher compatibility mode. */
|
||||||
unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK)
|
unsigned version = (This->builtin_info->props[i].flags & PROPF_VERSION_MASK)
|
||||||
|
@ -122,7 +121,7 @@ static inline unsigned string_hash(const WCHAR *name)
|
||||||
{
|
{
|
||||||
unsigned h = 0;
|
unsigned h = 0;
|
||||||
for(; *name; name++)
|
for(; *name; name++)
|
||||||
h = (h>>(sizeof(unsigned)*8-4)) ^ (h<<4) ^ tolowerW(*name);
|
h = (h>>(sizeof(unsigned)*8-4)) ^ (h<<4) ^ towlower(*name);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name,
|
||||||
bucket = get_props_idx(This, hash);
|
bucket = get_props_idx(This, hash);
|
||||||
pos = This->props[bucket].bucket_head;
|
pos = This->props[bucket].bucket_head;
|
||||||
while(pos != 0) {
|
while(pos != 0) {
|
||||||
if(!strcmpW(name, This->props[pos].name)) {
|
if(!lstrcmpW(name, This->props[pos].name)) {
|
||||||
if(prev != 0) {
|
if(prev != 0) {
|
||||||
This->props[prev].bucket_next = This->props[pos].bucket_next;
|
This->props[prev].bucket_next = This->props[pos].bucket_next;
|
||||||
This->props[pos].bucket_next = This->props[bucket].bucket_head;
|
This->props[pos].bucket_next = This->props[bucket].bucket_head;
|
||||||
|
@ -240,7 +239,7 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name,
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
|
|
||||||
for(ptr = name; isdigitW(*ptr) && idx < 0x10000; ptr++)
|
for(ptr = name; iswdigit(*ptr) && idx < 0x10000; ptr++)
|
||||||
idx = idx*10 + (*ptr-'0');
|
idx = idx*10 + (*ptr-'0');
|
||||||
if(!*ptr && idx < This->builtin_info->idx_length(This)) {
|
if(!*ptr && idx < This->builtin_info->idx_length(This)) {
|
||||||
prop = alloc_prop(This, name, PROP_IDX, This->builtin_info->idx_put ? PROPF_WRITABLE : 0);
|
prop = alloc_prop(This, name, PROP_IDX, This->builtin_info->idx_put ? PROPF_WRITABLE : 0);
|
||||||
|
@ -1373,7 +1372,7 @@ HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
|
||||||
|
|
||||||
static const WCHAR formatW[] = {'%','d',0};
|
static const WCHAR formatW[] = {'%','d',0};
|
||||||
|
|
||||||
sprintfW(buf, formatW, idx);
|
swprintf(buf, ARRAY_SIZE(buf), formatW, idx);
|
||||||
return jsdisp_propput_name(obj, buf, val);
|
return jsdisp_propput_name(obj, buf, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,7 +1450,7 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
|
||||||
|
|
||||||
static const WCHAR formatW[] = {'%','d',0};
|
static const WCHAR formatW[] = {'%','d',0};
|
||||||
|
|
||||||
sprintfW(name, formatW, idx);
|
swprintf(name, ARRAY_SIZE(name), formatW, idx);
|
||||||
|
|
||||||
hres = find_prop_name_prot(obj, string_hash(name), name, &prop);
|
hres = find_prop_name_prot(obj, string_hash(name), name, &prop);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
|
@ -1520,7 +1519,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
|
||||||
BOOL b;
|
BOOL b;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
sprintfW(buf, formatW, idx);
|
swprintf(buf, ARRAY_SIZE(buf), formatW, idx);
|
||||||
|
|
||||||
hres = find_prop_name(obj, string_hash(buf), buf, &prop);
|
hres = find_prop_name(obj, string_hash(buf), buf, &prop);
|
||||||
if(FAILED(hres) || !prop)
|
if(FAILED(hres) || !prop)
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -616,7 +614,7 @@ static BOOL lookup_global_members(script_ctx_t *ctx, BSTR identifier, exprval_t
|
||||||
|
|
||||||
static int local_ref_cmp(const void *key, const void *ref)
|
static int local_ref_cmp(const void *key, const void *ref)
|
||||||
{
|
{
|
||||||
return strcmpW((const WCHAR*)key, ((const local_ref_t*)ref)->name);
|
return CompareStringOrdinal((const WCHAR*)key, -1, ((const local_ref_t*)ref)->name, -1, FALSE) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
local_ref_t *lookup_local(const function_code_t *function, const WCHAR *identifier)
|
local_ref_t *lookup_local(const function_code_t *function, const WCHAR *identifier)
|
||||||
|
@ -648,7 +646,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strcmpW(identifier, argumentsW)) {
|
if(!lstrcmpW(identifier, argumentsW)) {
|
||||||
hres = detach_variable_object(ctx, scope->frame, FALSE);
|
hres = detach_variable_object(ctx, scope->frame, FALSE);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -672,7 +670,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
|
||||||
}
|
}
|
||||||
|
|
||||||
for(item = ctx->named_items; item; item = item->next) {
|
for(item = ctx->named_items; item; item = item->next) {
|
||||||
if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) {
|
if((item->flags & SCRIPTITEM_ISVISIBLE) && !lstrcmpW(item->name, identifier)) {
|
||||||
if(!item->disp) {
|
if(!item->disp) {
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -387,10 +385,10 @@ static HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str, j
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, ARRAY_SIZE(buf));
|
LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, ARRAY_SIZE(buf));
|
||||||
|
|
||||||
if(str) pos = strchrW(buf, '|');
|
if(str) pos = wcschr(buf, '|');
|
||||||
if(pos) {
|
if(pos) {
|
||||||
int len = strlenW(str);
|
int len = lstrlenW(str);
|
||||||
memmove(pos+len, pos+1, (strlenW(pos+1)+1)*sizeof(WCHAR));
|
memmove(pos+len, pos+1, (lstrlenW(pos+1)+1)*sizeof(WCHAR));
|
||||||
memcpy(pos, str, len*sizeof(WCHAR));
|
memcpy(pos, str, len*sizeof(WCHAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret)
|
||||||
DWORD name_len;
|
DWORD name_len;
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
|
|
||||||
name_len = strlenW(function->name);
|
name_len = lstrlenW(function->name);
|
||||||
str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr);
|
str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr);
|
||||||
if(!str)
|
if(!str)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -312,7 +310,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
switch(*ptr) {
|
switch(*ptr) {
|
||||||
|
@ -380,7 +378,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
while(isspaceW(*str)) str++;
|
while(iswspace(*str)) str++;
|
||||||
|
|
||||||
if(*str == '+')
|
if(*str == '+')
|
||||||
str++;
|
str++;
|
||||||
|
@ -389,10 +387,10 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isdigitW(*str))
|
if(iswdigit(*str))
|
||||||
ret_nan = FALSE;
|
ret_nan = FALSE;
|
||||||
|
|
||||||
while(isdigitW(*str)) {
|
while(iswdigit(*str)) {
|
||||||
hlp = d*10 + *(str++) - '0';
|
hlp = d*10 + *(str++) - '0';
|
||||||
if(d>MAXLONGLONG/10 || hlp<0) {
|
if(d>MAXLONGLONG/10 || hlp<0) {
|
||||||
exp++;
|
exp++;
|
||||||
|
@ -401,17 +399,17 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
else
|
else
|
||||||
d = hlp;
|
d = hlp;
|
||||||
}
|
}
|
||||||
while(isdigitW(*str)) {
|
while(iswdigit(*str)) {
|
||||||
exp++;
|
exp++;
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*str == '.') str++;
|
if(*str == '.') str++;
|
||||||
|
|
||||||
if(isdigitW(*str))
|
if(iswdigit(*str))
|
||||||
ret_nan = FALSE;
|
ret_nan = FALSE;
|
||||||
|
|
||||||
while(isdigitW(*str)) {
|
while(iswdigit(*str)) {
|
||||||
hlp = d*10 + *(str++) - '0';
|
hlp = d*10 + *(str++) - '0';
|
||||||
if(d>MAXLONGLONG/10 || hlp<0)
|
if(d>MAXLONGLONG/10 || hlp<0)
|
||||||
break;
|
break;
|
||||||
|
@ -419,7 +417,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
d = hlp;
|
d = hlp;
|
||||||
exp--;
|
exp--;
|
||||||
}
|
}
|
||||||
while(isdigitW(*str))
|
while(iswdigit(*str))
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
if(*str && !ret_nan && (*str=='e' || *str=='E')) {
|
if(*str && !ret_nan && (*str=='e' || *str=='E')) {
|
||||||
|
@ -433,7 +431,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(isdigitW(*str)) {
|
while(iswdigit(*str)) {
|
||||||
if(e>INT_MAX/10 || (e = e*10 + *str++ - '0')<0)
|
if(e>INT_MAX/10 || (e = e*10 + *str++ - '0')<0)
|
||||||
e = INT_MAX;
|
e = INT_MAX;
|
||||||
}
|
}
|
||||||
|
@ -460,8 +458,8 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int hex_to_int(const WCHAR wch) {
|
static inline int hex_to_int(const WCHAR wch) {
|
||||||
if(toupperW(wch)>='A' && toupperW(wch)<='F') return toupperW(wch)-'A'+10;
|
if(towupper(wch)>='A' && towupper(wch)<='F') return towupper(wch)-'A'+10;
|
||||||
if(isdigitW(wch)) return wch-'0';
|
if(iswdigit(wch)) return wch-'0';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
|
||||||
|
@ -30,7 +31,6 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#include "wine/unicode.h"
|
|
||||||
#include "wine/heap.h"
|
#include "wine/heap.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
|
||||||
if(str) {
|
if(str) {
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
size = (strlenW(str)+1)*sizeof(WCHAR);
|
size = (lstrlenW(str)+1)*sizeof(WCHAR);
|
||||||
ret = heap_alloc(size);
|
ret = heap_alloc(size);
|
||||||
if(ret)
|
if(ret)
|
||||||
memcpy(ret, str, size);
|
memcpy(ret, str, size);
|
||||||
|
@ -505,14 +505,6 @@ static inline BOOL is_vclass(vdisp_t *vdisp, jsclass_t class)
|
||||||
return is_jsdisp(vdisp) && is_class(vdisp->u.jsdisp, class);
|
return is_jsdisp(vdisp) && is_class(vdisp->u.jsdisp, class);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef INT32_MIN
|
|
||||||
#define INT32_MIN (-2147483647-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INT32_MAX
|
|
||||||
#define INT32_MAX (2147483647)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline BOOL is_int32(double d)
|
static inline BOOL is_int32(double d)
|
||||||
{
|
{
|
||||||
return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
|
return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||||
|
|
||||||
|
@ -261,7 +260,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
|
||||||
skip_spaces(ctx);
|
skip_spaces(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*ctx->ptr == '0' && ctx->ptr + 1 < ctx->end && isdigitW(ctx->ptr[1]))
|
if(*ctx->ptr == '0' && ctx->ptr + 1 < ctx->end && iswdigit(ctx->ptr[1]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
||||||
|
@ -395,7 +394,7 @@ static BOOL append_string_len(stringify_ctx_t *ctx, const WCHAR *str, size_t len
|
||||||
|
|
||||||
static inline BOOL append_string(stringify_ctx_t *ctx, const WCHAR *str)
|
static inline BOOL append_string(stringify_ctx_t *ctx, const WCHAR *str)
|
||||||
{
|
{
|
||||||
return append_string_len(ctx, str, strlenW(str));
|
return append_string_len(ctx, str, lstrlenW(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BOOL append_char(stringify_ctx_t *ctx, WCHAR c)
|
static inline BOOL append_char(stringify_ctx_t *ctx, WCHAR c)
|
||||||
|
@ -482,7 +481,7 @@ static HRESULT json_quote(stringify_ctx_t *ctx, const WCHAR *ptr, size_t len)
|
||||||
if(*ptr < ' ') {
|
if(*ptr < ' ') {
|
||||||
static const WCHAR formatW[] = {'\\','u','%','0','4','x',0};
|
static const WCHAR formatW[] = {'\\','u','%','0','4','x',0};
|
||||||
WCHAR buf[7];
|
WCHAR buf[7];
|
||||||
sprintfW(buf, formatW, *ptr);
|
swprintf(buf, ARRAY_SIZE(buf), formatW, *ptr);
|
||||||
if(!append_string(ctx, buf))
|
if(!append_string(ctx, buf))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -99,7 +99,7 @@ jsstr_t *jsstr_alloc_buf(unsigned,WCHAR**) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
static inline jsstr_t *jsstr_alloc(const WCHAR *str)
|
static inline jsstr_t *jsstr_alloc(const WCHAR *str)
|
||||||
{
|
{
|
||||||
return jsstr_alloc_len(str, strlenW(str));
|
return jsstr_alloc_len(str, lstrlenW(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
void jsstr_free(jsstr_t*) DECLSPEC_HIDDEN;
|
void jsstr_free(jsstr_t*) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -516,7 +514,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
||||||
if(!ptr)
|
if(!ptr)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr == '-') {
|
if(*ptr == '-') {
|
||||||
|
@ -526,9 +524,9 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strncmpW(ptr, infinityW, ARRAY_SIZE(infinityW))) {
|
if(!wcsncmp(ptr, infinityW, ARRAY_SIZE(infinityW))) {
|
||||||
ptr += ARRAY_SIZE(infinityW);
|
ptr += ARRAY_SIZE(infinityW);
|
||||||
while(*ptr && isspaceW(*ptr))
|
while(*ptr && iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr)
|
if(*ptr)
|
||||||
|
@ -551,7 +549,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(isdigitW(*ptr))
|
while(iswdigit(*ptr))
|
||||||
d = d*10 + (*ptr++ - '0');
|
d = d*10 + (*ptr++ - '0');
|
||||||
|
|
||||||
if(*ptr == 'e' || *ptr == 'E') {
|
if(*ptr == 'e' || *ptr == 'E') {
|
||||||
|
@ -566,7 +564,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(isdigitW(*ptr))
|
while(iswdigit(*ptr))
|
||||||
l = l*10 + (*ptr++ - '0');
|
l = l*10 + (*ptr++ - '0');
|
||||||
if(eneg)
|
if(eneg)
|
||||||
l = -l;
|
l = -l;
|
||||||
|
@ -576,13 +574,13 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
|
||||||
DOUBLE dec = 0.1;
|
DOUBLE dec = 0.1;
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
while(isdigitW(*ptr)) {
|
while(iswdigit(*ptr)) {
|
||||||
d += dec * (*ptr++ - '0');
|
d += dec * (*ptr++ - '0');
|
||||||
dec *= 0.1;
|
dec *= 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(iswspace(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
if(*ptr) {
|
if(*ptr) {
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "jscript.h"
|
#include "jscript.h"
|
||||||
#include "activscp.h"
|
#include "activscp.h"
|
||||||
|
@ -30,7 +29,6 @@
|
||||||
#include "parser.tab.h"
|
#include "parser.tab.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
|
||||||
|
|
||||||
|
@ -116,12 +114,12 @@ static int lex_error(parser_ctx_t *ctx, HRESULT hres)
|
||||||
/* ECMA-262 3rd Edition 7.6 */
|
/* ECMA-262 3rd Edition 7.6 */
|
||||||
BOOL is_identifier_char(WCHAR c)
|
BOOL is_identifier_char(WCHAR c)
|
||||||
{
|
{
|
||||||
return isalnumW(c) || c == '$' || c == '_' || c == '\\';
|
return iswalnum(c) || c == '$' || c == '_' || c == '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL is_identifier_first_char(WCHAR c)
|
static BOOL is_identifier_first_char(WCHAR c)
|
||||||
{
|
{
|
||||||
return isalphaW(c) || c == '$' || c == '_' || c == '\\';
|
return iswalpha(c) || c == '$' || c == '_' || c == '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
|
static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval)
|
||||||
|
@ -177,7 +175,7 @@ static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
|
||||||
if(ctx->script->version < keywords[i].min_version) {
|
if(ctx->script->version < keywords[i].min_version) {
|
||||||
TRACE("ignoring keyword %s in incompatible mode\n",
|
TRACE("ignoring keyword %s in incompatible mode\n",
|
||||||
debugstr_w(keywords[i].word));
|
debugstr_w(keywords[i].word));
|
||||||
ctx->ptr -= strlenW(keywords[i].word);
|
ctx->ptr -= lstrlenW(keywords[i].word);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ctx->implicit_nl_semicolon = keywords[i].no_nl;
|
ctx->implicit_nl_semicolon = keywords[i].no_nl;
|
||||||
|
@ -252,7 +250,7 @@ static BOOL skip_comment(parser_ctx_t *ctx)
|
||||||
|
|
||||||
static BOOL skip_spaces(parser_ctx_t *ctx)
|
static BOOL skip_spaces(parser_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
while(ctx->ptr < ctx->end && (isspaceW(*ctx->ptr) || *ctx->ptr == 0xFEFF /* UTF16 BOM */)) {
|
while(ctx->ptr < ctx->end && (iswspace(*ctx->ptr) || *ctx->ptr == 0xFEFF /* UTF16 BOM */)) {
|
||||||
if(is_endline(*ctx->ptr++))
|
if(is_endline(*ctx->ptr++))
|
||||||
ctx->nl = TRUE;
|
ctx->nl = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -333,11 +331,11 @@ BOOL unescape(WCHAR *str, size_t *len)
|
||||||
c += i;
|
c += i;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(isdigitW(*p)) {
|
if(iswdigit(*p)) {
|
||||||
c = *p++ - '0';
|
c = *p++ - '0';
|
||||||
if(p < end && isdigitW(*p)) {
|
if(p < end && iswdigit(*p)) {
|
||||||
c = c*8 + (*p++ - '0');
|
c = c*8 + (*p++ - '0');
|
||||||
if(p < end && isdigitW(*p))
|
if(p < end && iswdigit(*p))
|
||||||
c = c*8 + (*p++ - '0');
|
c = c*8 + (*p++ - '0');
|
||||||
}
|
}
|
||||||
p--;
|
p--;
|
||||||
|
@ -436,7 +434,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
LONGLONG d = 0, hlp;
|
LONGLONG d = 0, hlp;
|
||||||
int exp = 0;
|
int exp = 0;
|
||||||
|
|
||||||
while(ptr < end && isdigitW(*ptr)) {
|
while(ptr < end && iswdigit(*ptr)) {
|
||||||
hlp = d*10 + *(ptr++) - '0';
|
hlp = d*10 + *(ptr++) - '0';
|
||||||
if(d>MAXLONGLONG/10 || hlp<0) {
|
if(d>MAXLONGLONG/10 || hlp<0) {
|
||||||
exp++;
|
exp++;
|
||||||
|
@ -445,7 +443,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
else
|
else
|
||||||
d = hlp;
|
d = hlp;
|
||||||
}
|
}
|
||||||
while(ptr < end && isdigitW(*ptr)) {
|
while(ptr < end && iswdigit(*ptr)) {
|
||||||
exp++;
|
exp++;
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
@ -453,7 +451,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
if(*ptr == '.') {
|
if(*ptr == '.') {
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
while(ptr < end && isdigitW(*ptr)) {
|
while(ptr < end && iswdigit(*ptr)) {
|
||||||
hlp = d*10 + *(ptr++) - '0';
|
hlp = d*10 + *(ptr++) - '0';
|
||||||
if(d>MAXLONGLONG/10 || hlp<0)
|
if(d>MAXLONGLONG/10 || hlp<0)
|
||||||
break;
|
break;
|
||||||
|
@ -461,7 +459,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
d = hlp;
|
d = hlp;
|
||||||
exp--;
|
exp--;
|
||||||
}
|
}
|
||||||
while(ptr < end && isdigitW(*ptr))
|
while(ptr < end && iswdigit(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +472,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
}else if(*ptr == '-') {
|
}else if(*ptr == '-') {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
ptr++;
|
ptr++;
|
||||||
}else if(!isdigitW(*ptr)) {
|
}else if(!iswdigit(*ptr)) {
|
||||||
WARN("Expected exponent part\n");
|
WARN("Expected exponent part\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +483,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(ptr < end && isdigitW(*ptr)) {
|
while(ptr < end && iswdigit(*ptr)) {
|
||||||
if(e > INT_MAX/10 || (e = e*10 + *ptr++ - '0')<0)
|
if(e > INT_MAX/10 || (e = e*10 + *ptr++ - '0')<0)
|
||||||
e = INT_MAX;
|
e = INT_MAX;
|
||||||
}
|
}
|
||||||
|
@ -536,12 +534,12 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isdigitW(*ctx->ptr)) {
|
if(iswdigit(*ctx->ptr)) {
|
||||||
unsigned base = 8;
|
unsigned base = 8;
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
double val = 0;
|
double val = 0;
|
||||||
|
|
||||||
for(ptr = ctx->ptr; ptr < ctx->end && isdigitW(*ptr); ptr++) {
|
for(ptr = ctx->ptr; ptr < ctx->end && iswdigit(*ptr); ptr++) {
|
||||||
if(*ptr > '7') {
|
if(*ptr > '7') {
|
||||||
base = 10;
|
base = 10;
|
||||||
break;
|
break;
|
||||||
|
@ -550,7 +548,7 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
val = val*base + *ctx->ptr-'0';
|
val = val*base + *ctx->ptr-'0';
|
||||||
}while(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr));
|
}while(++ctx->ptr < ctx->end && iswdigit(*ctx->ptr));
|
||||||
|
|
||||||
/* FIXME: Do we need it here? */
|
/* FIXME: Do we need it here? */
|
||||||
if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) {
|
if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) {
|
||||||
|
@ -592,7 +590,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
|
||||||
ctx->implicit_nl_semicolon = FALSE;
|
ctx->implicit_nl_semicolon = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isalphaW(*ctx->ptr)) {
|
if(iswalpha(*ctx->ptr)) {
|
||||||
int ret = check_keywords(ctx, lval);
|
int ret = check_keywords(ctx, lval);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -600,7 +598,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
|
||||||
return parse_identifier(ctx, lval);
|
return parse_identifier(ctx, lval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isdigitW(*ctx->ptr)) {
|
if(iswdigit(*ctx->ptr)) {
|
||||||
double n;
|
double n;
|
||||||
|
|
||||||
if(!parse_numeric_literal(ctx, &n))
|
if(!parse_numeric_literal(ctx, &n))
|
||||||
|
@ -627,7 +625,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
|
||||||
return '}';
|
return '}';
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
if(ctx->ptr+1 < ctx->end && isdigitW(ctx->ptr[1])) {
|
if(ctx->ptr+1 < ctx->end && iswdigit(ctx->ptr[1])) {
|
||||||
double n;
|
double n;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
|
||||||
|
@ -867,7 +865,7 @@ static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
|
||||||
cc_var_t *new_v;
|
cc_var_t *new_v;
|
||||||
|
|
||||||
if(len == -1)
|
if(len == -1)
|
||||||
len = strlenW(name);
|
len = lstrlenW(name);
|
||||||
|
|
||||||
new_v = heap_alloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR));
|
new_v = heap_alloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR));
|
||||||
if(!new_v)
|
if(!new_v)
|
||||||
|
@ -953,7 +951,7 @@ int try_parse_ccval(parser_ctx_t *ctx, ccval_t *r)
|
||||||
if(!skip_spaces(ctx))
|
if(!skip_spaces(ctx))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(isdigitW(*ctx->ptr)) {
|
if(iswdigit(*ctx->ptr)) {
|
||||||
double n;
|
double n;
|
||||||
|
|
||||||
if(!parse_numeric_literal(ctx, &n))
|
if(!parse_numeric_literal(ctx, &n))
|
||||||
|
@ -995,7 +993,7 @@ static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
ptr = strchrW(ctx->ptr, '@');
|
ptr = wcschr(ctx->ptr, '@');
|
||||||
if(!ptr) {
|
if(!ptr) {
|
||||||
WARN("No @end\n");
|
WARN("No @end\n");
|
||||||
return lex_error(ctx, JS_E_EXPECTED_CCEND);
|
return lex_error(ctx, JS_E_EXPECTED_CCEND);
|
||||||
|
@ -1200,7 +1198,7 @@ literal_t *parse_regexp(parser_ctx_t *ctx)
|
||||||
re_len = ctx->ptr-re;
|
re_len = ctx->ptr-re;
|
||||||
|
|
||||||
flags_ptr = ++ctx->ptr;
|
flags_ptr = ++ctx->ptr;
|
||||||
while(ctx->ptr < ctx->end && isalnumW(*ctx->ptr))
|
while(ctx->ptr < ctx->end && iswalnum(*ctx->ptr))
|
||||||
ctx->ptr++;
|
ctx->ptr++;
|
||||||
|
|
||||||
hres = parse_regexp_flags(flags_ptr, ctx->ptr-flags_ptr, &flags);
|
hres = parse_regexp_flags(flags_ptr, ctx->ptr-flags_ptr, &flags);
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
|
@ -332,7 +332,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
|
||||||
ch = '-';
|
ch = '-';
|
||||||
}
|
}
|
||||||
else ch = '+';
|
else ch = '+';
|
||||||
sprintfW(&buf[idx], formatW, ch, (int)log_radix);
|
swprintf(&buf[idx], ARRAY_SIZE(buf) - idx, formatW, ch, (int)log_radix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else buf[idx] = '\0';
|
else buf[idx] = '\0';
|
||||||
|
|
|
@ -89,11 +89,11 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
|
||||||
jsstr_t *ret;
|
jsstr_t *ret;
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
|
|
||||||
ret = jsstr_alloc_buf(9+strlenW(str), &ptr);
|
ret = jsstr_alloc_buf(9+lstrlenW(str), &ptr);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
sprintfW(ptr, formatW, str);
|
swprintf(ptr, 9 + lstrlenW(str), formatW, str);
|
||||||
*r = jsval_string(ret);
|
*r = jsval_string(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -813,7 +813,7 @@ GetterSetterMethod
|
||||||
|
|
||||||
/* Ecma-262 3rd Edition 11.1.5 */
|
/* Ecma-262 3rd Edition 11.1.5 */
|
||||||
PropertyName
|
PropertyName
|
||||||
: IdentifierName { $$ = new_string_literal(ctx, compiler_alloc_string_len(ctx->compiler, $1, strlenW($1))); }
|
: IdentifierName { $$ = new_string_literal(ctx, compiler_alloc_string_len(ctx->compiler, $1, lstrlenW($1))); }
|
||||||
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
|
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
|
||||||
| tNumericLiteral { $$ = $1; }
|
| tNumericLiteral { $$ = $1; }
|
||||||
|
|
||||||
|
@ -1580,10 +1580,10 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, const
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
parser_ctx->hres = JS_E_SYNTAX;
|
parser_ctx->hres = JS_E_SYNTAX;
|
||||||
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
|
parser_ctx->is_html = delimiter && !wcsicmp(delimiter, html_tagW);
|
||||||
|
|
||||||
parser_ctx->begin = parser_ctx->ptr = code;
|
parser_ctx->begin = parser_ctx->ptr = code;
|
||||||
parser_ctx->end = parser_ctx->begin + strlenW(parser_ctx->begin);
|
parser_ctx->end = parser_ctx->begin + lstrlenW(parser_ctx->begin);
|
||||||
|
|
||||||
script_addref(ctx);
|
script_addref(ctx);
|
||||||
parser_ctx->script = ctx;
|
parser_ctx->script = ctx;
|
||||||
|
|
|
@ -1142,8 +1142,8 @@ lexHex:
|
||||||
for (i = rangeStart; i <= localMax; i++) {
|
for (i = rangeStart; i <= localMax; i++) {
|
||||||
WCHAR uch, dch;
|
WCHAR uch, dch;
|
||||||
|
|
||||||
uch = toupperW(i);
|
uch = towupper(i);
|
||||||
dch = tolowerW(i);
|
dch = towlower(i);
|
||||||
if(maxch < uch)
|
if(maxch < uch)
|
||||||
maxch = uch;
|
maxch = uch;
|
||||||
if(maxch < dch)
|
if(maxch < dch)
|
||||||
|
@ -1988,7 +1988,7 @@ FlatNIMatcher(REGlobalData *gData, match_state_t *x, const WCHAR *matchChars,
|
||||||
if (length > (size_t)(gData->cpend - x->cp))
|
if (length > (size_t)(gData->cpend - x->cp))
|
||||||
return NULL;
|
return NULL;
|
||||||
for (i = 0; i != length; i++) {
|
for (i = 0; i != length; i++) {
|
||||||
if (toupperW(matchChars[i]) != toupperW(x->cp[i]))
|
if (towupper(matchChars[i]) != towupper(x->cp[i]))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
x->cp += length;
|
x->cp += length;
|
||||||
|
@ -2035,7 +2035,7 @@ BackrefMatcher(REGlobalData *gData, match_state_t *x, size_t parenIndex)
|
||||||
parenContent = &gData->cpbegin[cap->index];
|
parenContent = &gData->cpbegin[cap->index];
|
||||||
if (gData->regexp->flags & REG_FOLD) {
|
if (gData->regexp->flags & REG_FOLD) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (toupperW(parenContent[i]) != toupperW(x->cp[i]))
|
if (towupper(parenContent[i]) != towupper(x->cp[i]))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2226,12 +2226,12 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
|
||||||
continue;
|
continue;
|
||||||
case 's':
|
case 's':
|
||||||
for (i = (INT)charSet->length; i >= 0; i--)
|
for (i = (INT)charSet->length; i >= 0; i--)
|
||||||
if (isspaceW(i))
|
if (iswspace(i))
|
||||||
AddCharacterToCharSet(charSet, (WCHAR)i);
|
AddCharacterToCharSet(charSet, (WCHAR)i);
|
||||||
continue;
|
continue;
|
||||||
case 'S':
|
case 'S':
|
||||||
for (i = (INT)charSet->length; i >= 0; i--)
|
for (i = (INT)charSet->length; i >= 0; i--)
|
||||||
if (!isspaceW(i))
|
if (!iswspace(i))
|
||||||
AddCharacterToCharSet(charSet, (WCHAR)i);
|
AddCharacterToCharSet(charSet, (WCHAR)i);
|
||||||
continue;
|
continue;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
@ -2263,8 +2263,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
|
||||||
WCHAR uch, dch;
|
WCHAR uch, dch;
|
||||||
|
|
||||||
AddCharacterToCharSet(charSet, i);
|
AddCharacterToCharSet(charSet, i);
|
||||||
uch = toupperW(i);
|
uch = towupper(i);
|
||||||
dch = tolowerW(i);
|
dch = towlower(i);
|
||||||
if (i != uch)
|
if (i != uch)
|
||||||
AddCharacterToCharSet(charSet, uch);
|
AddCharacterToCharSet(charSet, uch);
|
||||||
if (i != dch)
|
if (i != dch)
|
||||||
|
@ -2276,8 +2276,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
|
||||||
inRange = FALSE;
|
inRange = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (gData->regexp->flags & REG_FOLD) {
|
if (gData->regexp->flags & REG_FOLD) {
|
||||||
AddCharacterToCharSet(charSet, toupperW(thisCh));
|
AddCharacterToCharSet(charSet, towupper(thisCh));
|
||||||
AddCharacterToCharSet(charSet, tolowerW(thisCh));
|
AddCharacterToCharSet(charSet, towlower(thisCh));
|
||||||
} else {
|
} else {
|
||||||
AddCharacterToCharSet(charSet, thisCh);
|
AddCharacterToCharSet(charSet, thisCh);
|
||||||
}
|
}
|
||||||
|
@ -2411,13 +2411,13 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REOP_SPACE:
|
case REOP_SPACE:
|
||||||
if (x->cp != gData->cpend && isspaceW(*x->cp)) {
|
if (x->cp != gData->cpend && iswspace(*x->cp)) {
|
||||||
result = x;
|
result = x;
|
||||||
result->cp++;
|
result->cp++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REOP_NONSPACE:
|
case REOP_NONSPACE:
|
||||||
if (x->cp != gData->cpend && !isspaceW(*x->cp)) {
|
if (x->cp != gData->cpend && !iswspace(*x->cp)) {
|
||||||
result = x;
|
result = x;
|
||||||
result->cp++;
|
result->cp++;
|
||||||
}
|
}
|
||||||
|
@ -2463,7 +2463,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
|
||||||
break;
|
break;
|
||||||
case REOP_FLAT1i:
|
case REOP_FLAT1i:
|
||||||
matchCh = *pc++;
|
matchCh = *pc++;
|
||||||
if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) {
|
if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) {
|
||||||
result = x;
|
result = x;
|
||||||
result->cp++;
|
result->cp++;
|
||||||
}
|
}
|
||||||
|
@ -2480,7 +2480,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
|
||||||
case REOP_UCFLAT1i:
|
case REOP_UCFLAT1i:
|
||||||
matchCh = GET_ARG(pc);
|
matchCh = GET_ARG(pc);
|
||||||
pc += ARG_LEN;
|
pc += ARG_LEN;
|
||||||
if (x->cp != gData->cpend && toupperW(*x->cp) == toupperW(matchCh)) {
|
if (x->cp != gData->cpend && towupper(*x->cp) == towupper(matchCh)) {
|
||||||
result = x;
|
result = x;
|
||||||
result->cp++;
|
result->cp++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
#include <math.h>
|
||||||
|
|
||||||
#include "jscript.h"
|
#include "jscript.h"
|
||||||
#include "regexp.h"
|
#include "regexp.h"
|
||||||
|
@ -168,7 +168,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, j
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
tagname_len = strlenW(tagname);
|
tagname_len = lstrlenW(tagname);
|
||||||
|
|
||||||
ret = jsstr_alloc_buf(jsstr_length(str) + 2*tagname_len + 5, &ptr);
|
ret = jsstr_alloc_buf(jsstr_length(str) + 2*tagname_len + 5, &ptr);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
|
@ -215,8 +215,8 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
|
||||||
}
|
}
|
||||||
|
|
||||||
if(r) {
|
if(r) {
|
||||||
unsigned attrname_len = strlenW(attrname);
|
unsigned attrname_len = lstrlenW(attrname);
|
||||||
unsigned tagname_len = strlenW(tagname);
|
unsigned tagname_len = lstrlenW(tagname);
|
||||||
jsstr_t *ret;
|
jsstr_t *ret;
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
match->cp = str;
|
match->cp = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
match->cp = strstrW(match->cp, match_str);
|
match->cp = wcsstr(match->cp, match_str);
|
||||||
if(!match->cp)
|
if(!match->cp)
|
||||||
break;
|
break;
|
||||||
match->match_len = jsstr_length(match_jsstr);
|
match->match_len = jsstr_length(match_jsstr);
|
||||||
|
@ -879,7 +879,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
}else if(rep_str && regexp) {
|
}else if(rep_str && regexp) {
|
||||||
const WCHAR *ptr = rep_str, *ptr2;
|
const WCHAR *ptr = rep_str, *ptr2;
|
||||||
|
|
||||||
while((ptr2 = strchrW(ptr, '$'))) {
|
while((ptr2 = wcschr(ptr, '$'))) {
|
||||||
hres = strbuf_append(&ret, ptr, ptr2-ptr);
|
hres = strbuf_append(&ret, ptr, ptr2-ptr);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
break;
|
break;
|
||||||
|
@ -904,14 +904,14 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
default: {
|
default: {
|
||||||
DWORD idx;
|
DWORD idx;
|
||||||
|
|
||||||
if(!isdigitW(ptr2[1])) {
|
if(!iswdigit(ptr2[1])) {
|
||||||
hres = strbuf_append(&ret, ptr2, 1);
|
hres = strbuf_append(&ret, ptr2, 1);
|
||||||
ptr = ptr2+1;
|
ptr = ptr2+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = ptr2[1] - '0';
|
idx = ptr2[1] - '0';
|
||||||
if(isdigitW(ptr2[2]) && idx*10 + (ptr2[2]-'0') <= match->paren_count) {
|
if(iswdigit(ptr2[2]) && idx*10 + (ptr2[2]-'0') <= match->paren_count) {
|
||||||
idx = idx*10 + (ptr[2]-'0');
|
idx = idx*10 + (ptr[2]-'0');
|
||||||
ptr = ptr2+3;
|
ptr = ptr2+3;
|
||||||
}else if(idx && idx <= match->paren_count) {
|
}else if(idx && idx <= match->paren_count) {
|
||||||
|
@ -1227,7 +1227,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
|
||||||
}
|
}
|
||||||
ptr2 = match_result.cp - match_result.match_len;
|
ptr2 = match_result.cp - match_result.match_len;
|
||||||
}else if(match_str) {
|
}else if(match_str) {
|
||||||
ptr2 = strstrW(ptr, match_str);
|
ptr2 = wcsstr(ptr, match_str);
|
||||||
if(!ptr2)
|
if(!ptr2)
|
||||||
break;
|
break;
|
||||||
}else {
|
}else {
|
||||||
|
@ -1446,7 +1446,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
||||||
}
|
}
|
||||||
|
|
||||||
jsstr_flush(str, buf);
|
jsstr_flush(str, buf);
|
||||||
for (; len--; buf++) *buf = tolowerW(*buf);
|
for (; len--; buf++) *buf = towlower(*buf);
|
||||||
|
|
||||||
*r = jsval_string(ret);
|
*r = jsval_string(ret);
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1478,7 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
||||||
}
|
}
|
||||||
|
|
||||||
jsstr_flush(str, buf);
|
jsstr_flush(str, buf);
|
||||||
for (; len--; buf++) *buf = toupperW(*buf);
|
for (; len--; buf++) *buf = towupper(*buf);
|
||||||
|
|
||||||
*r = jsval_string(ret);
|
*r = jsval_string(ret);
|
||||||
}
|
}
|
||||||
|
@ -1516,8 +1516,8 @@ static HRESULT String_trim(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsig
|
||||||
len = jsstr_length(jsstr);
|
len = jsstr_length(jsstr);
|
||||||
TRACE("%s\n", debugstr_wn(str, len));
|
TRACE("%s\n", debugstr_wn(str, len));
|
||||||
|
|
||||||
for(begin = str, end = str + len; begin < end && isspaceW(*begin); begin++);
|
for(begin = str, end = str + len; begin < end && iswspace(*begin); begin++);
|
||||||
while(end > begin + 1 && isspaceW(*(end-1))) end--;
|
while(end > begin + 1 && iswspace(*(end-1))) end--;
|
||||||
|
|
||||||
if(r) {
|
if(r) {
|
||||||
jsstr_t *ret;
|
jsstr_t *ret;
|
||||||
|
|
Loading…
Reference in New Issue