diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-05-05 22:46:40 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-05-05 22:50:25 +0100 |
commit | 35bc2ccbb89a6b499e0e3b6f7095afea214f0c59 (patch) | |
tree | cd494ae1e33ab55d0e644d11eb973ddde4decbb6 /content/handlers/javascript/duktape/dukky.c | |
parent | f966580d22d47ab97bceb2f067fc2b9402af01b7 (diff) | |
download | netsurf-35bc2ccbb89a6b499e0e3b6f7095afea214f0c59.tar.gz netsurf-35bc2ccbb89a6b499e0e3b6f7095afea214f0c59.tar.bz2 |
change content get_source_data interfaces to return uint8_t and size_t
previously these interfaces returned char * and unsigned int which was
undesirable.
Diffstat (limited to 'content/handlers/javascript/duktape/dukky.c')
-rw-r--r-- | content/handlers/javascript/duktape/dukky.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c index d1bd4ec49..e9e579d4d 100644 --- a/content/handlers/javascript/duktape/dukky.c +++ b/content/handlers/javascript/duktape/dukky.c @@ -761,10 +761,16 @@ void dukky_push_generics(duk_context *ctx, const char *generic) /* ..., generic */ } -bool js_exec(jscontext *ctx, const char *txt, size_t txtlen, const char *name) +/* exported interface documented in js.h */ +bool +js_exec(jscontext *ctx, const uint8_t *txt, size_t txtlen, const char *name) { assert(ctx); - if (txt == NULL || txtlen == 0) return false; + + if (txt == NULL || txtlen == 0) { + return false; + } + duk_set_top(CTX, 0); NSLOG(dukky, DEEPDEBUG, "Running %"PRIsizet" bytes from %s", txtlen, name); /* NSLOG(dukky, DEEPDEBUG, "\n%s\n", txt); */ @@ -775,7 +781,10 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen, const char *name) } else { duk_push_string(CTX, "?unknown source?"); } - if (duk_pcompile_lstring_filename(CTX, DUK_COMPILE_EVAL, txt, txtlen) != 0) { + if (duk_pcompile_lstring_filename(CTX, + DUK_COMPILE_EVAL, + (const char *)txt, + txtlen) != 0) { NSLOG(dukky, INFO, "Failed to compile JavaScript input"); goto handle_error; } |