From c8c1f51db7bd89291d2f7552e82e3724fcdaec8b Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 30 Aug 2021 23:23:59 +0200 Subject: [PATCH] Fix MSVC "fileno" warnings in fluid --- fluid/alignment_panel.fl | 4 +--- fluid/fluid.cxx | 17 ++++++++++++++--- fluid/widget_panel.fl | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index cb9b1112f..20b09b575 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -764,8 +764,7 @@ Default is on.} xywh {245 366 100 25} down_box BORDER_BOX } } } - - Fl_Group {} { + Fl_Group {} { label {Scaling Factor Options} open xywh {10 421 380 66} box GTK_DOWN_BOX labelfont 2 align 21 } { @@ -797,7 +796,6 @@ Default is on.} xywh {245 442 100 25} down_box BORDER_BOX } } } - Fl_Choice wUserOrSystem { callback {refreshUI();} open tooltip {Change settings for the current user, or default values for all users of this computer. Individual users can override system options, if they set their options to specific values (not 'default').} xywh {10 496 141 25} down_box BORDER_BOX diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 0e12bba4d..0c1647b48 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1347,9 +1347,20 @@ public: //not necessary here: FILE * fl_fopen (const char *file, const char *mode="r"); int close(); - FILE * desc() const { return _fpt;} // non null if file is open + FILE * desc() const { return _fpt;} // non-null if file is open char * get_line(char * line, size_t s) const {return _fpt ? fgets(line, (int)s, _fpt) : NULL;} + // returns fileno(FILE*): + // (file must be open, i.e. _fpt must be non-null) + // *FIXME* we should find a better solution for the 'fileno' issue + int fileno() const { +#ifdef _MSC_VER + return _fileno(_fpt); // suppress MSVC warning +#else + return ::fileno(_fpt); +#endif + } // non null if file is open + #if defined(_WIN32) && !defined(__CYGWIN__) protected: HANDLE pin[2], pout[2], perr[2]; @@ -1490,7 +1501,7 @@ shell_pipe_cb(FL_SOCKET, void*) { shell_run_terminal->append(line); } else { // End of file; tell the parent... - Fl::remove_fd(fileno(s_proc.desc())); + Fl::remove_fd(s_proc.fileno()); s_proc.close(); shell_run_terminal->append("... END SHELL COMMAND ...\n"); } @@ -1526,7 +1537,7 @@ do_shell_command(Fl_Return_Button*, void*) { } shell_run_window->show(); - Fl::add_fd(fileno(s_proc.desc()), shell_pipe_cb); + Fl::add_fd(s_proc.fileno(), shell_pipe_cb); while (s_proc.desc()) Fl::wait(); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index ab4516148..38a5b34e8 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -134,7 +134,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te } { MenuItem {} { label { Image Alignment } - user_data (fl_intptr_t)0xFFFFFFFF + user_data {(fl_intptr_t)0xFFFFFFFF} xywh {145 145 100 20} labelfont 2 labelsize 11 deactivate } MenuItem {} {