[gjs] gjs_throw: convert error string from UTF-8



commit a645a2b4687b7cbca0a8c5ff3361b4a0bde719de
Author: Dan Winship <danw gnome org>
Date:   Sat Feb 13 10:00:25 2010 -0500

    gjs_throw: convert error string from UTF-8
    
    https://bugzilla.gnome.org/show_bug.cgi?id=609830

 gjs/jsapi-util-error.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/gjs/jsapi-util-error.c b/gjs/jsapi-util-error.c
index 2e1e58c..dd177c5 100644
--- a/gjs/jsapi-util-error.c
+++ b/gjs/jsapi-util-error.c
@@ -44,7 +44,6 @@ gjs_throw_valist(JSContext       *context,
                     const char      *format,
                     va_list          args)
 {
-    JSString* jstr;
     char *s;
     jsval retval;
     jsval argv[1];
@@ -76,8 +75,7 @@ gjs_throw_valist(JSContext       *context,
 
     JS_EnterLocalRootScope(context);
 
-    jstr = JS_NewStringCopyZ(context, s);
-    if (jstr == NULL) {
+    if (!gjs_string_from_utf8(context, s, -1, &argv[0])) {
         JS_ReportError(context, "Failed to copy exception string");
         goto out;
     }
@@ -105,7 +103,6 @@ gjs_throw_valist(JSContext       *context,
     }
 
     retval = JSVAL_VOID;
-    argv[0] = STRING_TO_JSVAL(jstr);
 
     /* note the return value is whether function succeeded, which it shouldn't, since it
      * throws...



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]