From 35bc2ccbb89a6b499e0e3b6f7095afea214f0c59 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 5 May 2019 22:46:40 +0100 Subject: change content get_source_data interfaces to return uint8_t and size_t previously these interfaces returned char * and unsigned int which was undesirable. --- content/handlers/javascript/duktape/dukky.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'content/handlers/javascript/duktape/dukky.c') 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; } -- cgit v1.2.3