diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-05-20 00:01:06 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2007-05-20 00:01:06 +0000 |
| commit | 73d01dd659f82f2c53fd7cedcf0bbb8d47f70ab2 (patch) | |
| tree | 946d3744f22b87faf22f32cac8eed8619e53be55 /src | |
| parent | 9ca173a7020ca6a7daab001b71dfc6e84f149429 (diff) | |
Fix all compiler warnings from various build systems.
Fix vsnprintf() implementation to properly handle long and long long ints.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5845 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_GIF_Image.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_JPEG_Image.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Scrollbar.cxx | 1 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_Tooltip.cxx | 6 | ||||
| -rw-r--r-- | src/fl_call_main.c | 32 | ||||
| -rw-r--r-- | src/fl_images_core.cxx | 2 | ||||
| -rw-r--r-- | src/freeglut_stroke_mono_roman.cxx | 2 | ||||
| -rw-r--r-- | src/freeglut_stroke_roman.cxx | 2 | ||||
| -rw-r--r-- | src/glut_compatability.cxx | 1 | ||||
| -rw-r--r-- | src/screen_xywh.cxx | 5 | ||||
| -rw-r--r-- | src/vsnprintf.c | 14 |
12 files changed, 44 insertions, 35 deletions
diff --git a/src/Fl_GIF_Image.cxx b/src/Fl_GIF_Image.cxx index e40a9d218..9666896cd 100644 --- a/src/Fl_GIF_Image.cxx +++ b/src/Fl_GIF_Image.cxx @@ -153,7 +153,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { char bits; bits = NEXTBYTE; - char junk = NEXTBYTE; junk = NEXTBYTE; // GETSHORT(delay); + getc(GifFile); getc(GifFile); // GETSHORT(delay); transparent_pixel = NEXTBYTE; if (bits & 1) has_transparent = 1; blocklen = NEXTBYTE; diff --git a/src/Fl_JPEG_Image.cxx b/src/Fl_JPEG_Image.cxx index a3eda8498..13889000a 100644 --- a/src/Fl_JPEG_Image.cxx +++ b/src/Fl_JPEG_Image.cxx @@ -79,12 +79,10 @@ extern "C" { static void fl_jpeg_error_handler(j_common_ptr dinfo) { // I - Decompressor info longjmp(((fl_jpeg_error_mgr *)(dinfo->err))->errhand_, 1); - return; } static void - fl_jpeg_output_handler(j_common_ptr dinfo) { // I - Decompressor info - return; + fl_jpeg_output_handler(j_common_ptr) { // I - Decompressor info (not used) } } #endif // HAVE_LIBJPEG diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx index 4ee2dc786..22a05c84b 100644 --- a/src/Fl_Scrollbar.cxx +++ b/src/Fl_Scrollbar.cxx @@ -139,7 +139,6 @@ int Fl_Scrollbar::handle(int event) { handle_drag(clamp(value() + linesize_ * Fl::e_dy)); return 1; } - break; case FL_SHORTCUT: case FL_KEYBOARD: { int v = value(); diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 26bfd45b4..61c401d19 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1148,7 +1148,7 @@ int Fl_Text_Display::rewind_lines(int startPos, int nLines) { return buf->rewind_lines(startPos, nLines); pos = startPos; - while (true) { + for (;;) { lineStart = buf->line_start(pos); wrapped_line_counter(buf, lineStart, pos, INT_MAX, true, 0, &retPos, &retLines, &retLineStart, &retLineEnd, false); @@ -2255,7 +2255,7 @@ void Fl_Text_Display::h_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) { ** stray marks outside of the character cell area, which might have been ** left from before a resize or font change. */ -void Fl_Text_Display::draw_line_numbers(bool clearAll) { +void Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) { #if 0 // FIXME: don't want this yet, so will leave for another time @@ -2447,7 +2447,7 @@ void Fl_Text_Display::find_wrap_range(const char *deletedText, int pos, */ lineStart = countFrom; *modRangeStart = countFrom; - while (true) { + for (;;) { /* advance to the next line. If the line ended in a real newline or the end of the buffer, that's far enough */ @@ -2595,7 +2595,7 @@ void Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) { ** line starts to re-sync with the original line starts array */ lineStart = countFrom; - while (true) { + for (;;) { /* advance to the next line. If the line ended in a real newline or the end of the buffer, that's far enough */ wrapped_line_counter(buf, lineStart, buf->length(), 1, true, 0, diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index acba0be7d..0eb407158 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -60,7 +60,7 @@ public: Fl_Widget* Fl_Tooltip::widget_ = 0; static Fl_TooltipBox *window = 0; -static int X,Y,W,H; +static int Y,H; void Fl_TooltipBox::layout() { fl_font(Fl_Tooltip::font(), Fl_Tooltip::size()); @@ -71,10 +71,8 @@ void Fl_TooltipBox::layout() { // find position on the screen of the widget: int ox = Fl::event_x_root(); - //int ox = X+W/2; int oy = Y + H+2; for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) { - //ox += p->x(); oy += p->y(); } int scr_x, scr_y, scr_w, scr_h; @@ -224,7 +222,7 @@ Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t) Fl::remove_timeout(tooltip_timeout); Fl::remove_timeout(recent_timeout); // remember it: - widget_ = wid; X = x; Y = y; W = w; H = h; tip = t; + widget_ = wid; Y = y; H = h; tip = t; // popup the tooltip immediately if it was recently up: if (recent_tooltip) { if (window) window->hide(); diff --git a/src/fl_call_main.c b/src/fl_call_main.c index e29f5853e..563d9652b 100644 --- a/src/fl_call_main.c +++ b/src/fl_call_main.c @@ -48,26 +48,26 @@ #if defined(WIN32) && !defined(FL_DLL) && !defined (__GNUC__) -#include <windows.h> -#include <stdio.h> -#include <stdlib.h> +# include <windows.h> +# include <stdio.h> +# include <stdlib.h> -#ifdef __MWERKS__ -# include <crtl.h> -#endif +# ifdef __MWERKS__ +# include <crtl.h> +# endif extern int main(int, char *[]); -#ifdef BORLAND5 -# define __argc _argc -# define __argv _argv -#endif +# ifdef BORLAND5 +# define __argc _argc +# define __argv _argv +# endif /* BORLAND5 */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int rc; -#ifdef _DEBUG +# ifdef _DEBUG /* * If we are using compiling in debug mode, open a console window so * we can see any printf's, etc... @@ -82,24 +82,24 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, freopen("conin$", "r", stdin); freopen("conout$", "w", stdout); freopen("conout$", "w", stderr); -#endif /* _DEBUG */ +# endif /* _DEBUG */ /* Run the standard main entry point function... */ rc = main(__argc, __argv); -#ifdef _DEBUG +# ifdef _DEBUG fclose(stdin); fclose(stdout); fclose(stderr); -#endif /* _DEBUG */ +# endif /* _DEBUG */ return rc; } -#else +#elif defined(__future_compiler_test) /* This code to prevent "empty translation unit" or similar warnings... */ static void dummy(void) {} -#endif +#endif // WIN32 && !FL_DLL && !__GNUC__ /* * End of "$Id$". diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index 21f6f0856..7caf95e0b 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -69,7 +69,7 @@ void fl_register_images() { Fl_Image * // O - Image, if found fl_check_images(const char *name, // I - Filename uchar *header, // I - Header data from file - int headerlen) { // I - Amount of data + int) { // I - Amount of data (not used) if (memcmp(header, "GIF87a", 6) == 0 || memcmp(header, "GIF89a", 6) == 0) // GIF file return new Fl_GIF_Image(name); diff --git a/src/freeglut_stroke_mono_roman.cxx b/src/freeglut_stroke_mono_roman.cxx index 61d186274..f26289ba2 100644 --- a/src/freeglut_stroke_mono_roman.cxx +++ b/src/freeglut_stroke_mono_roman.cxx @@ -2845,4 +2845,4 @@ static const Fl_Glut_StrokeChar *chars[] = &ch120, &ch121, &ch122, &ch123, &ch124, &ch125, &ch126, &ch127 }; -Fl_Glut_StrokeFont glutStrokeMonoRoman = {"MonoRoman",128,152.381f,chars}; +Fl_Glut_StrokeFont glutStrokeMonoRoman = {(char *)"MonoRoman",128,152.381f,chars}; diff --git a/src/freeglut_stroke_roman.cxx b/src/freeglut_stroke_roman.cxx index b6cf398ad..deda2d05d 100644 --- a/src/freeglut_stroke_roman.cxx +++ b/src/freeglut_stroke_roman.cxx @@ -2845,4 +2845,4 @@ static const Fl_Glut_StrokeChar *chars[] = &ch120, &ch121, &ch122, &ch123, &ch124, &ch125, &ch126, &ch127 }; -Fl_Glut_StrokeFont glutStrokeRoman = {"Roman",128,152.381f,chars}; +Fl_Glut_StrokeFont glutStrokeRoman = {(char *)"Roman",128,152.381f,chars}; diff --git a/src/glut_compatability.cxx b/src/glut_compatability.cxx index 52bedf12a..8fe7ca900 100644 --- a/src/glut_compatability.cxx +++ b/src/glut_compatability.cxx @@ -106,7 +106,6 @@ int Fl_Glut_Window::handle(int event) { while (button < 0) {mouse(3,GLUT_DOWN,ex,ey); ++button;} while (button > 0) {mouse(4,GLUT_DOWN,ex,ey); --button;} return 1; - break; case FL_RELEASE: for (button = 0; button < 3; button++) if (mouse_down & (1<<button)) { diff --git a/src/screen_xywh.cxx b/src/screen_xywh.cxx index c38a7ec96..67694ca4c 100644 --- a/src/screen_xywh.cxx +++ b/src/screen_xywh.cxx @@ -201,6 +201,9 @@ void Fl::screen_xywh(int &x, int &y, int &w, int &h, int mx, int my) { } } } +#else + (void)mx; + (void)my; #endif // WIN32 x = Fl::x(); @@ -237,6 +240,8 @@ void Fl::screen_xywh(int &x, int &y, int &w, int &h, int n) { h = screens[n].height; return; } +#else + (void)n; #endif // WIN32 x = Fl::x(); diff --git a/src/vsnprintf.c b/src/vsnprintf.c index 8d1752b91..184e1ed24 100644 --- a/src/vsnprintf.c +++ b/src/vsnprintf.c @@ -3,7 +3,7 @@ * * snprintf() and vsnprintf() functions for the Fast Light Tool Kit (FLTK). * - * Copyright 1998-2005 by Bill Spitzak and others. + * Copyright 1998-2007 by Bill Spitzak and others. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -108,6 +108,8 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { } } else prec = -1; + size = '\0'; + if (*format == 'l' && format[1] == 'l') { size = 'L'; if (tptr < (tformat + sizeof(tformat) - 2)) { @@ -159,7 +161,15 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { case 'x' : if ((width + 2) > sizeof(temp)) break; - sprintf(temp, tformat, va_arg(ap, int)); +#ifdef HAVE_LONg_LONG + if (size == 'L') + sprintf(temp, tformat, va_arg(ap, long long)); + else +#endif /* HAVE_LONG_LONG */ + if (size == 'l') + sprintf(temp, tformat, va_arg(ap, long)); + else + sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); |
