Skip to content

Commit b274dce

Browse files
[JSCRIPT] fix build
1 parent f2bef80 commit b274dce

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

dll/win32/jscript/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11

2-
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS -D_WIN32_WINNT=0x502)
2+
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
33
add_definitions(
44
-D__WINESRC__
55
-D__ROS_LONG64__
6-
-D_USE_MATH_DEFINES
7-
-D_WIN32_WINNT=0x600)
6+
-D_USE_MATH_DEFINES)
87

98
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
109
spec2def(jscript.dll jscript.spec)

dll/win32/jscript/jsutils.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,38 @@ HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, UINT32 *ret)
724724
return S_OK;
725725
}
726726

727+
#ifdef __REACTOS__
728+
static jsstr_t *int_to_string(int i)
729+
{
730+
WCHAR buf[12], *p;
731+
BOOL neg = FALSE;
732+
733+
if(!i) {
734+
static const WCHAR zeroW[] = {'0',0};
735+
return jsstr_alloc(zeroW);
736+
}
737+
738+
if(i < 0) {
739+
neg = TRUE;
740+
i = -i;
741+
}
742+
743+
p = buf + ARRAY_SIZE(buf)-1;
744+
*p-- = 0;
745+
while(i) {
746+
*p-- = i%10 + '0';
747+
i /= 10;
748+
}
749+
750+
if(neg)
751+
*p = '-';
752+
else
753+
p++;
754+
755+
return jsstr_alloc(p);
756+
}
757+
#endif
758+
727759
HRESULT double_to_string(double n, jsstr_t **str)
728760
{
729761
if(isnan(n)) {
@@ -732,7 +764,11 @@ HRESULT double_to_string(double n, jsstr_t **str)
732764
*str = jsstr_alloc(n<0 ? L"-Infinity" : L"Infinity");
733765
}else if(is_int32(n)) {
734766
WCHAR buf[12];
767+
#ifdef __REACTOS__
768+
*str = int_to_string(n);
769+
#else
735770
_ltow_s(n, buf, ARRAY_SIZE(buf), 10);
771+
#endif
736772
*str = jsstr_alloc(buf);
737773
}else {
738774
VARIANT strv, v;

0 commit comments

Comments
 (0)