Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
4d1fb057
Commit
4d1fb057
authored
Oct 11, 2011
by
deuce
Browse files
Add a length parameter to the JS*_TO_STRING macros.
parent
264d8eeb
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
286 additions
and
277 deletions
+286
-277
src/sbbs3/ftpsrvr.c
src/sbbs3/ftpsrvr.c
+1
-1
src/sbbs3/js_bbs.cpp
src/sbbs3/js_bbs.cpp
+38
-38
src/sbbs3/js_com.c
src/sbbs3/js_com.c
+4
-4
src/sbbs3/js_conio.c
src/sbbs3/js_conio.c
+6
-6
src/sbbs3/js_console.cpp
src/sbbs3/js_console.cpp
+24
-24
src/sbbs3/js_file.c
src/sbbs3/js_file.c
+24
-24
src/sbbs3/js_global.c
src/sbbs3/js_global.c
+59
-59
src/sbbs3/js_internal.c
src/sbbs3/js_internal.c
+4
-4
src/sbbs3/js_msgbase.c
src/sbbs3/js_msgbase.c
+41
-41
src/sbbs3/js_queue.c
src/sbbs3/js_queue.c
+12
-6
src/sbbs3/js_server.c
src/sbbs3/js_server.c
+1
-1
src/sbbs3/js_socket.c
src/sbbs3/js_socket.c
+11
-11
src/sbbs3/js_sprintf.c
src/sbbs3/js_sprintf.c
+2
-2
src/sbbs3/js_system.c
src/sbbs3/js_system.c
+21
-21
src/sbbs3/js_uifc.c
src/sbbs3/js_uifc.c
+3
-3
src/sbbs3/js_user.c
src/sbbs3/js_user.c
+6
-6
src/sbbs3/jsexec.c
src/sbbs3/jsexec.c
+10
-10
src/sbbs3/mailsrvr.c
src/sbbs3/mailsrvr.c
+1
-1
src/sbbs3/main.cpp
src/sbbs3/main.cpp
+8
-8
src/sbbs3/sbbs.h
src/sbbs3/sbbs.h
+10
-7
No files found.
src/sbbs3/ftpsrvr.c
View file @
4d1fb057
...
...
@@ -395,7 +395,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
str
=
JS_ValueToString
(
cx
,
argv
[
i
]);
if
(
!
str
)
return
JS_FALSE
;
JSSTRING_TO_STRING(cx, str, p);
JSSTRING_TO_STRING
(
cx
,
str
,
p
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
fprintf
(
fp
,
"%s"
,
p
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
src/sbbs3/js_bbs.cpp
View file @
4d1fb057
...
...
@@ -652,7 +652,7 @@ static JSBool js_bbs_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, j
else
if
(
JSVAL_IS_STRING
(
*
vp
))
{
if
((
js_str
=
JS_ValueToString
(
cx
,
*
vp
))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
}
switch
(
tiny
)
{
...
...
@@ -924,7 +924,7 @@ static uint get_subnum(JSContext* cx, sbbs_t* sbbs, jsval val)
if
(
JSVAL_IS_STRING
(
val
))
{
char
*
p
;
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
val
),
p
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
val
),
p
,
NULL
);
for
(
subnum
=
0
;
subnum
<
sbbs
->
cfg
.
total_subs
;
subnum
++
)
if
(
!
stricmp
(
sbbs
->
cfg
.
sub
[
subnum
]
->
code
,
p
))
break
;
...
...
@@ -942,7 +942,7 @@ static uint get_dirnum(JSContext* cx, sbbs_t* sbbs, jsval val)
if
(
JSVAL_IS_STRING
(
val
))
{
char
*
p
;
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
val
),
p
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
val
),
p
,
NULL
);
for
(
dirnum
=
0
;
dirnum
<
sbbs
->
cfg
.
total_dirs
;
dirnum
++
)
if
(
!
stricmp
(
sbbs
->
cfg
.
dir
[
dirnum
]
->
code
,
p
))
break
;
...
...
@@ -976,7 +976,7 @@ js_menu(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JSSTRING_TO_STRING
(
cx
,
str
,
menu
);
JSSTRING_TO_STRING
(
cx
,
str
,
menu
,
NULL
);
sbbs
->
menu
(
menu
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1056,9 +1056,9 @@ js_exec(JSContext *cx, uintN argc, jsval *arglist)
}
if
(
startup_dir
!=
NULL
)
JSSTRING_TO_STRING
(
cx
,
startup_dir
,
p_startup_dir
);
JSSTRING_TO_STRING
(
cx
,
startup_dir
,
p_startup_dir
,
NULL
);
JSSTRING_TO_STRING
(
cx
,
cmd
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
cmd
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
sbbs
->
external
(
cstr
,
mode
,
p_startup_dir
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1083,7 +1083,7 @@ js_exec_xtrn(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
if
(
JSVAL_IS_STRING
(
argv
[
0
]))
{
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
code
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
code
,
NULL
);
if
(
code
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -1161,7 +1161,7 @@ js_chkpass(JSContext *cx, uintN argc, jsval *arglist)
JSString
*
str
=
JS_ValueToString
(
cx
,
argv
[
0
]);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
chkpass
(
cstr
,
&
sbbs
->
useron
,
true
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1224,7 +1224,7 @@ js_replace_text(JSContext *cx, uintN argc, jsval *arglist)
if
(
sbbs
->
text
[
i
]
!=
sbbs
->
text_sav
[
i
]
&&
sbbs
->
text
[
i
]
!=
nulstr
)
free
(
sbbs
->
text
[
i
]);
JSVALUE_TO_STRING
(
cx
,
argv
[
1
],
p
);
JSVALUE_TO_STRING
(
cx
,
argv
[
1
],
p
,
NULL
);
if
(
p
==
NULL
)
return
(
JS_TRUE
);
...
...
@@ -1301,7 +1301,7 @@ js_load_text(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
for
(
i
=
0
;
i
<
TOTAL_TEXT
;
i
++
)
{
...
...
@@ -1363,7 +1363,7 @@ js_atcode(JSContext *cx, uintN argc, jsval *arglist)
if
((
sbbs
=
(
sbbs_t
*
)
JS_GetContextPrivate
(
cx
))
==
NULL
)
return
(
JS_FALSE
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
instr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
instr
,
NULL
);
if
(
instr
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -1428,7 +1428,7 @@ js_logkey(JSContext *cx, uintN argc, jsval *arglist)
if
(
argc
>
1
)
JS_ValueToBoolean
(
cx
,
argv
[
1
],
&
comma
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
if
(
p
==
NULL
)
{
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
return
(
JS_TRUE
);
...
...
@@ -1464,7 +1464,7 @@ js_logstr(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
if
(
p
==
NULL
)
{
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
return
(
JS_TRUE
);
...
...
@@ -1498,7 +1498,7 @@ js_finduser(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
if
(
p
==
NULL
)
{
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
0
));
return
(
JS_TRUE
);
...
...
@@ -1537,13 +1537,13 @@ js_trashcan(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
js_can
,
can
);
JSSTRING_TO_STRING
(
cx
,
js_can
,
can
,
NULL
);
if
(
can
==
NULL
)
{
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
js_str
,
str
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
str
,
NULL
);
if
(
str
==
NULL
)
{
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
return
(
JS_TRUE
);
...
...
@@ -1616,11 +1616,11 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_pw
=
JS_ValueToString
(
cx
,
argv
[
1
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_name
,
name
);
JSSTRING_TO_STRING
(
cx
,
js_name
,
name
,
NULL
);
if
(
name
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_pw
,
pw
);
JSSTRING_TO_STRING
(
cx
,
js_pw
,
pw
,
NULL
);
if
(
pw
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -1854,7 +1854,7 @@ js_batchaddlist(JSContext *cx, uintN argc, jsval *arglist)
if
((
sbbs
=
(
sbbs_t
*
)
JS_GetContextPrivate
(
cx
))
==
NULL
)
return
(
JS_FALSE
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
batch_add_list
(
cstr
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1881,7 +1881,7 @@ js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
if
(
argc
>
1
&&
(
p
=
js_ValueToStringBytes
(
cx
,
argv
[
1
],
NULL
))
!=
NULL
)
prot
=*
p
;
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
sendfile
(
cstr
,
prot
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1908,7 +1908,7 @@ js_recvfile(JSContext *cx, uintN argc, jsval *arglist)
if
(
argc
>
1
&&
(
p
=
js_ValueToStringBytes
(
cx
,
argv
[
1
],
NULL
))
!=
NULL
)
prot
=*
p
;
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
recvfile
(
cstr
,
prot
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -2337,9 +2337,9 @@ js_email(JSContext *cx, uintN argc, jsval *arglist)
}
if
(
js_top
!=
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_top
,
top
);
JSSTRING_TO_STRING
(
cx
,
js_top
,
top
,
NULL
);
if
(
js_subj
!=
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_subj
,
subj
);
JSSTRING_TO_STRING
(
cx
,
js_subj
,
subj
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
email
(
usernumber
,
top
,
subj
,
mode
)));
...
...
@@ -2375,9 +2375,9 @@ js_netmail(JSContext *cx, uintN argc, jsval *arglist)
}
if
(
js_subj
!=
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_subj
,
subj
);
JSSTRING_TO_STRING
(
cx
,
js_subj
,
subj
,
NULL
);
JSSTRING_TO_STRING
(
cx
,
js_to
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_to
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
netmail
(
cstr
,
subj
,
mode
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -2401,7 +2401,7 @@ js_bulkmail(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
if
(
argc
)
{
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
p
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
p
,
NULL
);
if
(
p
==
NULL
)
return
(
JS_FALSE
);
ar
=
arstr
(
NULL
,
p
,
&
sbbs
->
cfg
);
...
...
@@ -2518,7 +2518,7 @@ js_telnet_gate(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_addr
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_addr
,
addr
);
JSSTRING_TO_STRING
(
cx
,
js_addr
,
addr
,
NULL
);
if
(
addr
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -2682,7 +2682,7 @@ js_put_node_message(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_msg
=
JS_ValueToString
(
cx
,
argv
[
1
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_msg
,
msg
);
JSSTRING_TO_STRING
(
cx
,
js_msg
,
msg
,
NULL
);
if
(
msg
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -2742,7 +2742,7 @@ js_put_telegram(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_msg
=
JS_ValueToString
(
cx
,
argv
[
1
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_msg
,
msg
);
JSSTRING_TO_STRING
(
cx
,
js_msg
,
msg
,
NULL
);
if
(
msg
==
NULL
)
return
(
JS_FALSE
);
...
...
@@ -2774,15 +2774,15 @@ js_cmdstr(JSContext *cx, uintN argc, jsval *arglist)
if
(
!
js_str
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
for
(
uintN
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
JSVAL_IS_STRING
(
argv
[
i
]))
{
js_str
=
JS_ValueToString
(
cx
,
argv
[
i
]);
if
(
fpath
==
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_str
,
fpath
)
// Magic
JSSTRING_TO_STRING
(
cx
,
js_str
,
fpath
,
NULL
)
// Magic
else
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
,
NULL
);
}
}
...
...
@@ -2856,7 +2856,7 @@ js_listfiles(JSContext *cx, uintN argc, jsval *arglist)
JS_ValueToInt32
(
cx
,
argv
[
i
],
&
mode
);
else
if
(
JSVAL_IS_STRING
(
argv
[
i
]))
{
js_str
=
JS_ValueToString
(
cx
,
argv
[
i
]);
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
,
NULL
);
}
}
...
...
@@ -2900,7 +2900,7 @@ js_listfileinfo(JSContext *cx, uintN argc, jsval *arglist)
JS_ValueToInt32
(
cx
,
argv
[
i
],
&
mode
);
else
if
(
JSVAL_IS_STRING
(
argv
[
i
]))
{
js_str
=
JS_ValueToString
(
cx
,
argv
[
i
]);
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
fspec
,
NULL
);
}
}
...
...
@@ -3116,7 +3116,7 @@ js_scanposts(JSContext *cx, uintN argc, jsval *arglist)
if
(
JSVAL_IS_NUM
(
argv
[
i
]))
JS_ValueToInt32
(
cx
,
argv
[
i
],
&
mode
);
else
if
(
JSVAL_IS_STRING
(
argv
[
i
]))
JSVALUE_TO_STRING
(
cx
,
argv
[
i
],
find
);
JSVALUE_TO_STRING
(
cx
,
argv
[
i
],
find
,
NULL
);
}
if
(
*
find
)
...
...
@@ -3158,7 +3158,7 @@ js_listmsgs(JSContext *cx, uintN argc, jsval *arglist)
if
(
JSVAL_IS_NUM
(
argv
[
argn
]))
JS_ValueToInt32
(
cx
,
argv
[
argn
++
],
&
start
);
if
(
JSVAL_IS_STRING
(
argv
[
argn
]))
JSVALUE_TO_STRING
(
cx
,
argv
[
argn
++
],
find
);
JSVALUE_TO_STRING
(
cx
,
argv
[
argn
++
],
find
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
sbbs
->
listsub
(
subnum
,
mode
,
start
,
find
)));
...
...
@@ -3267,7 +3267,7 @@ js_chk_ar(JSContext *cx, uintN argc, jsval *arglist)
if
((
sbbs
=
(
sbbs_t
*
)
JS_GetContextPrivate
(
cx
))
==
NULL
)
return
JS_FALSE
;
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
p
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
p
,
NULL
);
if
(
p
==
NULL
)
return
JS_FALSE
;
...
...
@@ -3660,7 +3660,7 @@ static JSBool js_bbs_resolve(JSContext *cx, JSObject *obj, jsid id)
jsval
idval
;
JS_IdToValue
(
cx
,
id
,
&
idval
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
,
NULL
);
}
return
(
js_SyncResolve
(
cx
,
obj
,
name
,
js_bbs_properties
,
js_bbs_functions
,
NULL
,
0
));
...
...
src/sbbs3/js_com.c
View file @
4d1fb057
...
...
@@ -187,7 +187,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cp
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
cp
,
NULL
);
len
=
JS_GetStringLength
(
str
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
...
...
@@ -225,7 +225,7 @@ js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL
(
cx
,
arglist
,
JSVAL_FALSE
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
fname
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
fname
,
NULL
);
if
(
fname
==
NULL
)
{
JS_ReportError
(
cx
,
"Failure reading filename"
);
return
(
JS_FALSE
);
...
...
@@ -732,7 +732,7 @@ static JSBool js_com_resolve(JSContext *cx, JSObject *obj, jsid id)
jsval
idval
;
JS_IdToValue
(
cx
,
id
,
&
idval
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
,
NULL
);
}
return
(
js_SyncResolve
(
cx
,
obj
,
name
,
js_com_properties
,
js_com_functions
,
NULL
,
0
));
...
...
@@ -771,7 +771,7 @@ js_com_constructor(JSContext *cx, uintN argc, jsval *arglist)
obj
=
JS_NewObject
(
cx
,
&
js_com_class
,
NULL
,
NULL
);
JS_SET_RVAL
(
cx
,
arglist
,
OBJECT_TO_JSVAL
(
obj
));
if
(
argc
>
0
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
fname
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
fname
,
NULL
);
if
(
argc
==
0
||
fname
==
NULL
)
{
JS_ReportError
(
cx
,
"Failure reading port name"
);
return
(
JS_FALSE
);
...
...
src/sbbs3/js_conio.c
View file @
4d1fb057
...
...
@@ -585,7 +585,7 @@ js_conio_loadfont(JSContext *cx, uintN argc, jsval *arglist)
jsrefcount
rc
;
if
(
argc
==
1
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
,
NULL
);
if
(
argc
==
1
&&
str
!=
NULL
)
{
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
loadfont
(
str
)));
...
...
@@ -605,7 +605,7 @@ js_conio_settitle(JSContext *cx, uintN argc, jsval *arglist)
jsrefcount
rc
;
if
(
argc
==
1
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
,
NULL
);
if
(
argc
==
1
&&
str
!=
NULL
)
{
rc
=
JS_SUSPENDREQUEST
(
cx
);
settitle
(
str
);
...
...
@@ -626,7 +626,7 @@ js_conio_setname(JSContext *cx, uintN argc, jsval *arglist)
jsrefcount
rc
;
if
(
argc
==
1
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
,
NULL
);
if
(
argc
==
1
&&
str
!=
NULL
)
{
rc
=
JS_SUSPENDREQUEST
(
cx
);
setname
(
str
);
...
...
@@ -647,7 +647,7 @@ js_conio_cputs(JSContext *cx, uintN argc, jsval *arglist)
jsrefcount
rc
;
if
(
argc
==
1
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
,
NULL
);
if
(
argc
==
1
&&
str
!=
NULL
)
{
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
cputs
(
str
)));
...
...
@@ -706,7 +706,7 @@ js_conio_getpass(JSContext *cx, uintN argc, jsval *arglist)
jsrefcount
rc
;
if
(
argc
==
1
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
str
,
NULL
);
if
(
argc
==
1
&&
str
!=
NULL
)
{
rc
=
JS_SUSPENDREQUEST
(
cx
);
pwd
=
getpass
(
str
);
...
...
@@ -1144,7 +1144,7 @@ static JSBool js_conio_resolve(JSContext *cx, JSObject *obj, jsid id)
jsval
idval
;
JS_IdToValue
(
cx
,
id
,
&
idval
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
,
NULL
);
}
return
(
js_SyncResolve
(
cx
,
obj
,
name
,
js_properties
,
js_functions
,
NULL
,
0
));
...
...
src/sbbs3/js_console.cpp
View file @
4d1fb057
...
...
@@ -206,7 +206,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
break
;
case
CON_PROP_ATTR
:
if
(
JSVAL_IS_STRING
(
*
vp
))
{
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
);
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
,
NULL
);
if
(
sval
==
NULL
)
break
;
val
=
attrstr
(
sval
);
...
...
@@ -228,7 +228,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
sbbs
->
autoterm
=
val
;
break
;
case
CON_PROP_TERMINAL
:
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
);
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
,
NULL
);
if
(
sval
==
NULL
)
break
;
SAFECOPY
(
sbbs
->
terminal
,
sval
);
...
...
@@ -262,7 +262,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
sbbs
->
getstr_offset
=
val
;
break
;
case
CON_PROP_QUESTION
:
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
);
JSVALUE_TO_STRING
(
cx
,
*
vp
,
sval
,
NULL
);
if
(
sval
==
NULL
)
break
;
SAFECOPY
(
sbbs
->
question
,
sval
);
...
...
@@ -277,7 +277,7 @@ static JSBool js_console_set(JSContext *cx, JSObject *obj, jsid id, JSBool stric
if
((
str
=
JS_ValueToString
(
cx
,
*
vp
))
==
NULL
)
break
;
val
=
sbbs
->
cfg
.
ctrlkey_passthru
;
JSSTRING_TO_STRING
(
cx
,
str
,
s
);
JSSTRING_TO_STRING
(
cx
,
str
,
s
,
NULL
);
for
(;
*
s
;
s
++
)
{
if
(
*
s
==
'+'
)
op
=
1
;
...
...
@@ -469,7 +469,7 @@ js_handle_ctrlkey(JSContext *cx, uintN argc, jsval *arglist)
if
(
JSVAL_IS_INT
(
argv
[
0
]))
key
=
(
char
)
JSVAL_TO_INT
(
argv
[
0
]);
else
{
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
keystr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
keystr
,
NULL
);
if
(
keystr
==
NULL
)
return
(
JS_FALSE
);
key
=
keystr
[
0
];
...
...
@@ -523,7 +523,7 @@ js_getstr(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
if
(
js_str
!=
NULL
)
{
JSSTRING_TO_STRING
(
cx
,
js_str
,
p2
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p2
,
NULL
);
sprintf
(
p
,
"%.*s"
,(
int
)
maxlen
,
p2
);
}
...
...
@@ -599,7 +599,7 @@ js_getkeys(JSContext *cx, uintN argc, jsval *arglist)
if
(
js_str
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
val
=
sbbs
->
getkeys
(
cstr
,
maxnum
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -655,11 +655,11 @@ js_gettemplate(JSContext *cx, uintN argc, jsval *arglist)
if
(
js_str
==
NULL
)
str
[
0
]
=
0
;
else
{
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
SAFECOPY
(
str
,
cstr
);
}
JSSTRING_TO_STRING
(
cx
,
js_fmt
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_fmt
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
gettmplt
(
str
,
cstr
,
mode
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -689,7 +689,7 @@ js_ungetstr(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
p
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
while
(
p
&&
*
p
)
...
...
@@ -716,7 +716,7 @@ js_yesno(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
yesno
(
cstr
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -741,7 +741,7 @@ js_noyes(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
noyes
(
cstr
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -766,7 +766,7 @@ js_mnemonics(JSContext *cx, uintN argc, jsval *arglist)
if
((
js_str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
mnemonics
(
cstr
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -942,7 +942,7 @@ js_print(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
JSVALUE_TO_STRING
(
cx
,
argv
[
i
],
cstr
);
JSVALUE_TO_STRING
(
cx
,
argv
[
i
],
cstr
,
NULL
);
if
(
cstr
==
NULL
)
return
(
JS_FALSE
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
...
...
@@ -967,7 +967,7 @@ js_strlen(JSContext *cx, uintN argc, jsval *arglist)
if
((
str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
INT_TO_JSVAL
(
bstrlen
(
cstr
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1042,7 +1042,7 @@ js_putmsg(JSContext *cx, uintN argc, jsval *arglist)
if
(
argc
>
1
&&
JSVAL_IS_NUMBER
(
argv
[
1
]))
JS_ValueToInt32
(
cx
,
argv
[
1
],(
int32
*
)
&
mode
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
putmsg
(
cstr
,
mode
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1072,7 +1072,7 @@ js_printfile(JSContext *cx, uintN argc, jsval *arglist)
if
(
argc
>
1
&&
JSVAL_IS_NUMBER
(
argv
[
1
]))
JS_ValueToInt32
(
cx
,
argv
[
1
],(
int32
*
)
&
mode
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
printfile
(
cstr
,
mode
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1113,7 +1113,7 @@ js_printtail(JSContext *cx, uintN argc, jsval *arglist)
if
(
!
lines
)
lines
=
5
;
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
printtail
(
cstr
,
lines
,
mode
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1138,7 +1138,7 @@ js_editfile(JSContext *cx, uintN argc, jsval *arglist)
if
((
str
=
JS_ValueToString
(
cx
,
argv
[
0
]))
==
NULL
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
JS_SET_RVAL
(
cx
,
arglist
,
BOOLEAN_TO_JSVAL
(
sbbs
->
editfile
(
cstr
)));
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1180,11 +1180,11 @@ js_uselect(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_FALSE
);
if
(
title
==
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_str
,
title
)
// Magicsemicolon
JSSTRING_TO_STRING
(
cx
,
js_str
,
title
,
NULL
)
// Magicsemicolon
else
if
(
item
==
NULL
)
JSSTRING_TO_STRING
(
cx
,
js_str
,
item
)
// Magicsemicolon
JSSTRING_TO_STRING
(
cx
,
js_str
,
item
,
NULL
)
// Magicsemicolon
else
{
JSSTRING_TO_STRING
(
cx
,
js_str
,
ar_str
);
JSSTRING_TO_STRING
(
cx
,
js_str
,
ar_str
,
NULL
);
ar
=
arstr
(
NULL
,
ar_str
,
&
sbbs
->
cfg
);
}
}
...
...
@@ -1214,7 +1214,7 @@ js_center(JSContext *cx, uintN argc, jsval *arglist)
if
(
!
str
)
return
(
JS_FALSE
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
);
JSSTRING_TO_STRING
(
cx
,
str
,
cstr
,
NULL
);
rc
=
JS_SUSPENDREQUEST
(
cx
);
sbbs
->
center
(
cstr
);
JS_RESUMEREQUEST
(
cx
,
rc
);
...
...
@@ -1866,7 +1866,7 @@ static JSBool js_console_resolve(JSContext *cx, JSObject *obj, jsid id)
jsval
idval
;
JS_IdToValue
(
cx
,
id
,
&
idval
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
);
JSSTRING_TO_STRING
(
cx
,
JSVAL_TO_STRING
(
idval
),
name
,
NULL
);
}
return
(
js_SyncResolve
(
cx
,
obj
,
name
,
js_console_properties
,
js_console_functions
,
NULL
,
0
));
...
...
src/sbbs3/js_file.c
View file @
4d1fb057
...
...
@@ -155,7 +155,7 @@ js_open(JSContext *cx, uintN argc, jsval *arglist)
JS_ReportError
(
cx
,
"Invalid mode specified: %s"
,
str
);
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
str
,
mode
);
JSSTRING_TO_STRING
(
cx
,
str
,
mode
,
NULL
);
}
else
if
(
JSVAL_IS_BOOLEAN
(
argv
[
i
]))
/* shareable */
shareable
=
JSVAL_TO_BOOLEAN
(
argv
[
i
]);
else
if
(
JSVAL_IS_NUMBER
(
argv
[
i
]))
{
/* bufsize */
...
...
@@ -218,7 +218,7 @@ js_popen(JSContext *cx, uintN argc, jsval *arglist)
JS_ReportError
(
cx
,
"Invalid mode specified: %s"
,
str
);
return
(
JS_TRUE
);
}
JSSTRING_TO_STRING
(
cx
,
str
,
mode
);
JSSTRING_TO_STRING
(
cx
,
str
,
mode
,
NULL
);
}
else
if
(
JSVAL_IS_NUMBER
(
argv
[
i
]))
{
/* bufsize */
if
(
!
JS_ValueToInt32
(
cx
,
argv
[
i
],
&
bufsize
))
...
...
@@ -642,8 +642,8 @@ js_iniGetValue(JSContext *cx, uintN argc, jsval *arglist)
return
(
JS_TRUE
);
if
(
argv
[
0
]
!=
JSVAL_VOID
&&
argv
[
0
]
!=
JSVAL_NULL
)
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
section
);
JSVALUE_TO_STRING
(
cx
,
argv
[
1
],
key
);
JSVALUE_TO_STRING
(
cx
,
argv
[
0
],
section
,
NULL
);
JSVALUE_TO_STRING
(
cx
,
argv
[
1
],
key
,
NULL
);