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
7bb9e5a1
Commit
7bb9e5a1
authored
Jun 04, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use wide string literals in array.c.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
102fe73e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
51 deletions
+26
-51
array.c
dlls/jscript/array.c
+26
-51
No files found.
dlls/jscript/array.c
View file @
7bb9e5a1
...
@@ -32,25 +32,6 @@ typedef struct {
...
@@ -32,25 +32,6 @@ typedef struct {
DWORD
length
;
DWORD
length
;
}
ArrayInstance
;
}
ArrayInstance
;
static
const
WCHAR
lengthW
[]
=
{
'l'
,
'e'
,
'n'
,
'g'
,
't'
,
'h'
,
0
};
static
const
WCHAR
concatW
[]
=
{
'c'
,
'o'
,
'n'
,
'c'
,
'a'
,
't'
,
0
};
static
const
WCHAR
forEachW
[]
=
{
'f'
,
'o'
,
'r'
,
'E'
,
'a'
,
'c'
,
'h'
,
0
};
static
const
WCHAR
joinW
[]
=
{
'j'
,
'o'
,
'i'
,
'n'
,
0
};
static
const
WCHAR
popW
[]
=
{
'p'
,
'o'
,
'p'
,
0
};
static
const
WCHAR
pushW
[]
=
{
'p'
,
'u'
,
's'
,
'h'
,
0
};
static
const
WCHAR
reverseW
[]
=
{
'r'
,
'e'
,
'v'
,
'e'
,
'r'
,
's'
,
'e'
,
0
};
static
const
WCHAR
shiftW
[]
=
{
's'
,
'h'
,
'i'
,
'f'
,
't'
,
0
};
static
const
WCHAR
sliceW
[]
=
{
's'
,
'l'
,
'i'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
sortW
[]
=
{
's'
,
'o'
,
'r'
,
't'
,
0
};
static
const
WCHAR
spliceW
[]
=
{
's'
,
'p'
,
'l'
,
'i'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
toStringW
[]
=
{
't'
,
'o'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toLocaleStringW
[]
=
{
't'
,
'o'
,
'L'
,
'o'
,
'c'
,
'a'
,
'l'
,
'e'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
unshiftW
[]
=
{
'u'
,
'n'
,
's'
,
'h'
,
'i'
,
'f'
,
't'
,
0
};
static
const
WCHAR
indexOfW
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
'O'
,
'f'
,
0
};
static
const
WCHAR
mapW
[]
=
{
'm'
,
'a'
,
'p'
,
0
};
static
const
WCHAR
default_separatorW
[]
=
{
','
,
0
};
static
inline
ArrayInstance
*
array_from_jsdisp
(
jsdisp_t
*
jsdisp
)
static
inline
ArrayInstance
*
array_from_jsdisp
(
jsdisp_t
*
jsdisp
)
{
{
return
CONTAINING_RECORD
(
jsdisp
,
ArrayInstance
,
dispex
);
return
CONTAINING_RECORD
(
jsdisp
,
ArrayInstance
,
dispex
);
...
@@ -88,7 +69,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis,
...
@@ -88,7 +69,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis,
if
(
!
is_jsdisp
(
vdisp
))
if
(
!
is_jsdisp
(
vdisp
))
return
JS_E_JSCRIPT_EXPECTED
;
return
JS_E_JSCRIPT_EXPECTED
;
hres
=
jsdisp_propget_name
(
vdisp
->
u
.
jsdisp
,
lengthW
,
&
val
);
hres
=
jsdisp_propget_name
(
vdisp
->
u
.
jsdisp
,
L"length"
,
&
val
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -108,7 +89,7 @@ static HRESULT set_length(jsdisp_t *obj, DWORD length)
...
@@ -108,7 +89,7 @@ static HRESULT set_length(jsdisp_t *obj, DWORD length)
return
S_OK
;
return
S_OK
;
}
}
return
jsdisp_propput_name
(
obj
,
lengthW
,
jsval_number
(
length
));
return
jsdisp_propput_name
(
obj
,
L"length"
,
jsval_number
(
length
));
}
}
static
WCHAR
*
idx_to_str
(
DWORD
idx
,
WCHAR
*
ptr
)
static
WCHAR
*
idx_to_str
(
DWORD
idx
,
WCHAR
*
ptr
)
...
@@ -354,7 +335,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
...
@@ -354,7 +335,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
,
lstrlenW
(
default_separatorW
)
,
r
);
hres
=
array_join
(
ctx
,
jsthis
,
length
,
L","
,
1
,
r
);
}
}
return
hres
;
return
hres
;
...
@@ -878,7 +859,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
...
@@ -878,7 +859,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
}
}
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
ret_array
,
lengthW
,
jsval_number
(
delete_cnt
));
hres
=
jsdisp_propput_name
(
ret_array
,
L"length"
,
jsval_number
(
delete_cnt
));
}
}
if
(
add_args
<
delete_cnt
)
{
if
(
add_args
<
delete_cnt
)
{
...
@@ -910,7 +891,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
...
@@ -910,7 +891,7 @@ static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
hres
=
jsdisp_propput_idx
(
jsthis
,
start
+
i
,
argv
[
i
+
2
]);
hres
=
jsdisp_propput_idx
(
jsthis
,
start
+
i
,
argv
[
i
+
2
]);
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_propput_name
(
jsthis
,
lengthW
,
jsval_number
(
length
-
delete_cnt
+
add_args
));
hres
=
jsdisp_propput_name
(
jsthis
,
L"length"
,
jsval_number
(
length
-
delete_cnt
+
add_args
));
if
(
FAILED
(
hres
))
{
if
(
FAILED
(
hres
))
{
if
(
ret_array
)
if
(
ret_array
)
...
@@ -935,8 +916,7 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
...
@@ -935,8 +916,7 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
if
(
!
array
)
if
(
!
array
)
return
JS_E_ARRAY_EXPECTED
;
return
JS_E_ARRAY_EXPECTED
;
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
default_separatorW
,
return
array_join
(
ctx
,
&
array
->
dispex
,
array
->
length
,
L","
,
1
,
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
,
...
@@ -1180,8 +1160,7 @@ static HRESULT Array_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
...
@@ -1180,8 +1160,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
,
L","
,
1
,
r
);
lstrlenW
(
default_separatorW
),
r
);
}
}
static
void
Array_destructor
(
jsdisp_t
*
dispex
)
static
void
Array_destructor
(
jsdisp_t
*
dispex
)
...
@@ -1211,22 +1190,22 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
...
@@ -1211,22 +1190,22 @@ static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
}
}
static
const
builtin_prop_t
Array_props
[]
=
{
static
const
builtin_prop_t
Array_props
[]
=
{
{
concatW
,
Array_concat
,
PROPF_METHOD
|
1
},
{
L"concat"
,
Array_concat
,
PROPF_METHOD
|
1
},
{
forEachW
,
Array_forEach
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
L"forEach"
,
Array_forEach
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
indexOfW
,
Array_indexOf
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
L"indexOf"
,
Array_indexOf
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
joinW
,
Array_join
,
PROPF_METHOD
|
1
},
{
L"join"
,
Array_join
,
PROPF_METHOD
|
1
},
{
lengthW
,
NULL
,
0
,
Array_get_length
,
Array_set_length
},
{
L"length"
,
NULL
,
0
,
Array_get_length
,
Array_set_length
},
{
mapW
,
Array_map
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
L"map"
,
Array_map
,
PROPF_METHOD
|
PROPF_ES5
|
1
},
{
popW
,
Array_pop
,
PROPF_METHOD
},
{
L"pop"
,
Array_pop
,
PROPF_METHOD
},
{
pushW
,
Array_push
,
PROPF_METHOD
|
1
},
{
L"push"
,
Array_push
,
PROPF_METHOD
|
1
},
{
reverseW
,
Array_reverse
,
PROPF_METHOD
},
{
L"reverse"
,
Array_reverse
,
PROPF_METHOD
},
{
shiftW
,
Array_shift
,
PROPF_METHOD
},
{
L"shift"
,
Array_shift
,
PROPF_METHOD
},
{
sliceW
,
Array_slice
,
PROPF_METHOD
|
2
},
{
L"slice"
,
Array_slice
,
PROPF_METHOD
|
2
},
{
sortW
,
Array_sort
,
PROPF_METHOD
|
1
},
{
L"sort"
,
Array_sort
,
PROPF_METHOD
|
1
},
{
spliceW
,
Array_splice
,
PROPF_METHOD
|
2
},
{
L"splice"
,
Array_splice
,
PROPF_METHOD
|
2
},
{
toLocaleStringW
,
Array_toLocaleString
,
PROPF_METHOD
},
{
L"toLocaleString"
,
Array_toLocaleString
,
PROPF_METHOD
},
{
toStringW
,
Array_toString
,
PROPF_METHOD
},
{
L"toString"
,
Array_toString
,
PROPF_METHOD
},
{
unshiftW
,
Array_unshift
,
PROPF_METHOD
|
1
},
{
L"unshift"
,
Array_unshift
,
PROPF_METHOD
|
1
},
};
};
static
const
builtin_info_t
Array_info
=
{
static
const
builtin_info_t
Array_info
=
{
...
@@ -1239,7 +1218,7 @@ static const builtin_info_t Array_info = {
...
@@ -1239,7 +1218,7 @@ static const builtin_info_t Array_info = {
};
};
static
const
builtin_prop_t
ArrayInst_props
[]
=
{
static
const
builtin_prop_t
ArrayInst_props
[]
=
{
{
lengthW
,
NULL
,
0
,
Array_get_length
,
Array_set_length
}
{
L"length"
,
NULL
,
0
,
Array_get_length
,
Array_set_length
}
};
};
static
const
builtin_info_t
ArrayInst_info
=
{
static
const
builtin_info_t
ArrayInst_info
=
{
...
@@ -1343,10 +1322,8 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
...
@@ -1343,10 +1322,8 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
return
S_OK
;
return
S_OK
;
}
}
static
const
WCHAR
isArrayW
[]
=
{
'i'
,
's'
,
'A'
,
'r'
,
'r'
,
'a'
,
'y'
,
0
};
static
const
builtin_prop_t
ArrayConstr_props
[]
=
{
static
const
builtin_prop_t
ArrayConstr_props
[]
=
{
{
isArrayW
,
ArrayConstr_isArray
,
PROPF_ES5
|
PROPF_METHOD
|
1
}
{
L"isArray"
,
ArrayConstr_isArray
,
PROPF_ES5
|
PROPF_METHOD
|
1
}
};
};
static
const
builtin_info_t
ArrayConstr_info
=
{
static
const
builtin_info_t
ArrayConstr_info
=
{
...
@@ -1363,13 +1340,11 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
...
@@ -1363,13 +1340,11 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
ArrayInstance
*
array
;
ArrayInstance
*
array
;
HRESULT
hres
;
HRESULT
hres
;
static
const
WCHAR
ArrayW
[]
=
{
'A'
,
'r'
,
'r'
,
'a'
,
'y'
,
0
};
hres
=
alloc_array
(
ctx
,
object_prototype
,
&
array
);
hres
=
alloc_array
(
ctx
,
object_prototype
,
&
array
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
hres
=
create_builtin_constructor
(
ctx
,
ArrayConstr_value
,
ArrayW
,
&
ArrayConstr_info
,
PROPF_CONSTR
|
1
,
&
array
->
dispex
,
ret
);
hres
=
create_builtin_constructor
(
ctx
,
ArrayConstr_value
,
L"Array"
,
&
ArrayConstr_info
,
PROPF_CONSTR
|
1
,
&
array
->
dispex
,
ret
);
jsdisp_release
(
&
array
->
dispex
);
jsdisp_release
(
&
array
->
dispex
);
return
hres
;
return
hres
;
...
...
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