summaryrefslogtreecommitdiff
path: root/fluid/fluid.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-08-30 23:23:59 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-08-30 23:45:16 +0200
commitc8c1f51db7bd89291d2f7552e82e3724fcdaec8b (patch)
treeae57c37b0d1af582cf2efcb06b0f5cb8f21997f4 /fluid/fluid.cxx
parent1a8b94162da0a9eab88813d6b1928b483b7990eb (diff)
Fix MSVC "fileno" warnings in fluid
Diffstat (limited to 'fluid/fluid.cxx')
-rw-r--r--fluid/fluid.cxx17
1 files changed, 14 insertions, 3 deletions
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();