Author: AlbrechtS
Date: 2009-07-23 15:36:04 -0700 (Thu, 23 Jul 2009)
New Revision: 6832
Log:
Fixed glibc 2.10 compiler problems (Fedora 11 and others) with scandir()
and strchr() (STR #2222).


Modified:
   branches/branch-1.1/CHANGES
   branches/branch-1.1/configh.in
   branches/branch-1.1/configure.in
   branches/branch-1.1/src/filename_list.cxx
   branches/branch-1.1/src/fl_set_fonts_xft.cxx

Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-07-19 19:21:40 UTC (rev 6831)
+++ branches/branch-1.1/CHANGES 2009-07-23 22:36:04 UTC (rev 6832)
@@ -1,5 +1,7 @@
 CHANGES IN FLTK 1.1.10
 
+       - Fixed glibc 2.10 compiler problems (Fedora 11 and others)
+         with scandir() and strchr() (STR #2222)
        - Fixed OpenGL shared context handling (STR #2135)
        - Fixed gray-scale images with alpha channel (STR #2105)
        - Fixed unexpected shortcut behavior for Win32 (STR #2199)

Modified: branches/branch-1.1/configh.in
===================================================================
--- branches/branch-1.1/configh.in      2009-07-19 19:21:40 UTC (rev 6831)
+++ branches/branch-1.1/configh.in      2009-07-23 22:36:04 UTC (rev 6832)
@@ -170,7 +170,8 @@
 #undef U64
 
 /*
- * HAVE_DIRENT_H, HAVE_SYS_NDIR_H, HAVE_SYS_DIR_H, HAVE_NDIR_H, HAVE_SCANDIR:
+ * HAVE_DIRENT_H, HAVE_SYS_NDIR_H, HAVE_SYS_DIR_H, HAVE_NDIR_H,
+ * HAVE_SCANDIR, HAVE_SCANDIR_POSIX:
  *
  * Where is <dirent.h> (used only by fl_file_chooser and scandir).
  */
@@ -180,6 +181,7 @@
 #undef HAVE_SYS_DIR_H
 #undef HAVE_NDIR_H
 #undef HAVE_SCANDIR
+#undef HAVE_SCANDIR_POSIX
 
 /*
  * Possibly missing sprintf-style functions:

Modified: branches/branch-1.1/configure.in
===================================================================
--- branches/branch-1.1/configure.in    2009-07-19 19:21:40 UTC (rev 6831)
+++ branches/branch-1.1/configure.in    2009-07-23 22:36:04 UTC (rev 6832)
@@ -375,6 +375,26 @@
     else
         AC_DEFINE(HAVE_SCANDIR)
     fi)
+
+dnl Do we have the POSIX compatible scandir() prototype?
+AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
+    ac_cv_cxx_scandir_posix,[
+       AC_LANG_SAVE
+       AC_LANG_CPLUSPLUS
+       AC_TRY_COMPILE([
+         #include <dirent.h>
+         int func (const char *d, dirent ***list, void *sort) {
+           int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent 
**))sort);
+         }
+       ],[
+       ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
+       AC_LANG_RESTORE
+    ])
+
+if test "$ac_cv_cxx_scandir_posix" = yes; then
+    AC_DEFINE(HAVE_SCANDIR_POSIX)
+fi
+
 AC_CHECK_FUNC(vsnprintf,[
     case "$uname" in
        HP-UX*)

Modified: branches/branch-1.1/src/filename_list.cxx
===================================================================
--- branches/branch-1.1/src/filename_list.cxx   2009-07-19 19:21:40 UTC (rev 
6831)
+++ branches/branch-1.1/src/filename_list.cxx   2009-07-23 22:36:04 UTC (rev 
6832)
@@ -54,8 +54,8 @@
                      Fl_File_Sort_F *sort) {
 #ifndef HAVE_SCANDIR
   int n = scandir(d, list, 0, sort);
-#elif defined(__hpux) || defined(__CYGWIN__)
-  // HP-UX, Cygwin define the comparison function like this:
+#elif defined(HAVE_SCANDIR_POSIX)
+  // POSIX (2008) defines the comparison function like this:
   int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
 #elif defined(__osf__)
   // OSF, DU 4.0x

Modified: branches/branch-1.1/src/fl_set_fonts_xft.cxx
===================================================================
--- branches/branch-1.1/src/fl_set_fonts_xft.cxx        2009-07-19 19:21:40 UTC 
(rev 6831)
+++ branches/branch-1.1/src/fl_set_fonts_xft.cxx        2009-07-23 22:36:04 UTC 
(rev 6832)
@@ -253,13 +253,13 @@
       // So the bit we want is up to the first comma - BUT some strings have
       // more than one name, separated by, guess what?, a comma...
       stop = start = first = 0;
-      stop = strchr((const char *)font, ',');
-      start = strchr((const char *)font, ':');
+      stop = strchr((char *)font, ',');
+      start = strchr((char *)font, ':');
       if ((stop) && (start) && (stop < start))
       {
         first = stop + 1; // discard first version of name
         // find first comma *after* the end of the name
-        stop = strchr((const char *)start, ',');
+        stop = strchr((char *)start, ',');
       }
       else
       {

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to