From 04a5098a58bf6456252d09ee9406ff519cca6ddc Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 15 Dec 2023 13:04:57 +0100 Subject: [PATCH] #840: Generously adds Fl::args_to_utf8() for MinGW support. --- fltk-options/fltk-options.cxx | 1 + fluid/fluid.cxx | 1 + test/browser.cxx | 1 + test/colbrowser.cxx | 1 + test/demo.cxx | 1 + test/fonts.cxx | 1 + test/help_dialog.cxx | 1 + test/unittests.cxx | 1 + 8 files changed, 8 insertions(+) diff --git a/fltk-options/fltk-options.cxx b/fltk-options/fltk-options.cxx index 0e68a5b13..b10277c1e 100644 --- a/fltk-options/fltk-options.cxx +++ b/fltk-options/fltk-options.cxx @@ -676,6 +676,7 @@ int main(int argc,char **argv) { check_write_permissions(g_system_write_ok, g_user_write_ok); int i = 1; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW int args_processed = Fl::args(argc, argv, i, read_command_line_args); if (args_processed < argc) { fprintf(stderr, "ERROR: Unrecognized command line option \"%s\".\n", argv[i]); diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index e19559f66..1366183cd 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -2171,6 +2171,7 @@ int main(int argc,char **argv) { setlocale(LC_NUMERIC, "C"); // make sure numeric values are written correctly g_launch_path = end_with_slash(fl_getcwd()); // store the current path at launch + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if ( (Fl::args(argc,argv,i,arg) == 0) // unsupported argument found || (batch_mode && (i != argc-1)) // .fl filename missing || (!batch_mode && (i < argc-1)) // more than one filename found diff --git a/test/browser.cxx b/test/browser.cxx index 0df67433b..b876f5f7a 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -160,6 +160,7 @@ void wtype_cb(Fl_Widget *, void *) { int main(int argc, char **argv) { int i; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help); const char *fname = (i < argc) ? argv[i] : "browser.cxx"; Fl_Double_Window window(720, 520, fname); diff --git a/test/colbrowser.cxx b/test/colbrowser.cxx index cbd760eb7..cab058361 100644 --- a/test/colbrowser.cxx +++ b/test/colbrowser.cxx @@ -56,6 +56,7 @@ static RGBdb rgbdb[MAX_RGB]; int main(int argc, char *argv[]) { int i; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help); const char *dbname = (i < argc) ? argv[i] : "rgb.txt"; diff --git a/test/demo.cxx b/test/demo.cxx index ce9e8fd21..0cb691b85 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -601,6 +601,7 @@ int main(int argc, char **argv) { // parse commandline int i = 0; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if (!Fl::args(argc, argv, i) || i < argc-1) Fl::fatal("Usage: %s \n%s", argv[0], Fl::help); if (i < argc) { diff --git a/test/fonts.cxx b/test/fonts.cxx index 04e11ad75..58b4d361e 100644 --- a/test/fonts.cxx +++ b/test/fonts.cxx @@ -333,6 +333,7 @@ void create_the_forms() { int main(int argc, char **argv) { Fl::scheme(NULL); + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW Fl::args(argc, argv); Fl::get_system_colors(); create_the_forms(); diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx index e87c5e922..e7334e8b2 100644 --- a/test/help_dialog.cxx +++ b/test/help_dialog.cxx @@ -47,6 +47,7 @@ main(int argc, // I - Number of command-line arguments Fl_GIF_Image::animate = true; // create animated shared .GIF images Fl_Help_Dialog *help = new Fl_Help_Dialog; int i; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help); const char *fname = (i < argc) ? argv[i] : "help_dialog.html"; diff --git a/test/unittests.cxx b/test/unittests.cxx index 12776d670..6ffa24fb3 100644 --- a/test/unittests.cxx +++ b/test/unittests.cxx @@ -421,6 +421,7 @@ static int arg(int argc, char** argv, int& i) { // registered tests to the browser widget. int main(int argc, char** argv) { int i; + Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if ( Fl::args(argc,argv,i,arg) == 0 ) { // unsupported argument found static const char *msg = "usage: %s \n"