1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Compilation fixes (--enable-debug)

This commit is contained in:
witekfl 2012-03-04 18:11:18 +01:00
parent 36070d3277
commit e86ec567f2
7 changed files with 26 additions and 10 deletions

View File

@ -50,7 +50,7 @@ smjs_action_fn_callback(JSContext *ctx, uintN argc, jsval *rval)
assert(smjs_ctx); assert(smjs_ctx);
if_assert_failed return JS_FALSE; if_assert_failed return JS_FALSE;
value = JS_FALSE; value = JSVAL_FALSE;
if (JS_TRUE != JS_ValueToObject(ctx, argv[-2], &fn_obj)) { if (JS_TRUE != JS_ValueToObject(ctx, argv[-2], &fn_obj)) {
JS_SET_RVAL(ctx, rval, value); JS_SET_RVAL(ctx, rval, value);
@ -76,7 +76,7 @@ smjs_action_fn_callback(JSContext *ctx, uintN argc, jsval *rval)
do_action(hop->ses, hop->action_id, 1); do_action(hop->ses, hop->action_id, 1);
value = JS_TRUE; value = JSVAL_TRUE;
JS_SET_RVAL(ctx, rval, value); JS_SET_RVAL(ctx, rval, value);
return JS_TRUE; return JS_TRUE;

View File

@ -186,6 +186,7 @@ static JSBool
bookmark_set_property(JSContext *ctx, JSObject *obj, jsid id, JSBool strict, jsval *vp) bookmark_set_property(JSContext *ctx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
{ {
struct bookmark *bookmark; struct bookmark *bookmark;
jsid tmp;
unsigned char *title = NULL; unsigned char *title = NULL;
unsigned char *url = NULL; unsigned char *url = NULL;
int ok; int ok;
@ -206,11 +207,15 @@ bookmark_set_property(JSContext *ctx, JSObject *obj, jsid id, JSBool strict, jsv
switch (JSID_TO_INT(id)) { switch (JSID_TO_INT(id)) {
case BOOKMARK_TITLE: case BOOKMARK_TITLE:
if (!jsval_to_bookmark_string(ctx, *vp, &title)) if (!JS_ValueToId(ctx, *vp, &tmp))
return JS_FALSE;
if (!jsval_to_bookmark_string(ctx, tmp, &title))
return JS_FALSE; return JS_FALSE;
break; break;
case BOOKMARK_URL: case BOOKMARK_URL:
if (!jsval_to_bookmark_string(ctx, *vp, &url)) if (!JS_ValueToId(ctx, *vp, &tmp))
return JS_FALSE;
if (!jsval_to_bookmark_string(ctx, tmp, &url))
return JS_FALSE; return JS_FALSE;
break; break;
default: default:

View File

@ -4,6 +4,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <unistd.h>
#include "elinks.h" #include "elinks.h"
#include "bfu/msgbox.h" #include "bfu/msgbox.h"
@ -254,7 +256,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, jsval argv[], int argc,
method, rval)) method, rval))
return JS_FALSE; return JS_FALSE;
if (JSVAL_VOID == *rval) if (JSVAL_IS_VOID(*rval))
return JS_FALSE; return JS_FALSE;
return JS_CallFunctionValue(smjs_ctx, smjs_elinks_object, return JS_CallFunctionValue(smjs_ctx, smjs_elinks_object,

View File

@ -206,8 +206,12 @@ smjs_globhist_get_property(JSContext *ctx, JSObject *obj, jsid id, jsval *vp)
JSObject *jsobj; JSObject *jsobj;
unsigned char *uri_string; unsigned char *uri_string;
struct global_history_item *history_item; struct global_history_item *history_item;
jsval tmp;
uri_string = JS_EncodeString(ctx, JS_ValueToString(ctx, id)); if (!JS_IdToValue(ctx, id, &tmp))
goto ret_null;
uri_string = JS_EncodeString(ctx, JS_ValueToString(ctx, tmp));
if (!uri_string) goto ret_null; if (!uri_string) goto ret_null;
history_item = get_global_history_item(uri_string); history_item = get_global_history_item(uri_string);

View File

@ -22,6 +22,7 @@ keymap_get_property(JSContext *ctx, JSObject *obj, jsid id, jsval *vp)
unsigned char *action_str; unsigned char *action_str;
const unsigned char *keystroke_str; const unsigned char *keystroke_str;
int *data; int *data;
jsval tmp;
/* This can be called if @obj if not itself an instance of the /* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail * appropriate class but has one in its prototype chain. Fail
@ -32,7 +33,10 @@ keymap_get_property(JSContext *ctx, JSObject *obj, jsid id, jsval *vp)
data = JS_GetInstancePrivate(ctx, obj, data = JS_GetInstancePrivate(ctx, obj,
(JSClass *) &keymap_class, NULL); (JSClass *) &keymap_class, NULL);
keystroke_str = JS_EncodeString(ctx, JS_ValueToString(ctx, id)); if (!JS_IdToValue(ctx, id, &tmp))
goto ret_null;
keystroke_str = JS_EncodeString(ctx, JS_ValueToString(ctx, tmp));
if (!keystroke_str) goto ret_null; if (!keystroke_str) goto ret_null;
action_str = get_action_name_from_keystroke((enum keymap_id) *data, action_str = get_action_name_from_keystroke((enum keymap_id) *data,

View File

@ -454,7 +454,7 @@ session_construct(JSContext *ctx, uintN argc, jsval *rval)
{ {
jsval val; jsval val;
jsval *argv = JS_ARGV(ctx, rval); jsval *argv = JS_ARGV(ctx, rval);
int bg; /* open new tab in background */ int bg = 0; /* open new tab in background */
struct session *ses; struct session *ses;
JSObject *jsobj; JSObject *jsobj;
@ -715,8 +715,6 @@ static const spidermonkeyFunctionSpec session_funcs[] = {
void void
smjs_init_session_interface(void) smjs_init_session_interface(void)
{ {
JSObject *jsobj;
assert(smjs_ctx); assert(smjs_ctx);
assert(smjs_global_object); assert(smjs_global_object);

View File

@ -5,6 +5,7 @@ struct module;
struct cache_entry; struct cache_entry;
struct session; struct session;
struct terminal; struct terminal;
struct view_state;
extern struct module smjs_scripting_module; extern struct module smjs_scripting_module;
@ -18,4 +19,6 @@ void smjs_detach_session_object(struct session *ses);
void smjs_detach_terminal_object(struct terminal *term); void smjs_detach_terminal_object(struct terminal *term);
void smjs_detach_view_state_object(struct view_state *vs);
#endif #endif