Fix compiler warnings, backported from 1.4 (master)

Also update CHANGES file.

The compiler warnings were issued by MinGW with gcc 9.2.0.

Note: There are lots of compiler warnings left when building with
  Visual Studio and/or NMake but these will not be fixed in 1.3.9.
  All warnings have been fixed in 1.4.0 (current git 'master').
This commit is contained in:
Albrecht Schlosser
2023-12-07 19:29:31 +01:00
parent de55cd522a
commit c17d42c7e7
3 changed files with 17 additions and 10 deletions
+9 -1
View File
@@ -8,6 +8,8 @@ Highlights in this release:
- Update bundled libraries to current versions. - Update bundled libraries to current versions.
- Introduce bundled image library "prefixing" to avoid conflicts - Introduce bundled image library "prefixing" to avoid conflicts
with system libraries. with system libraries.
- New CMake option FLTK_MSVC_RUNTIME_DLL selects Visual Studio
Runtime (DLL or static) if built with CMake 3.15 or later
Details: Details:
@@ -28,6 +30,7 @@ Details:
Fix several compiler warnings Fix several compiler warnings
Update bundled image libraries and zlib to current versions Update bundled image libraries and zlib to current versions
Update README, README.CMake.txt, and some support files Update README, README.CMake.txt, and some support files
Fix compiler warnings: backported from 1.4 (git 'master')
ManoloFLTK: ManoloFLTK:
macOS platform: Issue #325 "Disabling IM disables Greek and Cyrillic layouts" macOS platform: Issue #325 "Disabling IM disables Greek and Cyrillic layouts"
@@ -35,11 +38,16 @@ Details:
Fix issue #373 apparent with macOS platform and SDK ≤ 10.13 Fix issue #373 apparent with macOS platform and SDK ≤ 10.13
Issue #452: Fl::get_font_name failure on OS-X. Issue #452: Fl::get_font_name failure on OS-X.
Issue #454: crash in Fl::get_font_name(). Issue #454: crash in Fl::get_font_name().
Issue #469: Fl_Sys_Menu_Bar menu item shortcuts using Escape or Tab don't work on Mac Issue #469: Fl_Sys_Menu_Bar menu item shortcuts using Esc or Tab don't work on Mac
Fix "Focus is lost leaving full screen on macOS 13" (#608) Fix "Focus is lost leaving full screen on macOS 13" (#608)
Add support of macOS Ventura 13.0 and macOS Sonoma 14.0 Add support of macOS Ventura 13.0 and macOS Sonoma 14.0
macOS: remove configure option --enable-x11 and CMake OPTION_APPLE_X11; macOS: remove configure option --enable-x11 and CMake OPTION_APPLE_X11;
this functionality remains in FLTK 1.4. this functionality remains in FLTK 1.4.
configure.ac: make sure local-png and local-zlib always run together
Remove the -mwindows argument from CFLAGS and CXXFLAGS
Matthias Melcher:
Issue #188: Fix reference counts and search for Fl_Shared_Image original
YX: YX:
Fix IME problem (issue #270) Fix IME problem (issue #270)
+6 -7
View File
@@ -120,12 +120,11 @@ static void dnullcat(char*&wp, const char *string, int n = -1 ) {
} }
} }
if ( n == -1 ) n = (int) strlen(string); memcpy(wp2, string, inlen); // use memcpy to avoid compiler warning
strncpy(wp2, string, n);
// Leave string double-null terminated // Leave string double-null terminated
*(wp2+n+0) = '\0'; *(wp2+inlen+0) = '\0';
*(wp2+n+1) = '\0'; *(wp2+inlen+1) = '\0';
//DEBUG printf("DEBUG: dnullcat OUT: <"); dnullprint(wp); printf(">\n\n"); //DEBUG printf("DEBUG: dnullcat OUT: <"); dnullprint(wp); printf(">\n\n");
} }
@@ -691,12 +690,12 @@ void Fl_Native_File_Chooser::add_filter(const char *name_in, // name of filter (
// No name? Make one.. // No name? Make one..
char name[1024]; char name[1024];
if ( !name_in || name_in[0] == '\0' ) { if ( !name_in || name_in[0] == '\0' ) {
sprintf(name, "%.*s Files", int(sizeof(name)-10), winfilter); snprintf(name, sizeof(name), "%.*s Files", int(sizeof(name)-10), winfilter);
} else { } else {
if ((strlen(name_in)+strlen(winfilter)+3) < sizeof(name)) { if ((strlen(name_in)+strlen(winfilter)+3) < sizeof(name)) {
sprintf(name, "%s (%s)", name_in, winfilter); snprintf(name, sizeof(name), "%s (%s)", name_in, winfilter);
} else { } else {
sprintf(name, "%.*s", int(sizeof(name)), name_in); snprintf(name, sizeof(name), "%.*s", int(sizeof(name))-1, name_in);
} }
} }
dnullcat(_parsedfilt, name); dnullcat(_parsedfilt, name);
+2 -2
View File
@@ -47,8 +47,8 @@ void fl_gettime(long* sec, long* usec) {
*sec = now->tm_sec + 60*now->tm_min + 3600*now->tm_hour + 24*3600*now->tm_yday; *sec = now->tm_sec + 60*now->tm_min + 3600*now->tm_hour + 24*3600*now->tm_yday;
*usec = 0; *usec = 0;
# else # else
struct timeb tp; struct _timeb tp;
ftime(&tp); _ftime(&tp);
*sec = (long) tp.time; *sec = (long) tp.time;
*usec = tp.millitm * 1000; *usec = tp.millitm * 1000;
# endif # endif