FLTK logo

Re: [fltk/fltk] fl_scandir && scandir_posix.c (#183)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] fl_scandir && scandir_posix.c (#183) Albrecht Schlosser Feb 14, 2021  
 

@markjolesen I'm not sure I understand your statements. I analyzed the code and came to this conclusion (please correct me if I misunderstood something or my conclusion is wrong):

Our only "use case" is to build the FLTK library and fl_scandir() is not part of the public API. You wrote:

if USE_X11 is defined but HAVE_SCANDIR is undefined, you will get a linker error because fl_scandiir is not implemented

That's obviously wrong (maybe a typo?) because the condition is:
#if defined(USE_X11) && !defined(HAVE_SCANDIR)

... but anyway: this is the only condition when fl_scandir() needs to be defined. It is called exactly once in Fl_X11_System_Driver.cxx, line 485:

Fl_X11_System_Driver.cxx-483-#ifndef HAVE_SCANDIR
Fl_X11_System_Driver.cxx-484-  // This version is when we define our own scandir. Note it updates errmsg on errors.
Fl_X11_System_Driver.cxx:485:  int n = fl_scandir(dirloc, list, 0, sort, errmsg, errmsg_sz);
Fl_X11_System_Driver.cxx-486-#elif defined(HAVE_SCANDIR_POSIX)
Fl_X11_System_Driver.cxx-487-  // POSIX (2008) defines the comparison function like this:
Fl_X11_System_Driver.cxx-488-  int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort);
Fl_X11_System_Driver.cxx-489-#elif defined(__osf__)
. . .

The (otherwise) "empty" #else case at the end of the file has this dummy typedef only to silence a compiler warning. So I am pretty sure there's nothing wrong with the code as-is. Note also that this file is only compiled if USE_X11 is defined (this condition could be removed, it's a leftover from previous versions).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.