From 70c4cd102f437a1379a66b036cd0f26837d003ea Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 14 Apr 2005 13:56:07 +0000 Subject: [PATCH] Fix compiler warnings. Use fl_yes and fl_no for the Forms emulation, instead of the hardcoded strings. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4283 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/forms.H | 2 +- fluid/fluid.cxx | 8 ++++---- src/Fl_Gl_Window.cxx | 4 +++- src/Fl_win32.cxx | 6 +++--- src/scandir_win32.c | 8 ++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/FL/forms.H b/FL/forms.H index 46409772a..672b9c813 100644 --- a/FL/forms.H +++ b/FL/forms.H @@ -645,7 +645,7 @@ fl_add_free(int t,double x,double y,double w,double h,const char* l, #include "fl_ask.H" #include "fl_show_colormap.H" -inline int fl_show_question(const char* c, int = 0) {return fl_choice(c,"No","Yes",0L);} +inline int fl_show_question(const char* c, int = 0) {return fl_choice("%s",fl_no,fl_yes,0L,c);} FL_EXPORT void fl_show_message(const char *,const char *,const char *); FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0); FL_EXPORT int fl_show_question(const char *,const char *,const char *); diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index c1b0799e7..2f7ebfbb9 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -982,10 +982,10 @@ void print_menu_cb(Fl_Widget *, void *) { fl_draw(basename, 0, fontsize); - fl_draw(date, 0.5 * (width - fl_width(date)), fontsize); + fl_draw(date, (width - (int)fl_width(date)) / 2, fontsize); sprintf(buffer, "%d/%d", winpage + 1, num_windows); - fl_draw(buffer, width - fl_width(buffer), fontsize); + fl_draw(buffer, width - (int)fl_width(buffer), fontsize); // Get window image... uchar *pixels; // Window image data @@ -1000,8 +1000,8 @@ void print_menu_cb(Fl_Widget *, void *) { // Figure out the window size, first at 100 PPI and then scaled // down if that is too big... - ww = w * xdpi / 100.0; - hh = h * ydpi / 100.0; + ww = w * xdpi / 100; + hh = h * ydpi / 100; if (ww > width) { ww = width; diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index ac2ed93a3..e9f7de202 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -95,8 +95,10 @@ int Fl_Gl_Window::mode(int m, const int *a) { if (m == mode_ && a == alist) return 0; #ifndef __APPLE__ int oldmode = mode_; +#endif // !__APPLE__ +#if !defined(WIN32) && !defined(__APPLE__) Fl_Gl_Choice* oldg = g; -#endif +#endif // !WIN32 && !__APPLE__ context(0); mode_ = m; alist = a; if (shown()) { diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index c3764c7ca..d9886d2cf 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -158,9 +158,9 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) { if (events & POLLERR) mask |= FD_CLOSE; WSAAsyncSelect(n, fl_window, WM_FLSELECT, mask); #else - if (events & POLLIN) FD_SET(n, &fdsets[0]); - if (events & POLLOUT) FD_SET(n, &fdsets[1]); - if (events & POLLERR) FD_SET(n, &fdsets[2]); + if (events & POLLIN) FD_SET((unsigned)n, &fdsets[0]); + if (events & POLLOUT) FD_SET((unsigned)n, &fdsets[1]); + if (events & POLLERR) FD_SET((unsigned)n, &fdsets[2]); if (n > maxfd) maxfd = n; #endif // USE_ASYNC_SELECT } diff --git a/src/scandir_win32.c b/src/scandir_win32.c index 1bf9fe7dc..e5b11ba6e 100644 --- a/src/scandir_win32.c +++ b/src/scandir_win32.c @@ -43,7 +43,7 @@ int fl_scandir(const char *dirname, struct dirent ***namelist, unsigned long ret; len = strlen(dirname); - findIn = (char *)malloc(len+5); + findIn = (char *)malloc((size_t)(len+5)); if (!findIn) return -1; @@ -72,7 +72,7 @@ int fl_scandir(const char *dirname, struct dirent ***namelist, } if (!select || (*select)(selectDir)) { if (nDir==NDir) { - struct dirent **tempDir = (struct dirent **)calloc(sizeof(struct dirent*), NDir+33); + struct dirent **tempDir = (struct dirent **)calloc(sizeof(struct dirent*), (size_t)(NDir+33)); if (NDir) memcpy(tempDir, dir, sizeof(struct dirent*)*NDir); if (dir) free(dir); dir = tempDir; @@ -94,8 +94,8 @@ int fl_scandir(const char *dirname, struct dirent ***namelist, free (findIn); - if (compar) qsort (dir, nDir, sizeof(*dir), - (int(*)(const void*, const void*))compar); + if (compar) qsort(dir, (size_t)nDir, sizeof(*dir), + (int(*)(const void*, const void*))compar); *namelist = dir; return nDir;