Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-12-20 22:42:26


"Jim Douglas" <jim_at_[hidden]> wrote in message
news:do8fsp$cfg$1_at_sea.gmane.org...
> This section in operations.cpp fails to compile -
>
> BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type
> remove_api( const std::string & ph )
> {
> # if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh)
> || defined(__APPLE__) || defined(__APPLE_CC__)))
> // Some Metrowerks C library versions fail on directories
> because of a
> // known Metrowerks coding error in ::remove. Workaround is to
> call
> // rmdir() or unlink() as indicated.
> // Same bug also reported for QNX, with the same fix.
> if ( (is_directory( ph )
> ? ::rmdir( ph.string().c_str() ) // **ERROR**
> : ::unlink( ph.string().c_str() )) != 0 ) // **ERROR**
> # else
>
> 'ph' is now std::string (it was a locally defined type 'path') and does
> not have a member function 'string()'. I suspect this is a hangover from
> the previous implementation. Should those lines perhaps now be -
>
> if ( (is_directory( ph )
> ? ::rmdir( ph.c_str() )
> : ::unlink( ph.c_str() )) != 0 )

Yes. Fixed in CVS.

> *********************************************************************
>
> This section near the end of operations.cpp completely defeats QNX6 as
> struct dirent does not have a member called d_type.
>
> # ifdef BOOST_FILESYSTEM_STATUS_CACHE
> ...
> if ( entry.d_type == DT_DIR ) sf = symlink_sf =
> fs::directory_flag;
> else if ( entry.d_type == DT_REG ) sf = symlink_sf =
> fs::file_flag;
> else if ( entry.d_type == DT_LNK )
> { sf = 0; symlink_sf = fs::symlink_flag; }
> else sf = symlink_sf = fs::other_flag;
> # else
>
> QNX does embody tests to determine the file (hence directory) type but
> they are based on a call to "stat( const char *path, struct stat buf )"
> and inspecting buf.st_mode with pre-defined macros e.g "S_IFDIR(
> buf.st_mode )" returns 1 if 'path' is a directory. This may be more
> portable?

BOOST_FILESYSTEM_STATUS_CACHE enables an optimization that applies to
Windows, Linux, and some systems derived from BSD. It is turned on with some
#if code starting about line 68 of operations.cpp. Apparently QNX must
define __ USE_BSD. I've added a !defined(__QNXNTO__) to the conditions. Let
me know if that doesn't fix the problem.

 ************************************************************************
>
> I am experiencing a blizzard of "comparison between signed and unsigned"
> warnings originating from path.hpp. They start at line 768 and they
> occur each time "size" is compared against a constant value. Sorry, I am
> not sure how to get rid of these warnings (in a portable way), but it
> would be a relief if they were to disappear :-)

Is this happening for all paths, or only wide-character paths?

If it is happening only on wide-character paths, my best guess is that it is
a clash between wchar_t and char, with one being signed and the other
unsized.

I'm at a loss if it is happening for narrow character paths. Unless... Ah
ha! Please look at the output from the config library's config_info test. Is
BOOST_NO_INCLASS_MEMBER_INITIALIZATION defined?

That causes BOOST_STATIC_CONSTANT to fallback to use an enum, and that might
have a different sign from char.

If that is the case, I'll try to think up a workaround.

Thanks for working on the QNX issues!

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk