[gjs/master.windows: 8/9] gjs: Avoid ambiguity in smart pointers



commit ee14529c4f3d4114aff8f8dd7c7aaee0bf7cfdf7
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 18:03:01 2019 +0800

    gjs: Avoid ambiguity in smart pointers
    
    Use the .get() accessor to be concrete enough about things so that
    we avoid the compiler complaining about ambguity.

 gjs/debugger.cpp      | 2 +-
 gjs/importer.cpp      | 2 +-
 gjs/jsapi-util-args.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gjs/debugger.cpp b/gjs/debugger.cpp
index 28162007..8da90ee6 100644
--- a/gjs/debugger.cpp
+++ b/gjs/debugger.cpp
@@ -97,7 +97,7 @@ static bool do_readline(JSContext* cx, unsigned argc, JS::Value* vp) {
             args.rval().setUndefined();
             return true;
         }
-    } while (line && line[0] == '\0');
+    } while (line.get() && line.get()[0] == '\0');
 
     /* Add line to history and convert it to a JSString so that we can pass it
      * back as the return value */
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 4b4963f3..dc9094c2 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -708,7 +708,7 @@ static bool importer_new_enumerate(JSContext* context, JS::HandleObject object,
             GjsAutoChar filename = g_file_get_basename(file);
 
             /* skip hidden files and directories (.svn, .git, ...) */
-            if (filename[0] == '.')
+            if (filename.get()[0] == '.')
                 continue;
 
             /* skip module init file */
diff --git a/gjs/jsapi-util-args.h b/gjs/jsapi-util-args.h
index b7a982d4..535e31db 100644
--- a/gjs/jsapi-util-args.h
+++ b/gjs/jsapi-util-args.h
@@ -399,8 +399,8 @@ GJS_JSAPI_RETURN_CONVENTION static bool gjs_parse_call_args(
     }
 
     GjsAutoStrv parts = g_strsplit(format, "|", 2);
-    fmt_required = parts[0];
-    fmt_optional = parts[1];  /* may be NULL */
+    fmt_required = parts.get()[0];
+    fmt_optional = parts.get()[1];  /* may be NULL */
 
     retval = parse_call_args_helper(cx, function_name, args,
                                     ignore_trailing_args, fmt_required,


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