Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
29ea8b42
Commit
29ea8b42
authored
5 years ago
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Build with msvcrt.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0af6002a
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
145 additions
and
170 deletions
+145
-170
Makefile.in
dlls/jscript/Makefile.in
+2
-0
activex.c
dlls/jscript/activex.c
+0
-2
array.c
dlls/jscript/array.c
+5
-7
compile.c
dlls/jscript/compile.c
+11
-11
date.c
dlls/jscript/date.c
+29
-30
decode.c
dlls/jscript/decode.c
+2
-2
dispex.c
dlls/jscript/dispex.c
+7
-8
engine.c
dlls/jscript/engine.c
+3
-5
error.c
dlls/jscript/error.c
+3
-5
function.c
dlls/jscript/function.c
+1
-1
global.c
dlls/jscript/global.c
+11
-13
jscript.h
dlls/jscript/jscript.h
+2
-10
json.c
dlls/jscript/json.c
+3
-4
jsstr.h
dlls/jscript/jsstr.h
+1
-1
jsutils.c
dlls/jscript/jsutils.c
+7
-9
lex.c
dlls/jscript/lex.c
+24
-26
math.c
dlls/jscript/math.c
+0
-2
number.c
dlls/jscript/number.c
+1
-1
object.c
dlls/jscript/object.c
+2
-2
parser.y
dlls/jscript/parser.y
+3
-3
regexp.c
dlls/jscript/regexp.c
+14
-14
string.c
dlls/jscript/string.c
+14
-14
No files found.
dlls/jscript/Makefile.in
View file @
29ea8b42
MODULE
=
jscript.dll
IMPORTS
=
oleaut32 ole32 user32 advapi32
EXTRADLLFLAGS
=
-mno-cygwin
C_SRCS
=
\
activex.c
\
array.c
\
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/activex.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "jscript.h"
#include "objsafe.h"
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/array.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.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
);
}
else
{
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
strlenW
(
default_separatorW
),
r
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
default_separatorW
,
l
strlenW
(
default_separatorW
),
r
);
}
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
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
strlenW
(
default_separatorW
),
r
);
l
strlenW
(
default_separatorW
),
r
);
}
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
"
);
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
strlenW
(
default_separatorW
),
r
);
l
strlenW
(
default_separatorW
),
r
);
}
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
;
DWORD
id
=
0
;
if
(
!
is
digitW
(
*
ptr
))
if
(
!
is
wdigit
(
*
ptr
))
return
;
while
(
*
ptr
&&
is
digitW
(
*
ptr
))
{
while
(
*
ptr
&&
is
wdigit
(
*
ptr
))
{
id
=
id
*
10
+
(
*
ptr
-
'0'
);
ptr
++
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/compile.c
View file @
29ea8b42
...
...
@@ -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
)
{
return
compiler_alloc_string_len
(
ctx
,
str
,
strlenW
(
str
));
return
compiler_alloc_string_len
(
ctx
,
str
,
l
strlenW
(
str
));
}
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
)
{
if
(
iter
->
continue_label
)
pop_ctx
=
iter
;
if
(
iter
->
labelled_stat
&&
!
strcmpW
(
iter
->
labelled_stat
->
identifier
,
stat
->
identifier
))
if
(
iter
->
labelled_stat
&&
!
l
strcmpW
(
iter
->
labelled_stat
->
identifier
,
stat
->
identifier
))
break
;
}
...
...
@@ -1465,7 +1465,7 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
if
(
stat
->
identifier
)
{
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
&&
!
l
strcmpW
(
pop_ctx
->
labelled_stat
->
identifier
,
stat
->
identifier
))
{
assert
(
pop_ctx
->
break_label
);
break
;
}
...
...
@@ -1549,7 +1549,7 @@ static HRESULT compile_labelled_statement(compiler_ctx_t *ctx, labelled_statemen
HRESULT
hres
;
for
(
iter
=
ctx
->
stat_ctx
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
->
labelled_stat
&&
!
strcmpW
(
iter
->
labelled_stat
->
identifier
,
stat
->
identifier
))
{
if
(
iter
->
labelled_stat
&&
!
l
strcmpW
(
iter
->
labelled_stat
->
identifier
,
stat
->
identifier
))
{
WARN
(
"Label %s redefined
\n
"
,
debugstr_w
(
stat
->
identifier
));
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
)
{
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
)
...
...
@@ -2382,7 +2382,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
const
WCHAR
*
ptr
=
args
,
*
ptr2
;
unsigned
arg_cnt
=
0
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
!*
ptr
)
{
if
(
args_size
)
...
...
@@ -2391,16 +2391,16 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
}
while
(
1
)
{
if
(
!
is
alphaW
(
*
ptr
)
&&
*
ptr
!=
'_'
)
{
if
(
!
is
walpha
(
*
ptr
)
&&
*
ptr
!=
'_'
)
{
FIXME
(
"expected alpha or '_': %s
\n
"
,
debugstr_w
(
ptr
));
return
E_FAIL
;
}
ptr2
=
ptr
;
while
(
is
alnumW
(
*
ptr
)
||
*
ptr
==
'_'
)
while
(
is
walnum
(
*
ptr
)
||
*
ptr
==
'_'
)
ptr
++
;
if
(
*
ptr
&&
*
ptr
!=
','
&&
!
is
spaceW
(
*
ptr
))
{
if
(
*
ptr
&&
*
ptr
!=
','
&&
!
is
wspace
(
*
ptr
))
{
FIXME
(
"unexpected har %s
\n
"
,
debugstr_w
(
ptr
));
return
E_FAIL
;
}
...
...
@@ -2412,7 +2412,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
}
arg_cnt
++
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
!*
ptr
)
break
;
...
...
@@ -2422,7 +2422,7 @@ static HRESULT parse_arguments(compiler_ctx_t *ctx, const WCHAR *args, BSTR *arg
}
ptr
++
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/date.c
View file @
29ea8b42
...
...
@@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <limits.h>
#include <math.h>
...
...
@@ -542,16 +540,16 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
}
if
(
!
show_offset
)
s
printfW
(
buf
,
formatNoOffsetW
,
week
,
month
,
day
,
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatNoOffsetW
,
week
,
month
,
day
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
),
year
,
formatAD
?
ADW
:
BCW
);
else
if
(
offset
)
s
printfW
(
buf
,
formatW
,
week
,
month
,
day
,
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
week
,
month
,
day
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
),
sign
,
offset
/
60
,
offset
%
60
,
year
,
formatAD
?
ADW
:
BCW
);
else
s
printfW
(
buf
,
formatUTCW
,
week
,
month
,
day
,
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatUTCW
,
week
,
month
,
day
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
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
)
{
*
p
++
=
'-'
;
p
+=
s
printfW
(
p
,
long_year_formatW
,
-
(
int
)
year
);
p
+=
s
wprintf
(
p
,
ARRAY_SIZE
(
buf
)
-
1
,
long_year_formatW
,
-
(
int
)
year
);
}
else
if
(
year
>
9999
)
{
*
p
++
=
'+'
;
p
+=
s
printfW
(
p
,
long_year_formatW
,
(
int
)
year
);
p
+=
s
wprintf
(
p
,
ARRAY_SIZE
(
buf
)
-
1
,
long_year_formatW
,
(
int
)
year
);
}
else
{
p
+=
s
printfW
(
p
,
short_year_formatW
,
(
int
)
year
);
p
+=
s
wprintf
(
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
)
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
);
s
printfW
(
buf
,
formatAD
?
formatADW
:
formatBCW
,
week
,
day
,
month
,
year
,
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatAD
?
formatADW
:
formatBCW
,
week
,
day
,
month
,
year
,
(
int
)
hour_from_time
(
date
->
time
),
(
int
)
min_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
);
s
printfW
(
buf
,
formatAD
?
formatADW
:
formatBCW
,
week
,
month
,
day
,
year
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatAD
?
formatADW
:
formatBCW
,
week
,
month
,
day
,
year
);
date_str
=
jsstr_alloc
(
buf
);
if
(
!
date_str
)
...
...
@@ -883,11 +882,11 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
else
sign
=
'-'
;
if
(
offset
)
s
printfW
(
buf
,
formatW
,
(
int
)
hour_from_time
(
time
),
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
),
sign
,
offset
/
60
,
offset
%
60
);
else
s
printfW
(
buf
,
formatUTCW
,
(
int
)
hour_from_time
(
time
),
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatUTCW
,
(
int
)
hour_from_time
(
time
),
(
int
)
min_from_time
(
time
),
(
int
)
sec_from_time
(
time
));
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
++
)
{
if
(
input
[
i
]
==
'('
)
nest_level
++
;
else
if
(
input
[
i
]
==
')'
)
nest_level
--
;
else
if
(
!
nest_level
)
parse
[
parse_len
++
]
=
to
upperW
(
input
[
i
]);
else
if
(
!
nest_level
)
parse
[
parse_len
++
]
=
to
wupper
(
input
[
i
]);
}
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
;)
{
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
if
(
parse
[
i
]
==
','
)
{
while
(
parse
[
i
]
==
','
)
i
++
;
continue
;
}
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
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
if
(
parse
[
i
]
==
':'
)
{
/* Time */
...
...
@@ -2121,17 +2120,17 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
hour
=
tmp
;
while
(
parse
[
i
]
==
':'
)
i
++
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
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
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
while
(
parse
[
i
]
==
':'
)
i
++
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
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
++
;
}
}
...
...
@@ -2144,17 +2143,17 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
month
=
tmp
-
1
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
while
(
parse
[
i
]
==
'-'
||
parse
[
i
]
==
'/'
)
i
++
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
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
]
==
'-'
||
parse
[
i
]
==
'/'
)
i
++
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
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
++
;
if
(
tmp
>=
70
){
...
...
@@ -2189,9 +2188,9 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
if
(
parse
[
i
]
==
'-'
)
positive
=
FALSE
;
i
++
;
while
(
is
spaceW
(
parse
[
i
]))
i
++
;
while
(
is
wspace
(
parse
[
i
]))
i
++
;
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
++
;
if
(
offset
<
24
)
offset
*=
60
;
...
...
@@ -2270,7 +2269,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
size
-=
i
;
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
(
set_month
)
break
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/decode.c
View file @
29ea8b42
...
...
@@ -117,7 +117,7 @@ HRESULT decode_source(WCHAR *code)
static
const
WCHAR
decode_endW
[]
=
{
'^'
,
'#'
,
'~'
,
'@'
};
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
;
src
+=
ARRAY_SIZE
(
decode_beginW
);
...
...
@@ -165,7 +165,7 @@ HRESULT decode_source(WCHAR *code)
return
JS_E_INVALID_CHAR
;
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
;
src
+=
ARRAY_SIZE
(
decode_endW
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/dispex.c
View file @
29ea8b42
...
...
@@ -20,7 +20,6 @@
#include "jscript.h"
#include "wine/unicode.h"
#include "wine/debug.h"
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
)
{
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
)
{
/* Skip prop if it's available only in higher compatibility mode. */
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
;
for
(;
*
name
;
name
++
)
h
=
(
h
>>
(
sizeof
(
unsigned
)
*
8
-
4
))
^
(
h
<<
4
)
^
to
lowerW
(
*
name
);
h
=
(
h
>>
(
sizeof
(
unsigned
)
*
8
-
4
))
^
(
h
<<
4
)
^
to
wlower
(
*
name
);
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
);
pos
=
This
->
props
[
bucket
].
bucket_head
;
while
(
pos
!=
0
)
{
if
(
!
strcmpW
(
name
,
This
->
props
[
pos
].
name
))
{
if
(
!
l
strcmpW
(
name
,
This
->
props
[
pos
].
name
))
{
if
(
prev
!=
0
)
{
This
->
props
[
prev
].
bucket_next
=
This
->
props
[
pos
].
bucket_next
;
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
;
unsigned
idx
=
0
;
for
(
ptr
=
name
;
is
digitW
(
*
ptr
)
&&
idx
<
0x10000
;
ptr
++
)
for
(
ptr
=
name
;
is
wdigit
(
*
ptr
)
&&
idx
<
0x10000
;
ptr
++
)
idx
=
idx
*
10
+
(
*
ptr
-
'0'
);
if
(
!*
ptr
&&
idx
<
This
->
builtin_info
->
idx_length
(
This
))
{
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
};
s
printfW
(
buf
,
formatW
,
idx
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
idx
);
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
};
s
printfW
(
name
,
formatW
,
idx
);
s
wprintf
(
name
,
ARRAY_SIZE
(
name
)
,
formatW
,
idx
);
hres
=
find_prop_name_prot
(
obj
,
string_hash
(
name
),
name
,
&
prop
);
if
(
FAILED
(
hres
))
...
...
@@ -1520,7 +1519,7 @@ HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
BOOL
b
;
HRESULT
hres
;
s
printfW
(
buf
,
formatW
,
idx
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
idx
);
hres
=
find_prop_name
(
obj
,
string_hash
(
buf
),
buf
,
&
prop
);
if
(
FAILED
(
hres
)
||
!
prop
)
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/engine.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.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
)
{
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
)
...
...
@@ -648,7 +646,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
return
S_OK
;
}
if
(
!
strcmpW
(
identifier
,
argumentsW
))
{
if
(
!
l
strcmpW
(
identifier
,
argumentsW
))
{
hres
=
detach_variable_object
(
ctx
,
scope
->
frame
,
FALSE
);
if
(
FAILED
(
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
)
{
if
((
item
->
flags
&
SCRIPTITEM_ISVISIBLE
)
&&
!
strcmpW
(
item
->
name
,
identifier
))
{
if
((
item
->
flags
&
SCRIPTITEM_ISVISIBLE
)
&&
!
l
strcmpW
(
item
->
name
,
identifier
))
{
if
(
!
item
->
disp
)
{
IUnknown
*
unk
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/error.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.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'
;
LoadStringW
(
jscript_hinstance
,
HRESULT_CODE
(
error
),
buf
,
ARRAY_SIZE
(
buf
));
if
(
str
)
pos
=
strchrW
(
buf
,
'|'
);
if
(
str
)
pos
=
wcschr
(
buf
,
'|'
);
if
(
pos
)
{
int
len
=
strlenW
(
str
);
memmove
(
pos
+
len
,
pos
+
1
,
(
strlenW
(
pos
+
1
)
+
1
)
*
sizeof
(
WCHAR
));
int
len
=
l
strlenW
(
str
);
memmove
(
pos
+
len
,
pos
+
1
,
(
l
strlenW
(
pos
+
1
)
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
pos
,
str
,
len
*
sizeof
(
WCHAR
));
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/function.c
View file @
29ea8b42
...
...
@@ -303,7 +303,7 @@ static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret)
DWORD
name_len
;
WCHAR
*
ptr
;
name_len
=
strlenW
(
function
->
name
);
name_len
=
l
strlenW
(
function
->
name
);
str
=
jsstr_alloc_buf
(
ARRAY_SIZE
(
native_prefixW
)
+
ARRAY_SIZE
(
native_suffixW
)
+
name_len
,
&
ptr
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/global.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <limits.h>
...
...
@@ -312,7 +310,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if
(
FAILED
(
hres
))
return
hres
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
switch
(
*
ptr
)
{
...
...
@@ -380,7 +378,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if
(
FAILED
(
hres
))
return
hres
;
while
(
is
spaceW
(
*
str
))
str
++
;
while
(
is
wspace
(
*
str
))
str
++
;
if
(
*
str
==
'+'
)
str
++
;
...
...
@@ -389,10 +387,10 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
str
++
;
}
if
(
is
digitW
(
*
str
))
if
(
is
wdigit
(
*
str
))
ret_nan
=
FALSE
;
while
(
is
digitW
(
*
str
))
{
while
(
is
wdigit
(
*
str
))
{
hlp
=
d
*
10
+
*
(
str
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
{
exp
++
;
...
...
@@ -401,17 +399,17 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
else
d
=
hlp
;
}
while
(
is
digitW
(
*
str
))
{
while
(
is
wdigit
(
*
str
))
{
exp
++
;
str
++
;
}
if
(
*
str
==
'.'
)
str
++
;
if
(
is
digitW
(
*
str
))
if
(
is
wdigit
(
*
str
))
ret_nan
=
FALSE
;
while
(
is
digitW
(
*
str
))
{
while
(
is
wdigit
(
*
str
))
{
hlp
=
d
*
10
+
*
(
str
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
break
;
...
...
@@ -419,7 +417,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
d
=
hlp
;
exp
--
;
}
while
(
is
digitW
(
*
str
))
while
(
is
wdigit
(
*
str
))
str
++
;
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
++
;
}
while
(
is
digitW
(
*
str
))
{
while
(
is
wdigit
(
*
str
))
{
if
(
e
>
INT_MAX
/
10
||
(
e
=
e
*
10
+
*
str
++
-
'0'
)
<
0
)
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
)
{
if
(
to
upperW
(
wch
)
>=
'A'
&&
toupperW
(
wch
)
<=
'F'
)
return
toupperW
(
wch
)
-
'A'
+
10
;
if
(
is
digitW
(
wch
))
return
wch
-
'0'
;
if
(
to
wupper
(
wch
)
>=
'A'
&&
towupper
(
wch
)
<=
'F'
)
return
towupper
(
wch
)
-
'A'
+
10
;
if
(
is
wdigit
(
wch
))
return
wch
-
'0'
;
return
-
1
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/jscript.h
View file @
29ea8b42
...
...
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#define COBJMACROS
...
...
@@ -30,7 +31,6 @@
#include "resource.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
...
...
@@ -75,7 +75,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
if
(
str
)
{
DWORD
size
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
l
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
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
);
}
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
static
inline
BOOL
is_int32
(
double
d
)
{
return
INT32_MIN
<=
d
&&
d
<=
INT32_MAX
&&
(
double
)(
int
)
d
==
d
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/json.c
View file @
29ea8b42
...
...
@@ -23,7 +23,6 @@
#include "parser.h"
#include "wine/debug.h"
#include "wine/unicode.h"
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
);
}
if
(
*
ctx
->
ptr
==
'0'
&&
ctx
->
ptr
+
1
<
ctx
->
end
&&
is
digitW
(
ctx
->
ptr
[
1
]))
if
(
*
ctx
->
ptr
==
'0'
&&
ctx
->
ptr
+
1
<
ctx
->
end
&&
is
wdigit
(
ctx
->
ptr
[
1
]))
break
;
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
)
{
return
append_string_len
(
ctx
,
str
,
strlenW
(
str
));
return
append_string_len
(
ctx
,
str
,
l
strlenW
(
str
));
}
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
<
' '
)
{
static
const
WCHAR
formatW
[]
=
{
'\\'
,
'u'
,
'%'
,
'0'
,
'4'
,
'x'
,
0
};
WCHAR
buf
[
7
];
s
printfW
(
buf
,
formatW
,
*
ptr
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
*
ptr
);
if
(
!
append_string
(
ctx
,
buf
))
return
E_OUTOFMEMORY
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/jsstr.h
View file @
29ea8b42
...
...
@@ -99,7 +99,7 @@ jsstr_t *jsstr_alloc_buf(unsigned,WCHAR**) DECLSPEC_HIDDEN;
static
inline
jsstr_t
*
jsstr_alloc
(
const
WCHAR
*
str
)
{
return
jsstr_alloc_len
(
str
,
strlenW
(
str
));
return
jsstr_alloc_len
(
str
,
l
strlenW
(
str
));
}
void
jsstr_free
(
jsstr_t
*
)
DECLSPEC_HIDDEN
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/jsutils.c
View file @
29ea8b42
...
...
@@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <assert.h>
...
...
@@ -516,7 +514,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
*
ptr
==
'-'
)
{
...
...
@@ -526,9 +524,9 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
ptr
++
;
}
if
(
!
strncmpW
(
ptr
,
infinityW
,
ARRAY_SIZE
(
infinityW
)))
{
if
(
!
wcsncmp
(
ptr
,
infinityW
,
ARRAY_SIZE
(
infinityW
)))
{
ptr
+=
ARRAY_SIZE
(
infinityW
);
while
(
*
ptr
&&
is
spaceW
(
*
ptr
))
while
(
*
ptr
&&
is
wspace
(
*
ptr
))
ptr
++
;
if
(
*
ptr
)
...
...
@@ -551,7 +549,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
return
S_OK
;
}
while
(
is
digitW
(
*
ptr
))
while
(
is
wdigit
(
*
ptr
))
d
=
d
*
10
+
(
*
ptr
++
-
'0'
);
if
(
*
ptr
==
'e'
||
*
ptr
==
'E'
)
{
...
...
@@ -566,7 +564,7 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
ptr
++
;
}
while
(
is
digitW
(
*
ptr
))
while
(
is
wdigit
(
*
ptr
))
l
=
l
*
10
+
(
*
ptr
++
-
'0'
);
if
(
eneg
)
l
=
-
l
;
...
...
@@ -576,13 +574,13 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
DOUBLE
dec
=
0
.
1
;
ptr
++
;
while
(
is
digitW
(
*
ptr
))
{
while
(
is
wdigit
(
*
ptr
))
{
d
+=
dec
*
(
*
ptr
++
-
'0'
);
dec
*=
0
.
1
;
}
}
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
*
ptr
)
{
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/lex.c
View file @
29ea8b42
...
...
@@ -16,10 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <limits.h>
#include <math.h>
#include "jscript.h"
#include "activscp.h"
...
...
@@ -30,7 +29,6 @@
#include "parser.tab.h"
#include "wine/debug.h"
#include "wine/unicode.h"
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 */
BOOL
is_identifier_char
(
WCHAR
c
)
{
return
is
alnumW
(
c
)
||
c
==
'$'
||
c
==
'_'
||
c
==
'\\'
;
return
is
walnum
(
c
)
||
c
==
'$'
||
c
==
'_'
||
c
==
'\\'
;
}
static
BOOL
is_identifier_first_char
(
WCHAR
c
)
{
return
is
alphaW
(
c
)
||
c
==
'$'
||
c
==
'_'
||
c
==
'\\'
;
return
is
walpha
(
c
)
||
c
==
'$'
||
c
==
'_'
||
c
==
'\\'
;
}
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
)
{
TRACE
(
"ignoring keyword %s in incompatible mode
\n
"
,
debugstr_w
(
keywords
[
i
].
word
));
ctx
->
ptr
-=
strlenW
(
keywords
[
i
].
word
);
ctx
->
ptr
-=
l
strlenW
(
keywords
[
i
].
word
);
return
0
;
}
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
)
{
while
(
ctx
->
ptr
<
ctx
->
end
&&
(
is
spaceW
(
*
ctx
->
ptr
)
||
*
ctx
->
ptr
==
0xFEFF
/* UTF16 BOM */
))
{
while
(
ctx
->
ptr
<
ctx
->
end
&&
(
is
wspace
(
*
ctx
->
ptr
)
||
*
ctx
->
ptr
==
0xFEFF
/* UTF16 BOM */
))
{
if
(
is_endline
(
*
ctx
->
ptr
++
))
ctx
->
nl
=
TRUE
;
}
...
...
@@ -333,11 +331,11 @@ BOOL unescape(WCHAR *str, size_t *len)
c
+=
i
;
break
;
default:
if
(
is
digitW
(
*
p
))
{
if
(
is
wdigit
(
*
p
))
{
c
=
*
p
++
-
'0'
;
if
(
p
<
end
&&
is
digitW
(
*
p
))
{
if
(
p
<
end
&&
is
wdigit
(
*
p
))
{
c
=
c
*
8
+
(
*
p
++
-
'0'
);
if
(
p
<
end
&&
is
digitW
(
*
p
))
if
(
p
<
end
&&
is
wdigit
(
*
p
))
c
=
c
*
8
+
(
*
p
++
-
'0'
);
}
p
--
;
...
...
@@ -436,7 +434,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
LONGLONG
d
=
0
,
hlp
;
int
exp
=
0
;
while
(
ptr
<
end
&&
is
digitW
(
*
ptr
))
{
while
(
ptr
<
end
&&
is
wdigit
(
*
ptr
))
{
hlp
=
d
*
10
+
*
(
ptr
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
{
exp
++
;
...
...
@@ -445,7 +443,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
else
d
=
hlp
;
}
while
(
ptr
<
end
&&
is
digitW
(
*
ptr
))
{
while
(
ptr
<
end
&&
is
wdigit
(
*
ptr
))
{
exp
++
;
ptr
++
;
}
...
...
@@ -453,7 +451,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
if
(
*
ptr
==
'.'
)
{
ptr
++
;
while
(
ptr
<
end
&&
is
digitW
(
*
ptr
))
{
while
(
ptr
<
end
&&
is
wdigit
(
*
ptr
))
{
hlp
=
d
*
10
+
*
(
ptr
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
break
;
...
...
@@ -461,7 +459,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
d
=
hlp
;
exp
--
;
}
while
(
ptr
<
end
&&
is
digitW
(
*
ptr
))
while
(
ptr
<
end
&&
is
wdigit
(
*
ptr
))
ptr
++
;
}
...
...
@@ -474,7 +472,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
}
else
if
(
*
ptr
==
'-'
)
{
sign
=
-
1
;
ptr
++
;
}
else
if
(
!
is
digitW
(
*
ptr
))
{
}
else
if
(
!
is
wdigit
(
*
ptr
))
{
WARN
(
"Expected exponent part
\n
"
);
return
E_FAIL
;
}
...
...
@@ -485,7 +483,7 @@ HRESULT parse_decimal(const WCHAR **iter, const WCHAR *end, double *ret)
return
E_FAIL
;
}
while
(
ptr
<
end
&&
is
digitW
(
*
ptr
))
{
while
(
ptr
<
end
&&
is
wdigit
(
*
ptr
))
{
if
(
e
>
INT_MAX
/
10
||
(
e
=
e
*
10
+
*
ptr
++
-
'0'
)
<
0
)
e
=
INT_MAX
;
}
...
...
@@ -536,12 +534,12 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
return
TRUE
;
}
if
(
is
digitW
(
*
ctx
->
ptr
))
{
if
(
is
wdigit
(
*
ctx
->
ptr
))
{
unsigned
base
=
8
;
const
WCHAR
*
ptr
;
double
val
=
0
;
for
(
ptr
=
ctx
->
ptr
;
ptr
<
ctx
->
end
&&
is
digitW
(
*
ptr
);
ptr
++
)
{
for
(
ptr
=
ctx
->
ptr
;
ptr
<
ctx
->
end
&&
is
wdigit
(
*
ptr
);
ptr
++
)
{
if
(
*
ptr
>
'7'
)
{
base
=
10
;
break
;
...
...
@@ -550,7 +548,7 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret)
do
{
val
=
val
*
base
+
*
ctx
->
ptr
-
'0'
;
}
while
(
++
ctx
->
ptr
<
ctx
->
end
&&
is
digitW
(
*
ctx
->
ptr
));
}
while
(
++
ctx
->
ptr
<
ctx
->
end
&&
is
wdigit
(
*
ctx
->
ptr
));
/* FIXME: Do we need it here? */
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
;
}
if
(
is
alphaW
(
*
ctx
->
ptr
))
{
if
(
is
walpha
(
*
ctx
->
ptr
))
{
int
ret
=
check_keywords
(
ctx
,
lval
);
if
(
ret
)
return
ret
;
...
...
@@ -600,7 +598,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return
parse_identifier
(
ctx
,
lval
);
}
if
(
is
digitW
(
*
ctx
->
ptr
))
{
if
(
is
wdigit
(
*
ctx
->
ptr
))
{
double
n
;
if
(
!
parse_numeric_literal
(
ctx
,
&
n
))
...
...
@@ -627,7 +625,7 @@ static int next_token(parser_ctx_t *ctx, void *lval)
return
'}'
;
case
'.'
:
if
(
ctx
->
ptr
+
1
<
ctx
->
end
&&
is
digitW
(
ctx
->
ptr
[
1
]))
{
if
(
ctx
->
ptr
+
1
<
ctx
->
end
&&
is
wdigit
(
ctx
->
ptr
[
1
]))
{
double
n
;
HRESULT
hres
;
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
;
if
(
len
==
-
1
)
len
=
strlenW
(
name
);
len
=
l
strlenW
(
name
);
new_v
=
heap_alloc
(
sizeof
(
cc_var_t
)
+
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
new_v
)
...
...
@@ -953,7 +951,7 @@ int try_parse_ccval(parser_ctx_t *ctx, ccval_t *r)
if
(
!
skip_spaces
(
ctx
))
return
-
1
;
if
(
is
digitW
(
*
ctx
->
ptr
))
{
if
(
is
wdigit
(
*
ctx
->
ptr
))
{
double
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
;
while
(
1
)
{
ptr
=
strchrW
(
ctx
->
ptr
,
'@'
);
ptr
=
wcschr
(
ctx
->
ptr
,
'@'
);
if
(
!
ptr
)
{
WARN
(
"No @end
\n
"
);
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
;
flags_ptr
=
++
ctx
->
ptr
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
is
alnumW
(
*
ctx
->
ptr
))
while
(
ctx
->
ptr
<
ctx
->
end
&&
is
walnum
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
hres
=
parse_regexp_flags
(
flags_ptr
,
ctx
->
ptr
-
flags_ptr
,
&
flags
);
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/math.c
View file @
29ea8b42
...
...
@@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include <limits.h>
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/number.c
View file @
29ea8b42
...
...
@@ -332,7 +332,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
ch
=
'-'
;
}
else
ch
=
'+'
;
s
printfW
(
&
buf
[
idx
]
,
formatW
,
ch
,
(
int
)
log_radix
);
s
wprintf
(
&
buf
[
idx
],
ARRAY_SIZE
(
buf
)
-
idx
,
formatW
,
ch
,
(
int
)
log_radix
);
}
}
else
buf
[
idx
]
=
'\0'
;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/object.c
View file @
29ea8b42
...
...
@@ -89,11 +89,11 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
jsstr_t
*
ret
;
WCHAR
*
ptr
;
ret
=
jsstr_alloc_buf
(
9
+
strlenW
(
str
),
&
ptr
);
ret
=
jsstr_alloc_buf
(
9
+
l
strlenW
(
str
),
&
ptr
);
if
(
!
ret
)
return
E_OUTOFMEMORY
;
s
printfW
(
ptr
,
formatW
,
str
);
s
wprintf
(
ptr
,
9
+
lstrlenW
(
str
)
,
formatW
,
str
);
*
r
=
jsval_string
(
ret
);
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/parser.y
View file @
29ea8b42
...
...
@@ -813,7 +813,7 @@ GetterSetterMethod
/* Ecma-262 3rd Edition 11.1.5 */
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,
l
strlenW($1))); }
| tStringLiteral { $$ = new_string_literal(ctx, $1); }
| tNumericLiteral { $$ = $1; }
...
...
@@ -1580,10 +1580,10 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, const
return E_OUTOFMEMORY;
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->end = parser_ctx->begin + strlenW(parser_ctx->begin);
parser_ctx->end = parser_ctx->begin +
l
strlenW(parser_ctx->begin);
script_addref(ctx);
parser_ctx->script = ctx;
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/regexp.c
View file @
29ea8b42
...
...
@@ -1142,8 +1142,8 @@ lexHex:
for
(
i
=
rangeStart
;
i
<=
localMax
;
i
++
)
{
WCHAR
uch
,
dch
;
uch
=
to
upperW
(
i
);
dch
=
to
lowerW
(
i
);
uch
=
to
wupper
(
i
);
dch
=
to
wlower
(
i
);
if
(
maxch
<
uch
)
maxch
=
uch
;
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
))
return
NULL
;
for
(
i
=
0
;
i
!=
length
;
i
++
)
{
if
(
to
upperW
(
matchChars
[
i
])
!=
toupperW
(
x
->
cp
[
i
]))
if
(
to
wupper
(
matchChars
[
i
])
!=
towupper
(
x
->
cp
[
i
]))
return
NULL
;
}
x
->
cp
+=
length
;
...
...
@@ -2035,7 +2035,7 @@ BackrefMatcher(REGlobalData *gData, match_state_t *x, size_t parenIndex)
parenContent
=
&
gData
->
cpbegin
[
cap
->
index
];
if
(
gData
->
regexp
->
flags
&
REG_FOLD
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
to
upperW
(
parenContent
[
i
])
!=
toupperW
(
x
->
cp
[
i
]))
if
(
to
wupper
(
parenContent
[
i
])
!=
towupper
(
x
->
cp
[
i
]))
return
NULL
;
}
}
else
{
...
...
@@ -2226,12 +2226,12 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
continue
;
case
's'
:
for
(
i
=
(
INT
)
charSet
->
length
;
i
>=
0
;
i
--
)
if
(
is
spaceW
(
i
))
if
(
is
wspace
(
i
))
AddCharacterToCharSet
(
charSet
,
(
WCHAR
)
i
);
continue
;
case
'S'
:
for
(
i
=
(
INT
)
charSet
->
length
;
i
>=
0
;
i
--
)
if
(
!
is
spaceW
(
i
))
if
(
!
is
wspace
(
i
))
AddCharacterToCharSet
(
charSet
,
(
WCHAR
)
i
);
continue
;
case
'w'
:
...
...
@@ -2263,8 +2263,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
WCHAR
uch
,
dch
;
AddCharacterToCharSet
(
charSet
,
i
);
uch
=
to
upperW
(
i
);
dch
=
to
lowerW
(
i
);
uch
=
to
wupper
(
i
);
dch
=
to
wlower
(
i
);
if
(
i
!=
uch
)
AddCharacterToCharSet
(
charSet
,
uch
);
if
(
i
!=
dch
)
...
...
@@ -2276,8 +2276,8 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
inRange
=
FALSE
;
}
else
{
if
(
gData
->
regexp
->
flags
&
REG_FOLD
)
{
AddCharacterToCharSet
(
charSet
,
to
upperW
(
thisCh
));
AddCharacterToCharSet
(
charSet
,
to
lowerW
(
thisCh
));
AddCharacterToCharSet
(
charSet
,
to
wupper
(
thisCh
));
AddCharacterToCharSet
(
charSet
,
to
wlower
(
thisCh
));
}
else
{
AddCharacterToCharSet
(
charSet
,
thisCh
);
}
...
...
@@ -2411,13 +2411,13 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
}
break
;
case
REOP_SPACE
:
if
(
x
->
cp
!=
gData
->
cpend
&&
is
spaceW
(
*
x
->
cp
))
{
if
(
x
->
cp
!=
gData
->
cpend
&&
is
wspace
(
*
x
->
cp
))
{
result
=
x
;
result
->
cp
++
;
}
break
;
case
REOP_NONSPACE
:
if
(
x
->
cp
!=
gData
->
cpend
&&
!
is
spaceW
(
*
x
->
cp
))
{
if
(
x
->
cp
!=
gData
->
cpend
&&
!
is
wspace
(
*
x
->
cp
))
{
result
=
x
;
result
->
cp
++
;
}
...
...
@@ -2463,7 +2463,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
break
;
case
REOP_FLAT1i
:
matchCh
=
*
pc
++
;
if
(
x
->
cp
!=
gData
->
cpend
&&
to
upperW
(
*
x
->
cp
)
==
toupperW
(
matchCh
))
{
if
(
x
->
cp
!=
gData
->
cpend
&&
to
wupper
(
*
x
->
cp
)
==
towupper
(
matchCh
))
{
result
=
x
;
result
->
cp
++
;
}
...
...
@@ -2480,7 +2480,7 @@ SimpleMatch(REGlobalData *gData, match_state_t *x, REOp op,
case
REOP_UCFLAT1i
:
matchCh
=
GET_ARG
(
pc
);
pc
+=
ARG_LEN
;
if
(
x
->
cp
!=
gData
->
cpend
&&
to
upperW
(
*
x
->
cp
)
==
toupperW
(
matchCh
))
{
if
(
x
->
cp
!=
gData
->
cpend
&&
to
wupper
(
*
x
->
cp
)
==
towupper
(
matchCh
))
{
result
=
x
;
result
->
cp
++
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/string.c
View file @
29ea8b42
...
...
@@ -16,8 +16,8 @@
* 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 "regexp.h"
...
...
@@ -168,7 +168,7 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, j
return
S_OK
;
}
tagname_len
=
strlenW
(
tagname
);
tagname_len
=
l
strlenW
(
tagname
);
ret
=
jsstr_alloc_buf
(
jsstr_length
(
str
)
+
2
*
tagname_len
+
5
,
&
ptr
);
if
(
!
ret
)
{
...
...
@@ -215,8 +215,8 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
if
(
r
)
{
unsigned
attrname_len
=
strlenW
(
attrname
);
unsigned
tagname_len
=
strlenW
(
tagname
);
unsigned
attrname_len
=
l
strlenW
(
attrname
);
unsigned
tagname_len
=
l
strlenW
(
tagname
);
jsstr_t
*
ret
;
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
=
strstrW
(
match
->
cp
,
match_str
);
match
->
cp
=
wcsstr
(
match
->
cp
,
match_str
);
if
(
!
match
->
cp
)
break
;
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
)
{
const
WCHAR
*
ptr
=
rep_str
,
*
ptr2
;
while
((
ptr2
=
strchrW
(
ptr
,
'$'
)))
{
while
((
ptr2
=
wcschr
(
ptr
,
'$'
)))
{
hres
=
strbuf_append
(
&
ret
,
ptr
,
ptr2
-
ptr
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -904,14 +904,14 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
default:
{
DWORD
idx
;
if
(
!
is
digitW
(
ptr2
[
1
]))
{
if
(
!
is
wdigit
(
ptr2
[
1
]))
{
hres
=
strbuf_append
(
&
ret
,
ptr2
,
1
);
ptr
=
ptr2
+
1
;
break
;
}
idx
=
ptr2
[
1
]
-
'0'
;
if
(
is
digitW
(
ptr2
[
2
])
&&
idx
*
10
+
(
ptr2
[
2
]
-
'0'
)
<=
match
->
paren_count
)
{
if
(
is
wdigit
(
ptr2
[
2
])
&&
idx
*
10
+
(
ptr2
[
2
]
-
'0'
)
<=
match
->
paren_count
)
{
idx
=
idx
*
10
+
(
ptr
[
2
]
-
'0'
);
ptr
=
ptr2
+
3
;
}
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
;
}
else
if
(
match_str
)
{
ptr2
=
strstrW
(
ptr
,
match_str
);
ptr2
=
wcsstr
(
ptr
,
match_str
);
if
(
!
ptr2
)
break
;
}
else
{
...
...
@@ -1446,7 +1446,7 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
}
jsstr_flush
(
str
,
buf
);
for
(;
len
--
;
buf
++
)
*
buf
=
to
lowerW
(
*
buf
);
for
(;
len
--
;
buf
++
)
*
buf
=
to
wlower
(
*
buf
);
*
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
);
for
(;
len
--
;
buf
++
)
*
buf
=
to
upperW
(
*
buf
);
for
(;
len
--
;
buf
++
)
*
buf
=
to
wupper
(
*
buf
);
*
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
);
TRACE
(
"%s
\n
"
,
debugstr_wn
(
str
,
len
));
for
(
begin
=
str
,
end
=
str
+
len
;
begin
<
end
&&
is
spaceW
(
*
begin
);
begin
++
);
while
(
end
>
begin
+
1
&&
is
spaceW
(
*
(
end
-
1
)))
end
--
;
for
(
begin
=
str
,
end
=
str
+
len
;
begin
<
end
&&
is
wspace
(
*
begin
);
begin
++
);
while
(
end
>
begin
+
1
&&
is
wspace
(
*
(
end
-
1
)))
end
--
;
if
(
r
)
{
jsstr_t
*
ret
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment