[gjs/wip/ptomato/mozjs45: 27/27] FIXME - utf-16 stuff in console error reporter



commit 5df71963fa652f971dcf0f575f618db54193453f
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Apr 16 23:18:49 2017 -0700

    FIXME - utf-16 stuff in console error reporter
    
    FIXME: You can't send linebuf() to std::cout, it prints a pointer
    
    FIXME: This error reporter isn't even called!

 modules/console.cpp |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/modules/console.cpp b/modules/console.cpp
index 6f70c1f..a6731ac 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -40,6 +40,7 @@
 
 #include "config.h"
 
+#include <iostream>
 #include <stdlib.h>
 #include <string.h>
 
@@ -99,21 +100,20 @@ gjs_console_error_reporter(JSContext *cx, const char *message, JSErrorReport *re
         fputs(prefix, stderr);
     fputs(message, stderr);
 
-    if (!report->linebuf) {
+    if (!report->linebuf()) {
         fputc('\n', stderr);
         goto out;
     }
 
+    // FIXME THIS
     /* report->linebuf usually ends with a newline. */
-    n = strlen(report->linebuf);
-    fprintf(stderr, ":\n%s%s%s%s",
-            prefix,
-            report->linebuf,
-            (n > 0 && report->linebuf[n-1] == '\n') ? "" : "\n",
-            prefix);
-    n = ((char*)report->tokenptr) - ((char*) report->linebuf);
+    n = std::char_traits<char16_t>::length(report->linebuf());
+    std::cerr << ":\n" << prefix << report->linebuf()
+        << ((n > 0 && report->linebuf()[n-1] == '\n') ? "" : "\n")
+        << prefix;
+    n = report->tokenOffset();
     for (i = j = 0; i < n; i++) {
-        if (report->linebuf[i] == '\t') {
+        if (report->linebuf()[i] == '\t') {
             for (k = (j + 8) & ~7; j < k; j++) {
                 fputc('.', stderr);
             }


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