]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix output decoding error of non-ASCII character on Win32
authorwszqkzqk <wszqkzqk@qq.com>
Sun, 27 Nov 2022 02:17:13 +0000 (10:17 +0800)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 27 Nov 2022 08:28:25 +0000 (09:28 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1379

codegen/valaccodecompiler.vala
compiler/valacompiler.vala
libvaladoc/parser/parser.vala
vala/valacodecontext.vala
vala/valareport.vala
valadoc/valadoc.vala
vapigen/valagidlparser.vala
vapigen/valavapicheck.vala
vapigen/valavapigen.vala

index cc635abfd49946b4823244716a39df1e1905dc30..df2aa0d28965aad11ca7471c79a58459d1f864e4 100644 (file)
@@ -94,7 +94,7 @@ public class Vala.CCodeCompiler {
                }
 
                if (context.verbose_mode) {
-                       stdout.printf ("%s\n", cmdline);
+                       print ("%s\n", cmdline);
                }
 
                try {
index a8ebd084e6d6c6d72545e74ae9ef812b233032b7..13444d519f18e68b79dded74527791fb7e020040 100644 (file)
@@ -193,7 +193,7 @@ class Vala.Compiler {
        }
 
        static bool option_deprecated (string option_name, string? val, void* data) throws OptionError {
-               stdout.printf ("Command-line option `%s` is deprecated and will be ignored\n", option_name);
+               print ("Command-line option `%s` is deprecated and will be ignored\n", option_name);
                return true;
        }
 
@@ -204,13 +204,13 @@ class Vala.Compiler {
                }
                if (context.report.get_errors () == 0 && (!fatal_warnings || context.report.get_warnings () == 0)) {
                        if (!quiet_mode) {
-                               stdout.printf ("Compilation succeeded - %d warning(s)\n", context.report.get_warnings ());
+                               print ("Compilation succeeded - %d warning(s)\n", context.report.get_warnings ());
                        }
                        CodeContext.pop ();
                        return 0;
                } else {
                        if (!quiet_mode) {
-                               stdout.printf ("Compilation failed: %d error(s), %d warning(s)\n", context.report.get_errors (), context.report.get_warnings ());
+                               print ("Compilation failed: %d error(s), %d warning(s)\n", context.report.get_errors (), context.report.get_warnings ());
                        }
                        CodeContext.pop ();
                        return 1;
@@ -545,21 +545,21 @@ class Vala.Compiler {
                        opt_context.add_main_entries (options, null);
                        opt_context.parse (ref args);
                } catch (OptionError e) {
-                       stdout.printf ("%s\n", e.message);
-                       stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
+                       print ("%s\n", e.message);
+                       print ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
                        return 1;
                }
 
                if (version) {
-                       stdout.printf ("Vala %s\n", Vala.BUILD_VERSION);
+                       print ("Vala %s\n", Vala.BUILD_VERSION);
                        return 0;
                } else if (api_version) {
-                       stdout.printf ("%s\n", Vala.API_VERSION);
+                       print ("%s\n", Vala.API_VERSION);
                        return 0;
                }
 
                if (sources == null) {
-                       stderr.printf ("No source file specified.\n");
+                       printerr ("No source file specified.\n");
                        return 1;
                }
 
@@ -614,7 +614,7 @@ class Vala.Compiler {
 
                        return child_status;
                } catch (SpawnError e) {
-                       stdout.printf ("%s\n", e.message);
+                       print ("%s\n", e.message);
                        return 1;
                }
        }
@@ -624,7 +624,7 @@ class Vala.Compiler {
                Intl.setlocale (LocaleCategory.ALL, "");
 
                if (Vala.get_build_version () != Vala.BUILD_VERSION) {
-                       stderr.printf ("Integrity check failed (libvala %s doesn't match valac %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+                       printerr ("Integrity check failed (libvala %s doesn't match valac %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
                        return 1;
                }
 
@@ -638,21 +638,21 @@ class Vala.Compiler {
                        opt_context.add_main_entries (options, null);
                        opt_context.parse (ref args);
                } catch (OptionError e) {
-                       stdout.printf ("%s\n", e.message);
-                       stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
+                       print ("%s\n", e.message);
+                       print ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
                        return 1;
                }
 
                if (version) {
-                       stdout.printf ("Vala %s\n", Vala.BUILD_VERSION);
+                       print ("Vala %s\n", Vala.BUILD_VERSION);
                        return 0;
                } else if (api_version) {
-                       stdout.printf ("%s\n", Vala.API_VERSION);
+                       print ("%s\n", Vala.API_VERSION);
                        return 0;
                }
 
                if (sources == null && fast_vapis == null) {
-                       stderr.printf ("No source file specified.\n");
+                       printerr ("No source file specified.\n");
                        return 1;
                }
 
index 203287605a0a0c19d33899983bcdd4baccfa14db..7cd828a31d7272bdc9ba815e00794aca4d3615f7 100644 (file)
@@ -295,10 +295,10 @@ public class Valadoc.Parser : ParserCallback {
 
 #if DEBUG
        private void log_error (string message) {
-               stderr.printf ("An error occurred while parsing: %s\n", message);
-               stderr.printf ("\nDumping rule stack:\n");
+               printerr ("An error occurred while parsing: %s\n", message);
+               printerr ("\nDumping rule stack:\n");
                for (int i = 0; i < rule_stack.size; i++) {
-                       stderr.printf ("\t%2d: %s\n", i, rule_stack[i].to_string (rule_state_stack[i]));
+                       printerr ("\t%2d: %s\n", i, rule_stack[i].to_string (rule_state_stack[i]));
                }
        }
 #endif
index f96f87911c4e2f4b94a8b3f77e8b9a78db71c48f..0ac4bbdf8162abfc1e9b6a56fe5cbe969f8e28fe 100644 (file)
@@ -409,7 +409,7 @@ public class Vala.CodeContext {
                }
 
                if (verbose_mode) {
-                       stdout.printf ("Loaded package `%s'\n", path);
+                       print ("Loaded package `%s'\n", path);
                }
 
                var deps_filename = Path.build_path ("/", Path.get_dirname (path), pkg + ".deps");
index b35218baa08698511f5ff42a5f4d95871b526a24..bdb11236fcd8f077957364a1285141296c043ee6 100644 (file)
@@ -234,8 +234,8 @@ public class Vala.Report {
        private void report_source (SourceReference source) {
                for (int idx = source.begin.line; idx <= source.end.line; idx++) {
                        string offending_line = source.file.get_source_line (idx);
-                       stderr.printf ("%5d | %s\n", idx, offending_line);
-                       stderr.printf ("      | ");
+                       printerr ("%5d | %s\n", idx, offending_line);
+                       printerr ("      | ");
                        stderr.puts (caret_color_start);
                        for (int jdx = 0; jdx < offending_line.length; jdx++) {
                                if (offending_line[jdx] == '\t') {
@@ -290,7 +290,7 @@ public class Vala.Report {
                                        start = cur;
                                } else {
                                        cur++;
-                                       stderr.printf ("%s%s%s", quote_color_start, message.substring (start, cur - start), quote_color_end);
+                                       printerr ("%s%s%s", quote_color_start, message.substring (start, cur - start), quote_color_end);
                                        start = cur;
                                }
                        } else {
@@ -303,10 +303,10 @@ public class Vala.Report {
 
        private void print_message (SourceReference? source, string type, string type_color_start, string type_color_end, string message, bool do_report_source) {
                if (source != null) {
-                       stderr.printf ("%s%s:%s ", locus_color_start, source.to_string (), locus_color_end);
+                       printerr ("%s%s:%s ", locus_color_start, source.to_string (), locus_color_end);
                }
 
-               stderr.printf ("%s%s:%s ", type_color_start, type, type_color_end);
+               printerr ("%s%s:%s ", type_color_start, type, type_color_end);
 
                // highlight '', `', ``
                print_highlighted_message (message);
index 9460439bdbe4f7274e2ce0760424d2792d623542..1ea2416138a58ec2e29bd8bdd5295a756e7f76fc 100644 (file)
@@ -136,17 +136,17 @@ public class ValaDoc : Object {
        }
 
        static bool option_deprecated (string option_name, string? val, void* data) throws OptionError {
-               stdout.printf ("Command-line option `%s` is deprecated and will be ignored\n", option_name);
+               print ("Command-line option `%s` is deprecated and will be ignored\n", option_name);
                return true;
        }
 
        private static int quit (ErrorReporter reporter) {
                if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
-                       stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
+                       print ("Succeeded - %d warning(s)\n", reporter.warnings);
                        Vala.CodeContext.pop ();
                        return 0;
                } else {
-                       stdout.printf ("Failed: %d error(s), %d warning(s)\n", reporter.errors, reporter.warnings);
+                       print ("Failed: %d error(s), %d warning(s)\n", reporter.errors, reporter.warnings);
                        Vala.CodeContext.pop ();
                        return 1;
                }
@@ -400,7 +400,7 @@ public class ValaDoc : Object {
                Intl.setlocale (LocaleCategory.ALL, "");
 
                if (Vala.get_build_version () != Vala.BUILD_VERSION) {
-                       stderr.printf ("Integrity check failed (libvala %s doesn't match valadoc %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+                       printerr ("Integrity check failed (libvala %s doesn't match valadoc %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
                        return 1;
                }
 
@@ -410,13 +410,13 @@ public class ValaDoc : Object {
                        opt_context.add_main_entries (options, null);
                        opt_context.parse (ref args);
                } catch (OptionError e) {
-                       stdout.printf ("%s\n", e.message);
-                       stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
+                       print ("%s\n", e.message);
+                       print ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
                        return 1;
                }
 
                if (version) {
-                       stdout.printf ("Valadoc %s\n", Vala.BUILD_VERSION);
+                       print ("Valadoc %s\n", Vala.BUILD_VERSION);
                        return 0;
                }
 
index be34201f5523fcc7dc38ed80be7cdb4c7e207afc..2715703256e38121fe62727dc994c93c5a05ca80 100644 (file)
@@ -1998,7 +1998,7 @@ public class Vala.GIdlParser : CodeVisitor {
                                }
                        }
                } else {
-                       stdout.printf ("%d\n", type_node.tag);
+                       print ("%d\n", type_node.tag);
                }
                return type;
        }
index 9214e16ecb7a985911483affc33271472d9016a4..930ac3bebcd089f6ae77963f6fa17a3aa07d22bb 100644 (file)
@@ -45,7 +45,7 @@ class Vala.VAPICheck {
                                parse_members (module.name, module.entries);
                        }
                } catch (MarkupError e) {
-                       stderr.printf ("%s: %s\n", gidl.filename, e.message);
+                       printerr ("%s: %s\n", gidl.filename, e.message);
                 }
        }
 
@@ -169,7 +169,7 @@ class Vala.VAPICheck {
 
        static int main (string[] args) {
                if (2 != args.length || !args[1].has_suffix (".gidl")) {
-                       stdout.printf ("Usage: %s library.gidl\n",
+                       print ("Usage: %s library.gidl\n",
                                       Path.get_basename (args[0]));
                        return 2;
                }
index 7bd37be85f09480017b19d62c19752dff1da0b80..3ae8577f431f50e8fff9761b635dbedb7de1b2e3 100644 (file)
@@ -60,13 +60,13 @@ class Vala.VAPIGen {
        private int quit () {
                if (context.report.get_errors () == 0) {
                        if (!quiet_mode) {
-                               stdout.printf ("Generation succeeded - %d warning(s)\n", context.report.get_warnings ());
+                               print ("Generation succeeded - %d warning(s)\n", context.report.get_warnings ());
                        }
                        CodeContext.pop ();
                        return 0;
                } else {
                        if (!quiet_mode) {
-                               stdout.printf ("Generation failed: %d error(s), %d warning(s)\n", context.report.get_errors (), context.report.get_warnings ());
+                               print ("Generation failed: %d error(s), %d warning(s)\n", context.report.get_errors (), context.report.get_warnings ());
                        }
                        CodeContext.pop ();
                        return 1;
@@ -213,7 +213,7 @@ class Vala.VAPIGen {
                Intl.setlocale (LocaleCategory.ALL, "");
 
                if (Vala.get_build_version () != Vala.BUILD_VERSION) {
-                       stderr.printf ("Integrity check failed (libvala %s doesn't match vapigen %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
+                       printerr ("Integrity check failed (libvala %s doesn't match vapigen %s)\n", Vala.get_build_version (), Vala.BUILD_VERSION);
                        return 1;
                }
 
@@ -223,18 +223,18 @@ class Vala.VAPIGen {
                        opt_context.add_main_entries (options, null);
                        opt_context.parse (ref args);
                } catch (OptionError e) {
-                       stdout.printf ("%s\n", e.message);
-                       stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
+                       print ("%s\n", e.message);
+                       print ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
                        return 1;
                }
 
                if (version) {
-                       stdout.printf ("Vala API Generator %s\n", Vala.BUILD_VERSION);
+                       print ("Vala API Generator %s\n", Vala.BUILD_VERSION);
                        return 0;
                }
 
                if (sources == null) {
-                       stderr.printf ("No source file specified.\n");
+                       printerr ("No source file specified.\n");
                        return 1;
                }