summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwszqkzqk <wszqkzqk@qq.com>2022-11-27 10:17:13 +0800
committerRico Tzschichholz <ricotz@ubuntu.com>2022-11-27 09:28:25 +0100
commit6b584ba3c2e7df72046a9420aa89e68d0ad5eabe (patch)
tree704b086baa416c2efa787da38622fef944d85030
parenta16275e1353a782d7f16c1abdedeb17d785ddaa9 (diff)
downloadvala-6b584ba3c2e7df72046a9420aa89e68d0ad5eabe.tar.gz
Fix output decoding error of non-ASCII character on Win32
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1379
-rw-r--r--codegen/valaccodecompiler.vala2
-rw-r--r--compiler/valacompiler.vala30
-rw-r--r--libvaladoc/parser/parser.vala6
-rw-r--r--vala/valacodecontext.vala2
-rw-r--r--vala/valareport.vala10
-rw-r--r--valadoc/valadoc.vala14
-rw-r--r--vapigen/valagidlparser.vala2
-rw-r--r--vapigen/valavapicheck.vala4
-rw-r--r--vapigen/valavapigen.vala14
9 files changed, 42 insertions, 42 deletions
diff --git a/codegen/valaccodecompiler.vala b/codegen/valaccodecompiler.vala
index cc635abfd..df2aa0d28 100644
--- a/codegen/valaccodecompiler.vala
+++ b/codegen/valaccodecompiler.vala
@@ -94,7 +94,7 @@ public class Vala.CCodeCompiler {
}
if (context.verbose_mode) {
- stdout.printf ("%s\n", cmdline);
+ print ("%s\n", cmdline);
}
try {
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index a8ebd084e..13444d519 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -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;
}
diff --git a/libvaladoc/parser/parser.vala b/libvaladoc/parser/parser.vala
index 203287605..7cd828a31 100644
--- a/libvaladoc/parser/parser.vala
+++ b/libvaladoc/parser/parser.vala
@@ -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
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index f96f87911..0ac4bbdf8 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -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");
diff --git a/vala/valareport.vala b/vala/valareport.vala
index b35218baa..bdb11236f 100644
--- a/vala/valareport.vala
+++ b/vala/valareport.vala
@@ -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);
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index 9460439bd..1ea241613 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -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;
}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index be34201f5..271570325 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -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;
}
diff --git a/vapigen/valavapicheck.vala b/vapigen/valavapicheck.vala
index 9214e16ec..930ac3beb 100644
--- a/vapigen/valavapicheck.vala
+++ b/vapigen/valavapicheck.vala
@@ -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;
}
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 7bd37be85..3ae8577f4 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -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;
}