summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-11-24 20:33:19 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-24 20:35:17 (GMT)
commit332d60c56dfaa11fdd135088279d15cd5983b3d4 (patch)
treedd77717a4e1732da929d5ff8a0471fa3f005e201 /3rdParty/Boost/src/libs
parent90c44a10fec26d2a0935b2d62e82b6a5be028373 (diff)
downloadswift-332d60c56dfaa11fdd135088279d15cd5983b3d4.zip
swift-332d60c56dfaa11fdd135088279d15cd5983b3d4.tar.bz2
Upgraded Boost to 1.45.0.
Diffstat (limited to '3rdParty/Boost/src/libs')
-rw-r--r--3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.hpp24
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/src/operations.cpp)168
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/src/path.cpp)36
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/src/portability.cpp)14
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp93
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp1897
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp807
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp209
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp128
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp151
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/utf8_codecvt_facet.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.cpp)5
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp79
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp56
-rw-r--r--3rdParty/Boost/src/libs/program_options/src/options_description.cpp7
-rw-r--r--3rdParty/Boost/src/libs/program_options/src/winmain.cpp6
-rw-r--r--3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp10
-rw-r--r--3rdParty/Boost/src/libs/regex/src/cregex.cpp3
-rw-r--r--3rdParty/Boost/src/libs/regex/src/icu.cpp22
-rw-r--r--3rdParty/Boost/src/libs/regex/src/regex.cpp3
-rw-r--r--3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp2
-rw-r--r--3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp108
-rw-r--r--3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp10
-rw-r--r--3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp4
-rw-r--r--3rdParty/Boost/src/libs/system/src/error_code.cpp45
-rw-r--r--3rdParty/Boost/src/libs/system/src/local_free_on_destruction.hpp40
-rw-r--r--3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp35
-rw-r--r--3rdParty/Boost/src/libs/thread/src/tss_null.cpp6
-rw-r--r--3rdParty/Boost/src/libs/thread/src/win32/thread.cpp88
-rw-r--r--3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp18
-rw-r--r--3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp78
30 files changed, 3825 insertions, 327 deletions
diff --git a/3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.hpp b/3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.hpp
deleted file mode 100644
index 3b78fb1..0000000
--- a/3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
-// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
-
-// Distributed under the Boost Software License, Version 1.0.
-// (See http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
-#define BOOST_FILESYSTEM_UTF8_CODECVT_FACET_HPP
-
-#include <boost/filesystem/config.hpp>
-
-#define BOOST_UTF8_BEGIN_NAMESPACE \
- namespace boost { namespace filesystem { namespace detail {
-
-#define BOOST_UTF8_END_NAMESPACE }}}
-#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL
-
-#include <boost/detail/utf8_codecvt_facet.hpp>
-
-#undef BOOST_UTF8_BEGIN_NAMESPACE
-#undef BOOST_UTF8_END_NAMESPACE
-#undef BOOST_UTF8_DECL
-
-#endif
diff --git a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp
index d0655b9..10df199 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp
@@ -12,15 +12,14 @@
// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
-#define BOOST_FILESYSTEM_SOURCE
+#define BOOST_FILESYSTEM_SOURCE
-#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this
-
-// enable the XPG-compliant version of readdir_r() on AIX
-#if defined(_AIX)
-# define _LINUX_SOURCE_COMPAT
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
#endif
+#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this
+
#if !(defined(__HP_aCC) && defined(_ILP32) && \
!defined(_STATVFS_ACPP_PROBLEMS_FIXED))
#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
@@ -43,12 +42,13 @@
#endif
-#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/v2/operations.hpp>
#include <boost/scoped_array.hpp>
#include <boost/throw_exception.hpp>
#include <boost/detail/workaround.hpp>
+#include <cstdlib> // for malloc, free
-namespace fs = boost::filesystem;
+namespace fs = boost::filesystem2;
using boost::system::error_code;
using boost::system::system_category;
@@ -122,7 +122,7 @@ namespace
inline DWORD get_file_attributes( const char * ph )
{ return ::GetFileAttributesA( ph ); }
-# ifndef BOOST_FILESYSTEM_NARROW_ONLY
+# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
inline DWORD get_file_attributes( const wchar_t * ph )
{ return ::GetFileAttributesW( ph ); }
@@ -180,7 +180,7 @@ namespace
{ return ::CreateHardLinkW( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; }
#endif
-# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
+# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
template< class String >
fs::file_status status_template( const String & ph, error_code & ec )
@@ -188,11 +188,12 @@ namespace
DWORD attr( get_file_attributes( ph.c_str() ) );
if ( attr == 0xFFFFFFFF )
{
- ec = error_code( ::GetLastError(), system_category );
+ ec = error_code( ::GetLastError(), system_category() );
if ((ec.value() == ERROR_FILE_NOT_FOUND)
|| (ec.value() == ERROR_PATH_NOT_FOUND)
|| (ec.value() == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo"
|| (ec.value() == ERROR_INVALID_DRIVE) // USB card reader with no card inserted
+ || (ec.value() == ERROR_NOT_READY) // CD/DVD drive with no disc inserted
|| (ec.value() == ERROR_INVALID_PARAMETER) // ":sys:stat.h"
|| (ec.value() == ERROR_BAD_PATHNAME) // "//nosuch" on Win64
|| (ec.value() == ERROR_BAD_NETPATH)) // "//nosuch" on Win32
@@ -220,12 +221,12 @@ namespace
{ return ::GetFileAttributesExA( ph, ::GetFileExInfoStandard, &fad ); }
template< class String >
- boost::filesystem::detail::query_pair
+ boost::filesystem2::detail::query_pair
is_empty_template( const String & ph )
{
WIN32_FILE_ATTRIBUTE_DATA fad;
if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 )
- return std::make_pair( error_code( ::GetLastError(), system_category ), false );
+ return std::make_pair( error_code( ::GetLastError(), system_category() ), false );
return std::make_pair( ok,
( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
? is_empty_directory( ph )
@@ -258,7 +259,7 @@ namespace
};
template< class String >
- boost::filesystem::detail::query_pair
+ boost::filesystem2::detail::query_pair
equivalent_template( const String & ph1, const String & ph2 )
{
// Note well: Physical location on external media is part of the
@@ -295,14 +296,14 @@ namespace
{ return std::make_pair( ok, false ); }
assert( p1.handle == INVALID_HANDLE_VALUE
&& p2.handle == INVALID_HANDLE_VALUE );
- { return std::make_pair( error_code( error1, system_category), false ); }
+ { return std::make_pair( error_code( error1, system_category()), false ); }
}
// at this point, both handles are known to be valid
BY_HANDLE_FILE_INFORMATION info1, info2;
if ( !::GetFileInformationByHandle( p1.handle, &info1 ) )
- { return std::make_pair( error_code( ::GetLastError(), system_category ), false ); }
+ { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); }
if ( !::GetFileInformationByHandle( p2.handle, &info2 ) )
- { return std::make_pair( error_code( ::GetLastError(), system_category ), false ); }
+ { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); }
// In theory, volume serial numbers are sufficient to distinguish between
// devices, but in practice VSN's are sometimes duplicated, so last write
// time and file size are also checked.
@@ -319,15 +320,15 @@ namespace
}
template< class String >
- boost::filesystem::detail::uintmax_pair
+ boost::filesystem2::detail::uintmax_pair
file_size_template( const String & ph )
{
WIN32_FILE_ATTRIBUTE_DATA fad;
// by now, intmax_t is 64-bits on all Windows compilers
if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 )
- return std::make_pair( error_code( ::GetLastError(), system_category ), 0 );
+ return std::make_pair( error_code( ::GetLastError(), system_category() ), 0 );
if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 )
- return std::make_pair( error_code( ERROR_FILE_NOT_FOUND, system_category), 0 );
+ return std::make_pair( error_code( ERROR_FILE_NOT_FOUND, system_category()), 0 );
return std::make_pair( ok,
(static_cast<boost::uintmax_t>(fad.nFileSizeHigh)
<< (sizeof(fad.nFileSizeLow)*8))
@@ -339,11 +340,11 @@ namespace
{ return ::GetDiskFreeSpaceExA( ph.c_str(), avail, total, free ) != 0; }
template< class String >
- boost::filesystem::detail::space_pair
+ boost::filesystem2::detail::space_pair
space_template( String & ph )
{
ULARGE_INTEGER avail, total, free;
- boost::filesystem::detail::space_pair result;
+ boost::filesystem2::detail::space_pair result;
if ( get_free_disk_space( ph, &avail, &total, &free ) )
{
result.first = ok;
@@ -359,7 +360,7 @@ namespace
}
else
{
- result.first = error_code( ::GetLastError(), system_category );
+ result.first = error_code( ::GetLastError(), system_category() );
result.second.capacity = result.second.free
= result.second.available = 0;
}
@@ -380,7 +381,7 @@ namespace
typedef typename String::value_type value_type;
boost::scoped_array<value_type> buf( new value_type[sz] );
if ( get_current_directory( sz, buf.get() ) == 0 )
- return error_code( ::GetLastError(), system_category );
+ return error_code( ::GetLastError(), system_category() );
ph = buf.get();
return ok;
}
@@ -393,7 +394,7 @@ namespace
set_current_path_template( const String & ph )
{
return error_code( set_current_directory( ph.c_str() )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
inline std::size_t get_full_path_name(
@@ -414,13 +415,13 @@ namespace
typename String::value_type * pfn;
std::size_t len = get_full_path_name( ph,
buf_size , buf, &pfn );
- if ( len == 0 ) return error_code( ::GetLastError(), system_category );
+ if ( len == 0 ) return error_code( ::GetLastError(), system_category() );
if ( len > buf_size )
{
typedef typename String::value_type value_type;
boost::scoped_array<value_type> big_buf( new value_type[len] );
if ( (len=get_full_path_name( ph, len , big_buf.get(), &pfn ))
- == 0 ) return error_code( ::GetLastError(), system_category );
+ == 0 ) return error_code( ::GetLastError(), system_category() );
big_buf[len] = '\0';
target = big_buf.get();
return ok;
@@ -439,9 +440,9 @@ namespace
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
if ( hw.handle == INVALID_HANDLE_VALUE )
- return error_code( ::GetLastError(), system_category );
+ return error_code( ::GetLastError(), system_category() );
return error_code( ::GetFileTime( hw.handle, 0, 0, &last_write_time ) != 0
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
template<class String>
@@ -453,9 +454,9 @@ namespace
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) );
if ( hw.handle == INVALID_HANDLE_VALUE )
- return error_code( ::GetLastError(), system_category );
+ return error_code( ::GetLastError(), system_category() );
return error_code( ::SetFileTime( hw.handle, 0, 0, &last_write_time ) != 0
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
// these constants come from inspecting some Microsoft sample code
@@ -486,7 +487,7 @@ namespace
}
template<class String>
- boost::filesystem::detail::time_pair
+ boost::filesystem2::detail::time_pair
last_write_time_template( const String & ph )
{
FILETIME lwt;
@@ -525,11 +526,11 @@ namespace
if ( fs::is_directory( sf ) )
{
if ( !remove_directory( ph ) )
- return error_code(::GetLastError(), system_category);
+ return error_code(::GetLastError(), system_category());
}
else
{
- if ( !delete_file( ph ) ) return error_code(::GetLastError(), system_category);
+ if ( !delete_file( ph ) ) return error_code(::GetLastError(), system_category());
}
return ok;
}
@@ -538,12 +539,12 @@ namespace
{ return ::CreateDirectoryA( dir.c_str(), 0 ) != 0; }
template<class String>
- boost::filesystem::detail::query_pair
+ boost::filesystem2::detail::query_pair
create_directory_template( const String & dir_ph )
{
error_code error, dummy;
if ( create_directory( dir_ph ) ) return std::make_pair( error, true );
- error = error_code( ::GetLastError(), system_category );
+ error = error_code( ::GetLastError(), system_category() );
// an error here may simply mean the postcondition is already met
if ( error.value() == ERROR_ALREADY_EXISTS
&& fs::is_directory( fs::detail::status_api( dir_ph, dummy ) ) )
@@ -564,7 +565,7 @@ namespace
const String & from_ph )
{
return error_code( create_hard_link( to_ph.c_str(), from_ph.c_str() )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
#endif
@@ -591,7 +592,7 @@ namespace
namespace boost
{
- namespace filesystem
+ namespace filesystem2
{
namespace detail
{
@@ -602,9 +603,9 @@ namespace boost
BOOST_FILESYSTEM_DECL error_code not_found_error()
{
# ifdef BOOST_WINDOWS_API
- return error_code(ERROR_PATH_NOT_FOUND, system_category);
+ return error_code(ERROR_PATH_NOT_FOUND, system_category());
# else
- return error_code(ENOENT, system_category);
+ return error_code(ENOENT, system_category());
# endif
}
@@ -624,7 +625,7 @@ namespace boost
status_api( const std::string & ph, error_code & ec )
{ return status_template( ph, ec ); }
-# ifndef BOOST_FILESYSTEM_NARROW_ONLY
+# ifndef BOOST_FILESYSTEM2_NARROW_ONLY
BOOST_FILESYSTEM_DECL fs::file_status
status_api( const std::wstring & ph, error_code & ec )
@@ -686,7 +687,7 @@ namespace boost
BOOST_FILESYSTEM_DECL error_code
create_symlink_api( const std::wstring & /*to_ph*/,
const std::wstring & /*from_ph*/ )
- { return error_code( ERROR_NOT_SUPPORTED, system_category ); }
+ { return error_code( ERROR_NOT_SUPPORTED, system_category() ); }
BOOST_FILESYSTEM_DECL error_code
remove_api( const std::wstring & ph ) { return remove_template( ph ); }
@@ -695,14 +696,14 @@ namespace boost
rename_api( const std::wstring & from, const std::wstring & to )
{
return error_code( ::MoveFileW( from.c_str(), to.c_str() )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
BOOST_FILESYSTEM_DECL error_code
copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists )
{
return error_code( ::CopyFileW( from.c_str(), to.c_str(), fail_if_exists )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph,
@@ -778,7 +779,7 @@ namespace boost
{
handle = 0;
return error_code( ::GetLastError() == ERROR_FILE_NOT_FOUND
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
target = data.cFileName;
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
@@ -796,7 +797,7 @@ namespace boost
{
int error = ::GetLastError();
dir_itr_close( handle );
- return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category );
+ return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() );
}
target = data.cFileName;
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
@@ -805,7 +806,7 @@ namespace boost
return ok;
}
-# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
+# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
// suggested by Walter Landry
BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::string & )
@@ -866,7 +867,7 @@ namespace boost
BOOST_FILESYSTEM_DECL error_code
create_symlink_api( const std::string & /*to_ph*/,
const std::string & /*from_ph*/ )
- { return error_code( ERROR_NOT_SUPPORTED, system_category ); }
+ { return error_code( ERROR_NOT_SUPPORTED, system_category() ); }
BOOST_FILESYSTEM_DECL error_code
remove_api( const std::string & ph ) { return remove_template( ph ); }
@@ -875,14 +876,14 @@ namespace boost
rename_api( const std::string & from, const std::string & to )
{
return error_code( ::MoveFileA( from.c_str(), to.c_str() )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
BOOST_FILESYSTEM_DECL error_code
copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists )
{
return error_code( ::CopyFileA( from.c_str(), to.c_str(), fail_if_exists )
- ? 0 : ::GetLastError(), system_category );
+ ? 0 : ::GetLastError(), system_category() );
}
BOOST_FILESYSTEM_DECL error_code
@@ -903,8 +904,10 @@ namespace boost
== INVALID_HANDLE_VALUE )
{
handle = 0;
- return error_code( ::GetLastError() == ERROR_FILE_NOT_FOUND
- ? 0 : ::GetLastError(), system_category );
+ return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND
+ // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551
+ || ::GetLastError() == ERROR_NO_MORE_FILES)
+ ? 0 : ::GetLastError(), system_category() );
}
target = data.cFileName;
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
@@ -920,7 +923,7 @@ namespace boost
{
bool ok = ::FindClose( handle ) != 0;
handle = 0;
- return error_code( ok ? 0 : ::GetLastError(), system_category );
+ return error_code( ok ? 0 : ::GetLastError(), system_category() );
}
return ok;
}
@@ -934,7 +937,7 @@ namespace boost
{
int error = ::GetLastError();
dir_itr_close( handle );
- return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category );
+ return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() );
}
target = data.cFileName;
if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
@@ -956,7 +959,7 @@ namespace boost
ec = ok;
return fs::file_status( fs::file_not_found );
}
- ec = error_code( errno, system_category );
+ ec = error_code( errno, system_category() );
return fs::file_status( fs::status_unknown );
}
ec = ok;
@@ -986,7 +989,7 @@ namespace boost
ec = ok;
return fs::file_status( fs::file_not_found );
}
- ec = error_code( errno, system_category );
+ ec = error_code( errno, system_category() );
return fs::file_status( fs::status_unknown );
}
ec = ok;
@@ -1021,7 +1024,7 @@ namespace boost
{
struct stat path_stat;
if ( (::stat( ph.c_str(), &path_stat )) != 0 )
- return std::make_pair( error_code( errno, system_category ), false );
+ return std::make_pair( error_code( errno, system_category() ), false );
return std::make_pair( ok, S_ISDIR( path_stat.st_mode )
? is_empty_directory( ph )
: path_stat.st_size == 0 );
@@ -1035,7 +1038,7 @@ namespace boost
struct stat s1;
int e1( ::stat( ph1.c_str(), &s1 ) );
if ( e1 != 0 || e2 != 0 )
- return std::make_pair( error_code( e1 != 0 && e2 != 0 ? errno : 0, system_category ), false );
+ return std::make_pair( error_code( e1 != 0 && e2 != 0 ? errno : 0, system_category() ), false );
// at this point, both stats are known to be valid
return std::make_pair( ok,
s1.st_dev == s2.st_dev
@@ -1052,9 +1055,9 @@ namespace boost
{
struct stat path_stat;
if ( ::stat( ph.c_str(), &path_stat ) != 0 )
- return std::make_pair( error_code( errno, system_category ), 0 );
+ return std::make_pair( error_code( errno, system_category() ), 0 );
if ( !S_ISREG( path_stat.st_mode ) )
- return std::make_pair( error_code( EPERM, system_category ), 0 );
+ return std::make_pair( error_code( EPERM, system_category() ), 0 );
return std::make_pair( ok,
static_cast<boost::uintmax_t>(path_stat.st_size) );
}
@@ -1066,7 +1069,7 @@ namespace boost
space_pair result;
if ( ::BOOST_STATVFS( ph.c_str(), &vfs ) != 0 )
{
- result.first = error_code( errno, system_category );
+ result.first = error_code( errno, system_category() );
result.second.capacity = result.second.free
= result.second.available = 0;
}
@@ -1088,7 +1091,7 @@ namespace boost
{
struct stat path_stat;
if ( ::stat( ph.c_str(), &path_stat ) != 0 )
- return std::make_pair( error_code( errno, system_category ), 0 );
+ return std::make_pair( error_code( errno, system_category() ), 0 );
return std::make_pair( ok, path_stat.st_mtime );
}
@@ -1097,11 +1100,11 @@ namespace boost
{
struct stat path_stat;
if ( ::stat( ph.c_str(), &path_stat ) != 0 )
- return error_code( errno, system_category );
+ return error_code( errno, system_category() );
::utimbuf buf;
buf.actime = path_stat.st_atime; // utime() updates access time too:-(
buf.modtime = new_value;
- return error_code( ::utime( ph.c_str(), &buf ) != 0 ? errno : 0, system_category );
+ return error_code( ::utime( ph.c_str(), &buf ) != 0 ? errno : 0, system_category() );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1118,7 +1121,7 @@ namespace boost
# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
&& errno != 0
# endif
- ) return error_code( errno, system_category );
+ ) return error_code( errno, system_category() );
}
else
{
@@ -1133,7 +1136,7 @@ namespace boost
set_current_path_api( const std::string & ph )
{
return error_code( ::chdir( ph.c_str() )
- ? errno : 0, system_category );
+ ? errno : 0, system_category() );
}
BOOST_FILESYSTEM_DECL fs::detail::query_pair
@@ -1145,7 +1148,7 @@ namespace boost
error_code dummy;
if ( ec != EEXIST
|| !fs::is_directory( status_api( ph, dummy ) ) )
- { return std::make_pair( error_code( ec, system_category ), false ); }
+ { return std::make_pair( error_code( ec, system_category() ), false ); }
return std::make_pair( ok, false );
}
@@ -1154,7 +1157,7 @@ namespace boost
const std::string & from_ph )
{
return error_code( ::link( to_ph.c_str(), from_ph.c_str() ) == 0
- ? 0 : errno, system_category );
+ ? 0 : errno, system_category() );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1162,7 +1165,7 @@ namespace boost
const std::string & from_ph )
{
return error_code( ::symlink( to_ph.c_str(), from_ph.c_str() ) == 0
- ? 0 : errno, system_category );
+ ? 0 : errno, system_category() );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1180,7 +1183,7 @@ namespace boost
// ignore errors if post-condition satisfied
return status_api(ph, ec).type() == file_not_found
- ? ok : error_code( error, system_category ) ;
+ ? ok : error_code( error, system_category() ) ;
}
BOOST_FILESYSTEM_DECL error_code
@@ -1189,9 +1192,9 @@ namespace boost
// POSIX is too permissive so must check
error_code dummy;
if ( fs::exists( status_api( to, dummy ) ) )
- return error_code( EEXIST, system_category );
+ return error_code( EEXIST, system_category() );
return error_code( std::rename( from.c_str(), to.c_str() ) != 0
- ? errno : 0, system_category );
+ ? errno : 0, system_category() );
}
BOOST_FILESYSTEM_DECL error_code
@@ -1206,11 +1209,11 @@ namespace boost
// introduced a gratuitous race condition; the stat() is now done after the open()
if ( (infile = ::open( from_file_ph.c_str(), O_RDONLY )) < 0 )
- { return error_code( errno, system_category ); }
+ { return error_code( errno, system_category() ); }
struct stat from_stat;
if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 )
- { return error_code( errno, system_category ); }
+ { return error_code( errno, system_category() ); }
int oflag = O_CREAT | O_WRONLY;
if ( fail_if_exists ) oflag |= O_EXCL;
@@ -1219,7 +1222,7 @@ namespace boost
int open_errno = errno;
BOOST_ASSERT( infile >= 0 );
::close( infile );
- return error_code( open_errno, system_category );
+ return error_code( open_errno, system_category() );
}
ssize_t sz, sz_read=1, sz_write;
@@ -1244,7 +1247,7 @@ namespace boost
if ( ::close( infile) < 0 ) sz_read = -1;
if ( ::close( outfile) < 0 ) sz_read = -1;
- return error_code( sz_read < 0 ? errno : 0, system_category );
+ return error_code( sz_read < 0 ? errno : 0, system_category() );
}
// this code is based on Stevens and Rago, Advanced Programming in the
@@ -1264,7 +1267,7 @@ namespace boost
{
if ( errno == 0 ) // indeterminate
max = 4096; // guess
- else return error_code( errno, system_category );
+ else return error_code( errno, system_category() );
}
else max = static_cast<std::size_t>( tmp + 1 ); // relative root
}
@@ -1278,7 +1281,7 @@ namespace boost
file_status &, file_status & )
{
if ( (handle = ::opendir( dir.c_str() )) == 0 )
- return error_code( errno, system_category );
+ return error_code( errno, system_category() );
target = std::string( "." ); // string was static but caused trouble
// when iteration called from dtor, after
// static had already been destroyed
@@ -1299,7 +1302,7 @@ namespace boost
if ( handle == 0 ) return ok;
DIR * h( static_cast<DIR*>(handle) );
handle = 0;
- return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category );
+ return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category() );
}
// warning: the only dirent member updated is d_name
@@ -1312,7 +1315,8 @@ namespace boost
&& defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
&& defined(_SC_THREAD_SAFE_FUNCTIONS) \
&& (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \
- && (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT)))
+ && (!defined(__hpux) || defined(_REENTRANT)) \
+ && (!defined(_AIX) || defined(__THREAD_SAFE))
if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 )
{ return ::readdir_r( dirp, entry, result ); }
# endif
@@ -1335,7 +1339,7 @@ namespace boost
dirent * result;
int return_code;
if ( (return_code = readdir_r_simulator( static_cast<DIR*>(handle),
- entry, &result )) != 0 ) return error_code( errno, system_category );
+ entry, &result )) != 0 ) return error_code( errno, system_category() );
if ( result == 0 ) return dir_itr_close( handle, buffer );
target = entry->d_name;
# ifdef BOOST_FILESYSTEM_STATUS_CACHE
@@ -1364,5 +1368,5 @@ namespace boost
# endif
} // namespace detail
- } // namespace filesystem
+ } // namespace filesystem2
} // namespace boost
diff --git a/3rdParty/Boost/src/libs/filesystem/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp
index 6d7d40c..7adeaff 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/path.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp
@@ -13,11 +13,15 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE
-#include <boost/filesystem/config.hpp>
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v2/config.hpp>
-#ifndef BOOST_FILESYSTEM_NARROW_ONLY
+#ifndef BOOST_FILESYSTEM2_NARROW_ONLY
-#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/v2/path.hpp>
#include <boost/scoped_array.hpp>
#include <locale>
@@ -26,6 +30,11 @@
#include <cwchar> // for std::mbstate_t
+#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+# include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
+#endif
+
+
namespace
{
// std::locale construction can throw (if LC_MESSAGES is wrong, for example),
@@ -37,8 +46,13 @@ namespace
#if !defined(macintosh) && !defined(__APPLE__) && !defined(__APPLE_CC__)
// ISO C calls this "the locale-specific native environment":
static std::locale lc("");
-#else
- static std::locale lc = std::locale(); // Mac OS doesn't support locale("")
+#else // Mac OS
+ // "All BSD system functions expect their string parameters to be in UTF-8 encoding
+ // and nothing else."
+ // See http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html
+ std::locale global_loc = std::locale(); // Mac OS doesn't support locale("")
+ static std::locale lc(global_loc,
+ new boost::filesystem::detail::utf8_codecvt_facet);
#endif
return lc;
}
@@ -58,7 +72,7 @@ namespace
namespace boost
{
- namespace filesystem
+ namespace filesystem2
{
bool wpath_traits::imbue( const std::locale & new_loc, const std::nothrow_t & )
{
@@ -75,7 +89,7 @@ namespace boost
if ( locked ) boost::throw_exception(
wfilesystem_error(
"boost::filesystem::wpath_traits::imbue() after lockdown",
- make_error_code( system::posix::not_supported ) ) );
+ make_error_code( system::errc::not_supported ) ) );
imbue( new_loc, std::nothrow );
}
@@ -132,7 +146,7 @@ namespace boost
work.get()+work_size, to_next ) != std::codecvt_base::ok )
boost::throw_exception( boost::filesystem::wfilesystem_error(
"boost::filesystem::wpath::to_external conversion error",
- ph, system::error_code( system::posix::invalid_argument, system::system_category ) ) );
+ ph, system::error_code( system::errc::invalid_argument, system::system_category() ) ) );
*to_next = '\0';
return external_string_type( work.get() );
}
@@ -151,13 +165,13 @@ namespace boost
work.get()+work_size, to_next ) != std::codecvt_base::ok )
boost::throw_exception( boost::filesystem::wfilesystem_error(
"boost::filesystem::wpath::to_internal conversion error",
- system::error_code( system::posix::invalid_argument, system::system_category ) ) );
+ system::error_code( system::errc::invalid_argument, system::system_category() ) ) );
*to_next = L'\0';
return internal_string_type( work.get() );
}
# endif // BOOST_POSIX_API
- } // namespace filesystem
+ } // namespace filesystem2
} // namespace boost
-#endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY
+#endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY
diff --git a/3rdParty/Boost/src/libs/filesystem/src/portability.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp
index 347180a..4d27543 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/portability.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp
@@ -13,10 +13,14 @@
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE
-#include <boost/filesystem/config.hpp>
-#include <boost/filesystem/path.hpp>
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
-namespace fs = boost::filesystem;
+#include <boost/filesystem/v2/config.hpp>
+#include <boost/filesystem/v2/path.hpp>
+
+namespace fs = boost::filesystem2;
#include <cstring> // SGI MIPSpro compilers need this
@@ -43,7 +47,7 @@ namespace
namespace boost
{
- namespace filesystem
+ namespace filesystem2
{
// name_check functions ----------------------------------------------//
@@ -111,5 +115,5 @@ namespace boost
;
}
- } // namespace filesystem
+ } // namespace filesystem2
} // namespace boost
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp
new file mode 100644
index 0000000..b35b4a9
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp
@@ -0,0 +1,93 @@
+// codecvt_error_category implementation file ----------------------------------------//
+
+// Copyright Beman Dawes 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt)
+
+// Library home page at http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+#include <boost/config/warning_disable.hpp>
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/config.hpp>
+#include <boost/filesystem/v3/path_traits.hpp>
+#include <boost/system/error_code.hpp>
+#include <locale>
+#include <vector>
+#include <cstdlib>
+#include <cassert>
+
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+ class codecvt_error_cat : public boost::system::error_category
+ {
+ public:
+ codecvt_error_cat(){}
+ const char* name() const;
+ std::string message(int ev) const;
+ };
+
+ const char* codecvt_error_cat::name() const
+ {
+ return "codecvt";
+ }
+
+ std::string codecvt_error_cat::message(int ev) const
+ {
+ std::string str;
+ switch (ev)
+ {
+ case std::codecvt_base::ok:
+ str = "ok";
+ break;
+ case std::codecvt_base::partial:
+ str = "partial";
+ break;
+ case std::codecvt_base::error:
+ str = "error";
+ break;
+ case std::codecvt_base::noconv:
+ str = "noconv";
+ break;
+ default:
+ str = "unknown error";
+ }
+ return str;
+ }
+
+} // unnamed namespace
+
+namespace boost
+{
+ namespace filesystem3
+ {
+
+ BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category()
+ {
+ static const codecvt_error_cat codecvt_error_cat_const;
+ return codecvt_error_cat_const;
+ }
+
+ } // namespace filesystem3
+} // namespace boost
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp
new file mode 100644
index 0000000..04d9c17
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp
@@ -0,0 +1,1897 @@
+// operations.cpp --------------------------------------------------------------------//
+
+// Copyright 2002-2009 Beman Dawes
+// Copyright 2001 Dietmar Kuehl
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See library home page at http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this
+#endif
+
+#if !(defined(__HP_aCC) && defined(_ILP32) && \
+ !defined(_STATVFS_ACPP_PROBLEMS_FIXED))
+#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
+#endif
+#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX
+ // 64-bit systems or on 32-bit systems which don't have files larger
+ // than can be represented by a traditional POSIX/UNIX off_t type.
+ // OTOH, defining them should kick in 64-bit off_t's (and thus
+ // st_size)on 32-bit systems that provide the Large File
+ // Support (LFS)interface, such as Linux, Solaris, and IRIX.
+ // The defines are given before any headers are included to
+ // ensure that they are available to all included headers.
+ // That is required at least on Solaris, and possibly on other
+ // systems as well.
+
+#include <boost/filesystem/v3/operations.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/detail/workaround.hpp>
+#include <cstdlib> // for malloc, free
+
+#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM
+# include <iostream>
+#endif
+
+namespace fs = boost::filesystem3;
+using boost::filesystem3::path;
+using boost::filesystem3::filesystem_error;
+using boost::system::error_code;
+using boost::system::error_category;
+using boost::system::system_category;
+using std::string;
+using std::wstring;
+
+# ifdef BOOST_POSIX_API
+
+# include <sys/types.h>
+# if !defined(__APPLE__) && !defined(__OpenBSD__)
+# include <sys/statvfs.h>
+# define BOOST_STATVFS statvfs
+# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize
+# else
+# ifdef __OpenBSD__
+# include <sys/param.h>
+# endif
+# include <sys/mount.h>
+# define BOOST_STATVFS statfs
+# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize)
+# endif
+# include <dirent.h>
+# include <unistd.h>
+# include <fcntl.h>
+# include <utime.h>
+# include "limits.h"
+
+# else // BOOST_WINDOW_API
+
+# if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER)
+ // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501.
+ // See MinGW's windef.h
+# define WINVER 0x501
+# endif
+# include <windows.h>
+# include <winnt.h>
+# if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0500
+# endif
+# if defined(__BORLANDC__) || defined(__MWERKS__)
+# if defined(__BORLANDC__)
+ using std::time_t;
+# endif
+# include <utime.h>
+# else
+# include <sys/utime.h>
+# endif
+
+// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the
+// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided
+// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx
+
+#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs
+
+#define SYMLINK_FLAG_RELATIVE 1
+
+typedef struct _REPARSE_DATA_BUFFER {
+ ULONG ReparseTag;
+ USHORT ReparseDataLength;
+ USHORT Reserved;
+ union {
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ ULONG Flags;
+ WCHAR PathBuffer[1];
+ /* Example of distinction between substitute and print names:
+ mklink /d ldrive c:\
+ SubstituteName: c:\\??\
+ PrintName: c:\
+ */
+ } SymbolicLinkReparseBuffer;
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ WCHAR PathBuffer[1];
+ } MountPointReparseBuffer;
+ struct {
+ UCHAR DataBuffer[1];
+ } GenericReparseBuffer;
+ };
+} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
+
+#define REPARSE_DATA_BUFFER_HEADER_SIZE \
+ FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+
+#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
+#endif
+
+# ifndef FSCTL_GET_REPARSE_POINT
+# define FSCTL_GET_REPARSE_POINT 0x900a8
+# endif
+
+# ifndef IO_REPARSE_TAG_SYMLINK
+# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
+# endif
+
+# endif // BOOST_WINDOWS_API
+
+// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in
+// dir_itr_increment. The config tests are placed here because some of the
+// macros being tested come from dirent.h.
+//
+// TODO: find out what macros indicate dirent::d_type present in more libraries
+# if defined(BOOST_WINDOWS_API)\
+ || defined(_DIRENT_HAVE_D_TYPE)// defined by GNU C library if d_type present
+# define BOOST_FILESYSTEM_STATUS_CACHE
+# endif
+
+#include <sys/stat.h> // even on Windows some functions use stat()
+#include <string>
+#include <cstring>
+#include <cstdio> // for remove, rename
+#include <cerrno>
+#include <cassert>
+// #include <iostream> // for debugging only; comment out when not in use
+
+// POSIX/Windows macros ----------------------------------------------------//
+
+// Portions of the POSIX and Windows API's are very similar, except for name,
+// order of arguments, and meaning of zero/non-zero returns. The macros below
+// abstract away those differences. They follow Windows naming and order of
+// arguments, and return true to indicate no error occurred. [POSIX naming,
+// order of arguments, and meaning of return were followed initially, but
+// found to be less clear and cause more coding errors.]
+
+# if defined(BOOST_POSIX_API)
+
+// POSIX uses a 0 return to indicate success
+# define BOOST_ERRNO errno
+# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0)
+# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0)
+# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0)
+# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0)
+# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0)
+# define BOOST_DELETE_FILE(P)(::unlink(P)== 0)
+# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\
+ || ::mkdir(to.c_str(),from_stat.st_mode)!= 0))
+# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool)
+# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0)
+# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0)
+
+# define BOOST_ERROR_NOT_SUPPORTED ENOSYS
+# define BOOST_ERROR_ALREADY_EXISTS EEXIST
+
+# else // BOOST_WINDOWS_API
+
+// Windows uses a non-0 return to indicate success
+# define BOOST_ERRNO ::GetLastError()
+# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0)
+# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0)
+# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0)
+# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0)
+# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0)
+# define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0)
+# define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0)
+# define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0)
+# define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING)!= 0)
+# define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0)
+# define BOOST_READ_SYMLINK(P,T)
+
+# define BOOST_ERROR_ALREADY_EXISTS ERROR_ALREADY_EXISTS
+# define BOOST_ERROR_NOT_SUPPORTED ERROR_NOT_SUPPORTED
+
+# endif
+
+//--------------------------------------------------------------------------------------//
+// //
+// helpers (all operating systems) //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+
+# ifdef BOOST_POSIX_API
+ const char dot = '.';
+# else
+ const wchar_t dot = L'.';
+# endif
+
+ fs::file_type query_file_type(const path& p, error_code* ec);
+
+ boost::filesystem3::directory_iterator end_dir_itr;
+
+ const std::size_t buf_size(128);
+ const error_code ok;
+
+ bool error(bool was_error, error_code* ec, const string& message)
+ {
+ if (!was_error)
+ {
+ if (ec != 0) ec->clear();
+ }
+ else
+ { // error
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
+ error_code(BOOST_ERRNO, system_category())));
+ else
+ ec->assign(BOOST_ERRNO, system_category());
+ }
+ return was_error;
+ }
+
+ bool error(bool was_error, const path& p, error_code* ec, const string& message)
+ {
+ if (!was_error)
+ {
+ if (ec != 0) ec->clear();
+ }
+ else
+ { // error
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
+ p, error_code(BOOST_ERRNO, system_category())));
+ else
+ ec->assign(BOOST_ERRNO, system_category());
+ }
+ return was_error;
+ }
+
+ bool error(bool was_error, const path& p1, const path& p2, error_code* ec,
+ const string& message)
+ {
+ if (!was_error)
+ {
+ if (ec != 0) ec->clear();
+ }
+ else
+ { // error
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(message,
+ p1, p2, error_code(BOOST_ERRNO, system_category())));
+ else
+ ec->assign(BOOST_ERRNO, system_category());
+ }
+ return was_error;
+ }
+
+ bool error(bool was_error, const error_code& result,
+ const path& p, error_code* ec, const string& message)
+ // Overwrites ec if there has already been an error
+ {
+ if (!was_error)
+ {
+ if (ec != 0) ec->clear();
+ }
+ else
+ { // error
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(message, p, result));
+ else
+ *ec = result;
+ }
+ return was_error;
+ }
+
+ bool error(bool was_error, const error_code& result,
+ const path& p1, const path& p2, error_code* ec, const string& message)
+ // Overwrites ec if there has already been an error
+ {
+ if (!was_error)
+ {
+ if (ec != 0) ec->clear();
+ }
+ else
+ { // error
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(message, p1, p2, result));
+ else
+ *ec = result;
+ }
+ return was_error;
+ }
+
+ bool is_empty_directory(const path& p)
+ {
+ return fs::directory_iterator(p)== end_dir_itr;
+ }
+
+ bool remove_directory(const path& p) // true if succeeds
+ { return BOOST_REMOVE_DIRECTORY(p.c_str()); }
+
+ bool remove_file(const path& p) // true if succeeds
+ { return BOOST_DELETE_FILE(p.c_str()); }
+
+ // called by remove and remove_all_aux
+ bool remove_file_or_directory(const path& p, fs::file_type type, error_code* ec)
+ // return true if file removed, false if not removed
+ {
+ if (type == fs::file_not_found)
+ {
+ if (ec != 0) ec->clear();
+ return false;
+ }
+
+ if (type == fs::directory_file
+# ifdef BOOST_WINDOWS_API
+ || type == fs::_detail_directory_symlink
+# endif
+ )
+ {
+ if (error(!remove_directory(p), p, ec, "boost::filesystem::remove"))
+ return false;
+ }
+ else
+ {
+ if (error(!remove_file(p), p, ec, "boost::filesystem::remove"))
+ return false;
+ }
+ return true;
+ }
+
+ boost::uintmax_t remove_all_aux(const path& p, fs::file_type type,
+ error_code* ec)
+ {
+ boost::uintmax_t count = 1;
+
+ if (type == fs::directory_file) // but not a directory symlink
+ {
+ for (fs::directory_iterator itr(p);
+ itr != end_dir_itr; ++itr)
+ {
+ fs::file_type tmp_type = query_file_type(itr->path(), ec);
+ if (ec != 0 && *ec)
+ return count;
+ count += remove_all_aux(itr->path(), tmp_type, ec);
+ }
+ }
+ remove_file_or_directory(p, type, ec);
+ return count;
+ }
+
+#ifdef BOOST_POSIX_API
+
+//--------------------------------------------------------------------------------------//
+// //
+// POSIX-specific helpers //
+// //
+//--------------------------------------------------------------------------------------//
+
+ bool not_found_error(int errval)
+ {
+ return errno == ENOENT || errno == ENOTDIR;
+ }
+
+ bool // true if ok
+ copy_file_api(const std::string& from_p,
+ const std::string& to_p, bool fail_if_exists)
+ {
+ const std::size_t buf_sz = 32768;
+ boost::scoped_array<char> buf(new char [buf_sz]);
+ int infile=-1, outfile=-1; // -1 means not open
+
+ // bug fixed: code previously did a stat()on the from_file first, but that
+ // introduced a gratuitous race condition; the stat()is now done after the open()
+
+ if ((infile = ::open(from_p.c_str(), O_RDONLY))< 0)
+ { return false; }
+
+ struct stat from_stat;
+ if (::stat(from_p.c_str(), &from_stat)!= 0)
+ { return false; }
+
+ int oflag = O_CREAT | O_WRONLY;
+ if (fail_if_exists)oflag |= O_EXCL;
+ if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0)
+ {
+ int open_errno = errno;
+ BOOST_ASSERT(infile >= 0);
+ ::close(infile);
+ errno = open_errno;
+ return false;
+ }
+
+ ssize_t sz, sz_read=1, sz_write;
+ while (sz_read > 0
+ && (sz_read = ::read(infile, buf.get(), buf_sz))> 0)
+ {
+ // Allow for partial writes - see Advanced Unix Programming (2nd Ed.),
+ // Marc Rochkind, Addison-Wesley, 2004, page 94
+ sz_write = 0;
+ do
+ {
+ if ((sz = ::write(outfile, buf.get() + sz_write,
+ sz_read - sz_write))< 0)
+ {
+ sz_read = sz; // cause read loop termination
+ break; // and error to be thrown after closes
+ }
+ sz_write += sz;
+ } while (sz_write < sz_read);
+ }
+
+ if (::close(infile)< 0)sz_read = -1;
+ if (::close(outfile)< 0)sz_read = -1;
+
+ return sz_read >= 0;
+ }
+
+ inline fs::file_type query_file_type(const path& p, error_code* ec)
+ {
+ return fs::detail::symlink_status(p, ec).type();
+ }
+
+# else
+
+//--------------------------------------------------------------------------------------//
+// //
+// Windows-specific helpers //
+// //
+//--------------------------------------------------------------------------------------//
+
+ bool not_found_error(int errval)
+ {
+ return errval == ERROR_FILE_NOT_FOUND
+ || errval == ERROR_PATH_NOT_FOUND
+ || errval == ERROR_INVALID_NAME // "tools/jam/src/:sys:stat.h", "//foo"
+ || errval == ERROR_INVALID_DRIVE // USB card reader with no card inserted
+ || errval == ERROR_NOT_READY // CD/DVD drive with no disc inserted
+ || errval == ERROR_INVALID_PARAMETER // ":sys:stat.h"
+ || errval == ERROR_BAD_PATHNAME // "//nosuch" on Win64
+ || errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32
+ }
+
+ // these constants come from inspecting some Microsoft sample code
+ std::time_t to_time_t(const FILETIME & ft)
+ {
+ __int64 t = (static_cast<__int64>(ft.dwHighDateTime)<< 32)
+ + ft.dwLowDateTime;
+# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0
+ t -= 116444736000000000LL;
+# else
+ t -= 116444736000000000;
+# endif
+ t /= 10000000;
+ return static_cast<std::time_t>(t);
+ }
+
+ void to_FILETIME(std::time_t t, FILETIME & ft)
+ {
+ __int64 temp = t;
+ temp *= 10000000;
+# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0
+ temp += 116444736000000000LL;
+# else
+ temp += 116444736000000000;
+# endif
+ ft.dwLowDateTime = static_cast<DWORD>(temp);
+ ft.dwHighDateTime = static_cast<DWORD>(temp >> 32);
+ }
+
+ // Thanks to Jeremy Maitin-Shepard for much help and for permission to
+ // base the equivalent()implementation on portions of his
+ // file-equivalence-win32.cpp experimental code.
+
+ struct handle_wrapper
+ {
+ HANDLE handle;
+ handle_wrapper(HANDLE h)
+ : handle(h){}
+ ~handle_wrapper()
+ {
+ if (handle != INVALID_HANDLE_VALUE)
+ ::CloseHandle(handle);
+ }
+ };
+
+ HANDLE create_file_handle(const path& p, DWORD dwDesiredAccess,
+ DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
+ HANDLE hTemplateFile)
+ {
+ return ::CreateFileW(p.c_str(), dwDesiredAccess, dwShareMode,
+ lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
+ hTemplateFile);
+ }
+
+ bool is_reparse_point_a_symlink(const path& p)
+ {
+ handle_wrapper h(create_file_handle(p, FILE_READ_EA,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL));
+ if (h.handle == INVALID_HANDLE_VALUE)
+ return false;
+
+ boost::scoped_array<char> buf(new char [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]);
+
+ // Query the reparse data
+ DWORD dwRetLen;
+ BOOL result = ::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buf.get(),
+ MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &dwRetLen, NULL);
+ if (!result) return false;
+
+ return reinterpret_cast<const REPARSE_DATA_BUFFER*>(buf.get())
+ ->ReparseTag == IO_REPARSE_TAG_SYMLINK;
+ }
+
+ inline std::size_t get_full_path_name(
+ const path& src, std::size_t len, wchar_t* buf, wchar_t** p)
+ {
+ return static_cast<std::size_t>(
+ ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p));
+ }
+
+ fs::file_status process_status_failure(const path& p, error_code* ec)
+ {
+ int errval(::GetLastError());
+ if (ec != 0) // always report errval, even though some
+ ec->assign(errval, system_category()); // errval values are not status_errors
+
+ if (not_found_error(errval))
+ {
+ return fs::file_status(fs::file_not_found);
+ }
+ else if ((errval == ERROR_SHARING_VIOLATION))
+ {
+ return fs::file_status(fs::type_unknown);
+ }
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
+ p, error_code(errval, system_category())));
+ return fs::file_status(fs::status_error);
+ }
+
+ // differs from symlink_status() in that directory symlinks are reported as
+ // _detail_directory_symlink, as required on Windows by remove() and its helpers.
+ fs::file_type query_file_type(const path& p, error_code* ec)
+ {
+ DWORD attr(::GetFileAttributesW(p.c_str()));
+ if (attr == 0xFFFFFFFF)
+ {
+ return process_status_failure(p, ec).type();
+ }
+
+ if (ec != 0) ec->clear();
+
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT)
+ {
+ if (is_reparse_point_a_symlink(p))
+ return (attr & FILE_ATTRIBUTE_DIRECTORY)
+ ? fs::_detail_directory_symlink
+ : fs::symlink_file;
+ return fs::reparse_file;
+ }
+
+ return (attr & FILE_ATTRIBUTE_DIRECTORY)
+ ? fs::directory_file
+ : fs::regular_file;
+ }
+
+ BOOL resize_file_api(const wchar_t* p, boost::uintmax_t size)
+ {
+ HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, 0);
+ LARGE_INTEGER sz;
+ sz.QuadPart = size;
+ return handle != INVALID_HANDLE_VALUE
+ && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN)
+ && ::SetEndOfFile(handle)
+ && ::CloseHandle(handle);
+ }
+
+ // Windows kernel32.dll functions that may or may not be present
+ // must be accessed through pointers
+
+ typedef BOOL (WINAPI *PtrCreateHardLinkW)(
+ /*__in*/ LPCWSTR lpFileName,
+ /*__in*/ LPCWSTR lpExistingFileName,
+ /*__reserved*/ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+ PtrCreateHardLinkW create_hard_link_api = PtrCreateHardLinkW(
+ ::GetProcAddress(
+ ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW"));
+
+ typedef BOOLEAN (WINAPI *PtrCreateSymbolicLinkW)(
+ /*__in*/ LPCWSTR lpSymlinkFileName,
+ /*__in*/ LPCWSTR lpTargetFileName,
+ /*__in*/ DWORD dwFlags
+ );
+
+ PtrCreateSymbolicLinkW create_symbolic_link_api = PtrCreateSymbolicLinkW(
+ ::GetProcAddress(
+ ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW"));
+
+#endif
+
+//#ifdef BOOST_WINDOWS_API
+//
+//
+// inline bool get_free_disk_space(const std::wstring& ph,
+// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free)
+// { return ::GetDiskFreeSpaceExW(ph.c_str(), avail, total, free)!= 0; }
+//
+//#endif
+
+} // unnamed namespace
+
+//--------------------------------------------------------------------------------------//
+// //
+// operations functions declared in operations.hpp //
+// in alphabetic order //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+namespace filesystem3
+{
+
+ BOOST_FILESYSTEM_DECL
+ path absolute(const path& p, const path& base)
+ {
+// if ( p.empty() || p.is_absolute() )
+// return p;
+// // recursively calling absolute is sub-optimal, but is simple
+// path abs_base(base.is_absolute() ? base : absolute(base));
+//# ifdef BOOST_WINDOWS_API
+// if (p.has_root_directory())
+// return abs_base.root_name() / p;
+// // !p.has_root_directory
+// if (p.has_root_name())
+// return p.root_name()
+// / abs_base.root_directory() / abs_base.relative_path() / p.relative_path();
+// // !p.has_root_name()
+//# endif
+// return abs_base / p;
+
+ // recursively calling absolute is sub-optimal, but is sure and simple
+ path abs_base(base.is_absolute() ? base : absolute(base));
+
+ // store expensive to compute values that are needed multiple times
+ path p_root_name (p.root_name());
+ path base_root_name (abs_base.root_name());
+ path p_root_directory (p.root_directory());
+
+ if (p.empty())
+ return abs_base;
+
+ if (!p_root_name.empty()) // p.has_root_name()
+ {
+ if (p_root_directory.empty()) // !p.has_root_directory()
+ return p_root_name / abs_base.root_directory()
+ / abs_base.relative_path() / p.relative_path();
+ // p is absolute, so fall through to return p at end of block
+ }
+
+ else if (!p_root_directory.empty()) // p.has_root_directory()
+ {
+# ifdef BOOST_POSIX_API
+ // POSIX can have root name it it is a network path
+ if (base_root_name.empty()) // !abs_base.has_root_name()
+ return p;
+# endif
+ return base_root_name / p;
+ }
+
+ else
+ {
+ return abs_base / p;
+ }
+
+ return p; // p.is_absolute() is true
+ }
+
+namespace detail
+{
+ BOOST_FILESYSTEM_DECL bool possible_large_file_size_support()
+ {
+# ifdef BOOST_POSIX_API
+ struct stat lcl_stat;
+ return sizeof(lcl_stat.st_size)> 4;
+# else
+ return true;
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void copy(const path& from, const path& to, system::error_code* ec)
+ {
+ file_status s(symlink_status(from, *ec));
+ if (ec != 0 && *ec) return;
+
+ if(is_symlink(s))
+ {
+ copy_symlink(from, to, *ec);
+ }
+ else if(is_directory(s))
+ {
+ copy_directory(from, to, *ec);
+ }
+ else if(is_regular_file(s))
+ {
+ copy_file(from, to, copy_option::fail_if_exists, *ec);
+ }
+ else
+ {
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy",
+ from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category())));
+ ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category());
+ }
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void copy_directory(const path& from, const path& to, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ struct stat from_stat;
+# endif
+ error(!BOOST_COPY_DIRECTORY(from.c_str(), to.c_str()),
+ from, to, ec, "boost::filesystem::copy_directory");
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void copy_file(const path& from, const path& to,
+ BOOST_SCOPED_ENUM(copy_option)option,
+ error_code* ec)
+ {
+ error(!BOOST_COPY_FILE(from.c_str(), to.c_str(),
+ option == copy_option::fail_if_exists),
+ from, to, ec, "boost::filesystem::copy_file");
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void copy_symlink(const path& existing_symlink, const path& new_symlink,
+ system::error_code* ec)
+ {
+# if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
+ new_symlink, existing_symlink, ec,
+ "boost::filesystem::copy_symlink");
+
+# else // modern Windows or BOOST_POSIX_API
+ path p(read_symlink(existing_symlink, ec));
+ if (ec != 0 && *ec) return;
+ create_symlink(p, new_symlink, ec);
+
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ bool create_directories(const path& p, system::error_code* ec)
+ {
+ if (p.empty() || exists(p))
+ {
+ if (!p.empty() && !is_directory(p))
+ {
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error(
+ "boost::filesystem::create_directories", p,
+ error_code(system::errc::file_exists, system::generic_category())));
+ else ec->assign(system::errc::file_exists, system::generic_category());
+ }
+ return false;
+ }
+
+ // First create branch, by calling ourself recursively
+ create_directories(p.parent_path(), ec);
+ // Now that parent's path exists, create the directory
+ create_directory(p, ec);
+ return true;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ bool create_directory(const path& p, error_code* ec)
+ {
+ if (BOOST_CREATE_DIRECTORY(p.c_str()))
+ {
+ if (ec != 0) ec->clear();
+ return true;
+ }
+
+ // attempt to create directory failed
+ int errval(BOOST_ERRNO); // save reason for failure
+ error_code dummy;
+ if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy))
+ {
+ if (ec != 0) ec->clear();
+ return false;
+ }
+
+ // attempt to create directory failed && it doesn't already exist
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory",
+ p, error_code(errval, system_category())));
+ else
+ ec->assign(errval, system_category());
+ return false;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void create_directory_symlink(const path& to, const path& from,
+ system::error_code* ec)
+ {
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
+
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
+ "boost::filesystem::create_directory_symlink");
+# else
+
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
+ // see if actually supported by Windows runtime dll
+ if (error(!create_symbolic_link_api,
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
+ to, from, ec,
+ "boost::filesystem::create_directory_symlink"))
+ return;
+# endif
+
+ error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY),
+ to, from, ec, "boost::filesystem::create_directory_symlink");
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void create_hard_link(const path& to, const path& from, error_code* ec)
+ {
+
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K
+
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
+ "boost::filesystem::create_hard_link");
+# else
+
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500
+ // see if actually supported by Windows runtime dll
+ if (error(!create_hard_link_api,
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
+ to, from, ec,
+ "boost::filesystem::create_hard_link"))
+ return;
+# endif
+
+ error(!BOOST_CREATE_HARD_LINK(from.c_str(), to.c_str()), to, from, ec,
+ "boost::filesystem::create_hard_link");
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void create_symlink(const path& to, const path& from, error_code* ec)
+ {
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec,
+ "boost::filesystem::create_directory_symlink");
+# else
+
+# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600
+ // see if actually supported by Windows runtime dll
+ if (error(!create_symbolic_link_api,
+ error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()),
+ to, from, ec,
+ "boost::filesystem::create_symlink"))
+ return;
+# endif
+
+ error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), 0),
+ to, from, ec, "boost::filesystem::create_symlink");
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ path current_path(error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ path cur;
+ for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough
+ {
+ boost::scoped_array<char>
+ buf(new char[static_cast<std::size_t>(path_max)]);
+ if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0)
+ {
+ if (error(errno != ERANGE
+ // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set
+# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+ && errno != 0
+# endif
+ , ec, "boost::filesystem::current_path"))
+ {
+ break;
+ }
+ }
+ else
+ {
+ cur = buf.get();
+ if (ec != 0) ec->clear();
+ break;
+ }
+ }
+ return cur;
+
+# else
+ DWORD sz;
+ if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1;
+ boost::scoped_array<path::value_type> buf(new path::value_type[sz]);
+ error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec,
+ "boost::filesystem::current_path");
+ return path(buf.get());
+# endif
+ }
+
+
+ BOOST_FILESYSTEM_DECL
+ void current_path(const path& p, system::error_code* ec)
+ {
+ error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()),
+ p, ec, "boost::filesystem::current_path");
+ }
+
+ BOOST_FILESYSTEM_DECL
+ bool equivalent(const path& p1, const path& p2, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ struct stat s2;
+ int e2(::stat(p2.c_str(), &s2));
+ struct stat s1;
+ int e1(::stat(p1.c_str(), &s1));
+
+ if (e1 != 0 || e2 != 0)
+ {
+ // if one is invalid and the other isn't then they aren't equivalent,
+ // but if both are invalid then it is an error
+ error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent");
+ return false;
+ }
+
+ // both stats now known to be valid
+ return s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino
+ // According to the POSIX stat specs, "The st_ino and st_dev fields
+ // taken together uniquely identify the file within the system."
+ // Just to be sure, size and mod time are also checked.
+ && s1.st_size == s2.st_size && s1.st_mtime == s2.st_mtime;
+
+# else // Windows
+
+ // Note well: Physical location on external media is part of the
+ // equivalence criteria. If there are no open handles, physical location
+ // can change due to defragmentation or other relocations. Thus handles
+ // must be held open until location information for both paths has
+ // been retrieved.
+
+ // p2 is done first, so any error reported is for p1
+ handle_wrapper h2(
+ create_file_handle(
+ p2.c_str(),
+ 0,
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
+ 0,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS,
+ 0));
+
+ handle_wrapper h1(
+ create_file_handle(
+ p1.c_str(),
+ 0,
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
+ 0,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS,
+ 0));
+
+ if (h1.handle == INVALID_HANDLE_VALUE
+ || h2.handle == INVALID_HANDLE_VALUE)
+ {
+ // if one is invalid and the other isn't, then they aren't equivalent,
+ // but if both are invalid then it is an error
+ error(h1.handle == INVALID_HANDLE_VALUE
+ && h2.handle == INVALID_HANDLE_VALUE, p1, p2, ec,
+ "boost::filesystem::equivalent");
+ return false;
+ }
+
+ // at this point, both handles are known to be valid
+
+ BY_HANDLE_FILE_INFORMATION info1, info2;
+
+ if (error(!::GetFileInformationByHandle(h1.handle, &info1),
+ p1, p2, ec, "boost::filesystem::equivalent"))
+ return false;
+
+ if (error(!::GetFileInformationByHandle(h2.handle, &info2),
+ p1, p2, ec, "boost::filesystem::equivalent"))
+ return false;
+
+ // In theory, volume serial numbers are sufficient to distinguish between
+ // devices, but in practice VSN's are sometimes duplicated, so last write
+ // time and file size are also checked.
+ return
+ info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
+ && info1.nFileIndexHigh == info2.nFileIndexHigh
+ && info1.nFileIndexLow == info2.nFileIndexLow
+ && info1.nFileSizeHigh == info2.nFileSizeHigh
+ && info1.nFileSizeLow == info2.nFileSizeLow
+ && info1.ftLastWriteTime.dwLowDateTime
+ == info2.ftLastWriteTime.dwLowDateTime
+ && info1.ftLastWriteTime.dwHighDateTime
+ == info2.ftLastWriteTime.dwHighDateTime;
+
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t file_size(const path& p, error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::file_size"))
+ return static_cast<boost::uintmax_t>(-1);
+ if (error(!S_ISREG(path_stat.st_mode),
+ error_code(EPERM, system_category()),
+ p, ec, "boost::filesystem::file_size"))
+ return static_cast<boost::uintmax_t>(-1);
+
+ return static_cast<boost::uintmax_t>(path_stat.st_size);
+
+# else // Windows
+
+ // assume uintmax_t is 64-bits on all Windows compilers
+
+ WIN32_FILE_ATTRIBUTE_DATA fad;
+
+ if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0,
+ p, ec, "boost::filesystem::file_size"))
+ return static_cast<boost::uintmax_t>(-1);
+
+ if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0,
+ error_code(ERROR_NOT_SUPPORTED, system_category()),
+ p, ec, "boost::filesystem::file_size"))
+ return static_cast<boost::uintmax_t>(-1);
+
+ return (static_cast<boost::uintmax_t>(fad.nFileSizeHigh)
+ << (sizeof(fad.nFileSizeLow)*8)) + fad.nFileSizeLow;
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t hard_link_count(const path& p, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ return error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::hard_link_count")
+ ? 0
+ : static_cast<boost::uintmax_t>(path_stat.st_nlink);
+
+# else // Windows
+
+ // Link count info is only available through GetFileInformationByHandle
+ BY_HANDLE_FILE_INFORMATION info;
+ handle_wrapper h(
+ create_file_handle(p.c_str(), 0,
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
+ return
+ !error(h.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::hard_link_count")
+ && !error(::GetFileInformationByHandle(h.handle, &info)== 0,
+ p, ec, "boost::filesystem::hard_link_count")
+ ? info.nNumberOfLinks
+ : 0;
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ path initial_path(error_code* ec)
+ {
+ static path init_path;
+ if (init_path.empty())
+ init_path = current_path(ec);
+ else if (ec != 0) ec->clear();
+ return init_path;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ bool is_empty(const path& p, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::is_empty"))
+ return false;
+ return S_ISDIR(path_stat.st_mode)
+ ? is_empty_directory(p)
+ : path_stat.st_size == 0;
+# else
+
+ WIN32_FILE_ATTRIBUTE_DATA fad;
+ if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0,
+ p, ec, "boost::filesystem::is_empty"))
+ return false;
+
+ if (ec != 0) ec->clear();
+ return
+ (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ ? is_empty_directory(p)
+ : (!fad.nFileSizeHigh && !fad.nFileSizeLow);
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ std::time_t last_write_time(const path& p, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::last_write_time"))
+ return std::time_t(-1);
+ return path_stat.st_mtime;
+
+# else
+
+ handle_wrapper hw(
+ create_file_handle(p.c_str(), 0,
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
+
+ if (error(hw.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::last_write_time"))
+ return std::time_t(-1);
+
+ FILETIME lwt;
+
+ if (error(::GetFileTime(hw.handle, 0, 0, &lwt)== 0,
+ p, ec, "boost::filesystem::last_write_time"))
+ return std::time_t(-1);
+
+ return to_time_t(lwt);
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void last_write_time(const path& p, const std::time_t new_time,
+ system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (error(::stat(p.c_str(), &path_stat)!= 0,
+ p, ec, "boost::filesystem::last_write_time"))
+ return;
+ ::utimbuf buf;
+ buf.actime = path_stat.st_atime; // utime()updates access time too:-(
+ buf.modtime = new_time;
+ error(::utime(p.c_str(), &buf)!= 0,
+ p, ec, "boost::filesystem::last_write_time");
+
+# else
+
+ handle_wrapper hw(
+ create_file_handle(p.c_str(), FILE_WRITE_ATTRIBUTES,
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
+
+ if (error(hw.handle == INVALID_HANDLE_VALUE,
+ p, ec, "boost::filesystem::last_write_time"))
+ return;
+
+ FILETIME lwt;
+ to_FILETIME(new_time, lwt);
+
+ error(::SetFileTime(hw.handle, 0, 0, &lwt)== 0,
+ p, ec, "boost::filesystem::last_write_time");
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ path read_symlink(const path& p, system::error_code* ec)
+ {
+ path symlink_path;
+
+# ifdef BOOST_POSIX_API
+
+ for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough
+ {
+ boost::scoped_array<char> buf(new char[path_max]);
+ ssize_t result;
+ if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1)
+ {
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink",
+ p, error_code(errno, system_category())));
+ else ec->assign(errno, system_category());
+ break;
+ }
+ else
+ {
+ if(result != static_cast<ssize_t>(path_max))
+ {
+ symlink_path.assign(buf.get(), buf.get() + result);
+ if (ec != 0) ec->clear();
+ break;
+ }
+ }
+ }
+
+# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008
+ error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), p, ec,
+ "boost::filesystem::read_symlink");
+# else // Vista and Server 2008 SDK, or later
+
+ union info_t
+ {
+ char buf[REPARSE_DATA_BUFFER_HEADER_SIZE+MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
+ REPARSE_DATA_BUFFER rdb;
+ } info;
+
+ handle_wrapper h(
+ create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0));
+
+ if (error(h.handle == INVALID_HANDLE_VALUE, p, ec, "boost::filesystem::read_symlink"))
+ return symlink_path;
+
+ DWORD sz;
+
+ if (!error(::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT,
+ 0, 0, info.buf, sizeof(info), &sz, 0) == 0, p, ec,
+ "boost::filesystem::read_symlink" ))
+ symlink_path.assign(
+ static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer)
+ + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t),
+ static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer)
+ + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t)
+ + info.rdb.SymbolicLinkReparseBuffer.PrintNameLength/sizeof(wchar_t));
+# endif
+ return symlink_path;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ bool remove(const path& p, error_code* ec)
+ {
+ error_code tmp_ec;
+ file_type type = query_file_type(p, &tmp_ec);
+ if (error(type == status_error, tmp_ec, p, ec,
+ "boost::filesystem::remove"))
+ return false;
+
+ // Since POSIX remove() is specified to work with either files or directories, in a
+ // perfect world it could just be called. But some important real-world operating
+ // systems (Windows, Mac OS X, for example) don't implement the POSIX spec. So
+ // remove_file_or_directory() is always called to kep it simple.
+ return remove_file_or_directory(p, type, ec);
+ }
+
+ BOOST_FILESYSTEM_DECL
+ boost::uintmax_t remove_all(const path& p, error_code* ec)
+ {
+ error_code tmp_ec;
+ file_type type = query_file_type(p, &tmp_ec);
+ if (error(type == status_error, tmp_ec, p, ec,
+ "boost::filesystem::remove_all"))
+ return 0;
+
+ return (type != status_error && type != file_not_found) // exists
+ ? remove_all_aux(p, type, ec)
+ : 0;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void rename(const path& old_p, const path& new_p, error_code* ec)
+ {
+ error(!BOOST_MOVE_FILE(old_p.c_str(), new_p.c_str()), old_p, new_p, ec,
+ "boost::filesystem::rename");
+ }
+
+ BOOST_FILESYSTEM_DECL
+ void resize_file(const path& p, uintmax_t size, system::error_code* ec)
+ {
+ error(!BOOST_RESIZE_FILE(p.c_str(), size), p, ec, "boost::filesystem::resize_file");
+ }
+
+ BOOST_FILESYSTEM_DECL
+ space_info space(const path& p, error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ struct BOOST_STATVFS vfs;
+ space_info info;
+ if (!error(::BOOST_STATVFS(p.c_str(), &vfs)!= 0,
+ p, ec, "boost::filesystem::space"))
+ {
+ info.capacity
+ = static_cast<boost::uintmax_t>(vfs.f_blocks)* BOOST_STATVFS_F_FRSIZE;
+ info.free
+ = static_cast<boost::uintmax_t>(vfs.f_bfree)* BOOST_STATVFS_F_FRSIZE;
+ info.available
+ = static_cast<boost::uintmax_t>(vfs.f_bavail)* BOOST_STATVFS_F_FRSIZE;
+ }
+
+# else
+ ULARGE_INTEGER avail, total, free;
+ space_info info;
+
+ if (!error(::GetDiskFreeSpaceExW(p.c_str(), &avail, &total, &free)== 0,
+ p, ec, "boost::filesystem::space"))
+ {
+ info.capacity
+ = (static_cast<boost::uintmax_t>(total.HighPart)<< 32)
+ + total.LowPart;
+ info.free
+ = (static_cast<boost::uintmax_t>(free.HighPart)<< 32)
+ + free.LowPart;
+ info.available
+ = (static_cast<boost::uintmax_t>(avail.HighPart)<< 32)
+ + avail.LowPart;
+ }
+
+# endif
+
+ else
+ {
+ info.capacity = info.free = info.available = 0;
+ }
+ return info;
+ }
+
+ BOOST_FILESYSTEM_DECL
+ file_status status(const path& p, error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (::stat(p.c_str(), &path_stat)!= 0)
+ {
+ if (ec != 0) // always report errno, even though some
+ ec->assign(errno, system_category()); // errno values are not status_errors
+
+ if (not_found_error(errno))
+ {
+ return fs::file_status(fs::file_not_found);
+ }
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
+ p, error_code(errno, system_category())));
+ return fs::file_status(fs::status_error);
+ }
+ if (ec != 0) ec->clear();;
+ if (S_ISDIR(path_stat.st_mode))
+ return fs::file_status(fs::directory_file);
+ if (S_ISREG(path_stat.st_mode))
+ return fs::file_status(fs::regular_file);
+ if (S_ISBLK(path_stat.st_mode))
+ return fs::file_status(fs::block_file);
+ if (S_ISCHR(path_stat.st_mode))
+ return fs::file_status(fs::character_file);
+ if (S_ISFIFO(path_stat.st_mode))
+ return fs::file_status(fs::fifo_file);
+ if (S_ISSOCK(path_stat.st_mode))
+ return fs::file_status(fs::socket_file);
+ return fs::file_status(fs::type_unknown);
+
+# else // Windows
+
+ DWORD attr(::GetFileAttributesW(p.c_str()));
+ if (attr == 0xFFFFFFFF)
+ {
+ return process_status_failure(p, ec);
+ }
+
+ // reparse point handling
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT)
+ {
+ handle_wrapper h(
+ create_file_handle(
+ p.c_str(),
+ 0, // dwDesiredAccess; attributes only
+ FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
+ 0, // lpSecurityAttributes
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS,
+ 0)); // hTemplateFile
+ if (h.handle == INVALID_HANDLE_VALUE)
+ {
+ return process_status_failure(p, ec);
+ }
+ }
+
+ if (ec != 0) ec->clear();
+ return (attr & FILE_ATTRIBUTE_DIRECTORY)
+ ? file_status(directory_file)
+ : file_status(regular_file);
+
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ file_status symlink_status(const path& p, error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+
+ struct stat path_stat;
+ if (::lstat(p.c_str(), &path_stat)!= 0)
+ {
+ if (ec != 0) // always report errno, even though some
+ ec->assign(errno, system_category()); // errno values are not status_errors
+
+ if (errno == ENOENT || errno == ENOTDIR) // these are not errors
+ {
+ return fs::file_status(fs::file_not_found);
+ }
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
+ p, error_code(errno, system_category())));
+ return fs::file_status(fs::status_error);
+ }
+ if (ec != 0) ec->clear();
+ if (S_ISREG(path_stat.st_mode))
+ return fs::file_status(fs::regular_file);
+ if (S_ISDIR(path_stat.st_mode))
+ return fs::file_status(fs::directory_file);
+ if (S_ISLNK(path_stat.st_mode))
+ return fs::file_status(fs::symlink_file);
+ if (S_ISBLK(path_stat.st_mode))
+ return fs::file_status(fs::block_file);
+ if (S_ISCHR(path_stat.st_mode))
+ return fs::file_status(fs::character_file);
+ if (S_ISFIFO(path_stat.st_mode))
+ return fs::file_status(fs::fifo_file);
+ if (S_ISSOCK(path_stat.st_mode))
+ return fs::file_status(fs::socket_file);
+ return fs::file_status(fs::type_unknown);
+
+# else // Windows
+
+ DWORD attr(::GetFileAttributesW(p.c_str()));
+ if (attr == 0xFFFFFFFF)
+ {
+ return process_status_failure(p, ec);
+ }
+
+ if (ec != 0) ec->clear();
+
+ if (attr & FILE_ATTRIBUTE_REPARSE_POINT)
+ return is_reparse_point_a_symlink(p)
+ ? file_status(symlink_file)
+ : file_status(reparse_file);
+
+ return (attr & FILE_ATTRIBUTE_DIRECTORY)
+ ? file_status(directory_file)
+ : file_status(regular_file);
+
+# endif
+ }
+
+ BOOST_FILESYSTEM_DECL
+ path system_complete(const path& p, system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ return (p.empty() || p.is_absolute())
+ ? p : current_path()/ p;
+
+# else
+ if (p.empty())
+ {
+ if (ec != 0) ec->clear();
+ return p;
+ }
+ wchar_t buf[buf_size];
+ wchar_t* pfn;
+ std::size_t len = get_full_path_name(p, buf_size, buf, &pfn);
+
+ if (error(len == 0, p, ec, "boost::filesystem::system_complete"))
+ return path();
+
+ if (len < buf_size)// len does not include null termination character
+ return path(&buf[0]);
+
+ boost::scoped_array<wchar_t> big_buf(new wchar_t[len]);
+
+ return error(get_full_path_name(p, len , big_buf.get(), &pfn)== 0,
+ p, ec, "boost::filesystem::system_complete")
+ ? path()
+ : path(big_buf.get());
+# endif
+ }
+
+} // namespace detail
+
+//--------------------------------------------------------------------------------------//
+// //
+// directory_entry //
+// //
+//--------------------------------------------------------------------------------------//
+
+ file_status
+ directory_entry::m_get_status(system::error_code* ec) const
+ {
+ if (!status_known(m_status))
+ {
+ // optimization: if the symlink status is known, and it isn't a symlink,
+ // then status and symlink_status are identical so just copy the
+ // symlink status to the regular status.
+ if (status_known(m_symlink_status)
+ && !is_symlink(m_symlink_status))
+ {
+ m_status = m_symlink_status;
+ if (ec != 0) ec->clear();
+ }
+ else m_status = detail::status(m_path, ec);
+ }
+ else if (ec != 0) ec->clear();
+ return m_status;
+ }
+
+ file_status
+ directory_entry::m_get_symlink_status(system::error_code* ec) const
+ {
+ if (!status_known(m_symlink_status))
+ m_symlink_status = detail::symlink_status(m_path, ec);
+ else if (ec != 0) ec->clear();
+ return m_symlink_status;
+ }
+
+// dispatch directory_entry supplied here rather than in
+// <boost/filesystem/path_traits.hpp>, thus avoiding header circularity.
+// test cases are in operations_unit_test.cpp
+
+namespace path_traits
+{
+ void dispatch(const directory_entry & de,
+# ifdef BOOST_WINDOWS_API
+ std::wstring& to,
+# else
+ std::string& to,
+# endif
+ const codecvt_type &)
+ {
+ to = de.path().native();
+ }
+
+} // namespace path_traits
+} // namespace filesystem3
+} // namespace boost
+
+//--------------------------------------------------------------------------------------//
+// //
+// directory_iterator //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+# ifdef BOOST_POSIX_API
+
+ error_code path_max(std::size_t & result)
+ // this code is based on Stevens and Rago, Advanced Programming in the
+ // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49
+ {
+# ifdef PATH_MAX
+ static std::size_t max = PATH_MAX;
+# else
+ static std::size_t max = 0;
+# endif
+ if (max == 0)
+ {
+ errno = 0;
+ long tmp = ::pathconf("/", _PC_NAME_MAX);
+ if (tmp < 0)
+ {
+ if (errno == 0)// indeterminate
+ max = 4096; // guess
+ else return error_code(errno, system_category());
+ }
+ else max = static_cast<std::size_t>(tmp + 1); // relative root
+ }
+ result = max;
+ return ok;
+ }
+
+ error_code dir_itr_first(void *& handle, void *& buffer,
+ const char* dir, string& target,
+ fs::file_status &, fs::file_status &)
+ {
+ if ((handle = ::opendir(dir))== 0)
+ return error_code(errno, system_category());
+ target = string("."); // string was static but caused trouble
+ // when iteration called from dtor, after
+ // static had already been destroyed
+ std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509)
+ error_code ec = path_max(path_size);
+ if (ec)return ec;
+ dirent de;
+ buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name))
+ + path_size + 1); // + 1 for "/0"
+ return ok;
+ }
+
+ // warning: the only dirent member updated is d_name
+ inline int readdir_r_simulator(DIR * dirp, struct dirent * entry,
+ struct dirent ** result)// *result set to 0 on end of directory
+ {
+ errno = 0;
+
+# if !defined(__CYGWIN__)\
+ && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\
+ && defined(_SC_THREAD_SAFE_FUNCTIONS)\
+ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\
+ && (!defined(__hpux) || defined(_REENTRANT)) \
+ && (!defined(_AIX) || defined(__THREAD_SAFE))
+ if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0)
+ { return ::readdir_r(dirp, entry, result); }
+# endif
+
+ struct dirent * p;
+ *result = 0;
+ if ((p = ::readdir(dirp))== 0)
+ return errno;
+ std::strcpy(entry->d_name, p->d_name);
+ *result = entry;
+ return 0;
+ }
+
+ error_code dir_itr_increment(void *& handle, void *& buffer,
+ string& target, fs::file_status & sf, fs::file_status & symlink_sf)
+ {
+ BOOST_ASSERT(buffer != 0);
+ dirent * entry(static_cast<dirent *>(buffer));
+ dirent * result;
+ int return_code;
+ if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle),
+ entry, &result))!= 0)return error_code(errno, system_category());
+ if (result == 0)
+ return fs::detail::dir_itr_close(handle, buffer);
+ target = entry->d_name;
+# ifdef BOOST_FILESYSTEM_STATUS_CACHE
+ if (entry->d_type == DT_UNKNOWN) // filesystem does not supply d_type value
+ {
+ sf = symlink_sf = fs::file_status(fs::status_error);
+ }
+ else // filesystem supplies d_type value
+ {
+ if (entry->d_type == DT_DIR)
+ sf = symlink_sf = fs::file_status(fs::directory_file);
+ else if (entry->d_type == DT_REG)
+ sf = symlink_sf = fs::file_status(fs::regular_file);
+ else if (entry->d_type == DT_LNK)
+ {
+ sf = fs::file_status(fs::status_error);
+ symlink_sf = fs::file_status(fs::symlink_file);
+ }
+ else sf = symlink_sf = fs::file_status(fs::status_error);
+ }
+# else
+ sf = symlink_sf = fs::file_status(fs::status_error);
+# endif
+ return ok;
+ }
+
+# else // BOOST_WINDOWS_API
+
+ error_code dir_itr_first(void *& handle, const fs::path& dir,
+ wstring& target, fs::file_status & sf, fs::file_status & symlink_sf)
+ // Note: an empty root directory has no "." or ".." entries, so this
+ // causes a ERROR_FILE_NOT_FOUND error which we do not considered an
+ // error. It is treated as eof instead.
+ {
+ // use a form of search Sebastian Martel reports will work with Win98
+ wstring dirpath(dir.wstring());
+ dirpath += (dirpath.empty()
+ || (dirpath[dirpath.size()-1] != L'\\'
+ && dirpath[dirpath.size()-1] != L'/'
+ && dirpath[dirpath.size()-1] != L':'))? L"\\*" : L"*";
+
+ WIN32_FIND_DATAW data;
+ if ((handle = ::FindFirstFileW(dirpath.c_str(), &data))
+ == INVALID_HANDLE_VALUE)
+ {
+ handle = 0;
+ return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND
+ // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551
+ || ::GetLastError() == ERROR_NO_MORE_FILES)
+ ? 0 : ::GetLastError(), system_category() );
+ }
+ target = data.cFileName;
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); }
+ else { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); }
+ return error_code();
+ }
+
+ error_code dir_itr_increment(void *& handle, wstring& target,
+ fs::file_status & sf, fs::file_status & symlink_sf)
+ {
+ WIN32_FIND_DATAW data;
+ if (::FindNextFileW(handle, &data)== 0)// fails
+ {
+ int error = ::GetLastError();
+ fs::detail::dir_itr_close(handle);
+ return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category());
+ }
+ target = data.cFileName;
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); }
+ else { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); }
+ return error_code();
+ }
+#endif
+
+ const error_code not_found_error_code (
+# ifdef BOOST_WINDOWS_API
+ ERROR_PATH_NOT_FOUND
+# else
+ ENOENT
+# endif
+ , system_category());
+
+} // unnamed namespace
+
+namespace boost
+{
+namespace filesystem3
+{
+
+namespace detail
+{
+ // dir_itr_close is called both from the ~dir_itr_imp()destructor
+ // and dir_itr_increment()
+ BOOST_FILESYSTEM_DECL
+ system::error_code dir_itr_close( // never throws
+ void *& handle
+# if defined(BOOST_POSIX_API)
+ , void *& buffer
+# endif
+ )
+ {
+# ifdef BOOST_POSIX_API
+ std::free(buffer);
+ buffer = 0;
+ if (handle == 0)return ok;
+ DIR * h(static_cast<DIR*>(handle));
+ handle = 0;
+ return error_code(::closedir(h)== 0 ? 0 : errno, system_category());
+
+# else
+ if (handle != 0)
+ {
+ ::FindClose(handle);
+ handle = 0;
+ }
+ return ok;
+
+# endif
+ }
+
+ void directory_iterator_construct(directory_iterator& it,
+ const path& p, system::error_code* ec)
+ {
+ if (error(p.empty(), not_found_error_code, p, ec,
+ "boost::filesystem::directory_iterator::construct"))return;
+
+ path::string_type filename;
+ file_status file_stat, symlink_file_stat;
+ error_code result = dir_itr_first(it.m_imp->handle,
+# if defined(BOOST_POSIX_API)
+ it.m_imp->buffer,
+# endif
+ p.c_str(), filename, file_stat, symlink_file_stat);
+
+ if (result)
+ {
+ it.m_imp.reset();
+ error(true, result, p,
+ ec, "boost::filesystem::directory_iterator::construct");
+ return;
+ }
+
+ if (it.m_imp->handle == 0)it.m_imp.reset(); // eof, so make end iterator
+ else // not eof
+ {
+ it.m_imp->dir_entry.assign(p / filename,
+ file_stat, symlink_file_stat);
+ if (filename[0] == dot // dot or dot-dot
+ && (filename.size()== 1
+ || (filename[1] == dot
+ && filename.size()== 2)))
+ { it.increment(); }
+ }
+ }
+
+ void directory_iterator_increment(directory_iterator& it,
+ system::error_code* ec)
+ {
+ BOOST_ASSERT(it.m_imp.get() && "attempt to increment end iterator");
+ BOOST_ASSERT(it.m_imp->handle != 0 && "internal program error");
+
+ path::string_type filename;
+ file_status file_stat, symlink_file_stat;
+ system::error_code temp_ec;
+
+ for (;;)
+ {
+ temp_ec = dir_itr_increment(it.m_imp->handle,
+# if defined(BOOST_POSIX_API)
+ it.m_imp->buffer,
+# endif
+ filename, file_stat, symlink_file_stat);
+
+ if (temp_ec)
+ {
+ it.m_imp.reset();
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW(
+ filesystem_error("boost::filesystem::directory_iterator::operator++",
+ it.m_imp->dir_entry.path().parent_path(),
+ error_code(BOOST_ERRNO, system_category())));
+ ec->assign(BOOST_ERRNO, system_category());
+ return;
+ }
+ else if (ec != 0) ec->clear();
+
+ if (it.m_imp->handle == 0){ it.m_imp.reset(); return; } // eof, make end
+ if (!(filename[0] == dot // !(dot or dot-dot)
+ && (filename.size()== 1
+ || (filename[1] == dot
+ && filename.size()== 2))))
+ {
+ it.m_imp->dir_entry.replace_filename(
+ filename, file_stat, symlink_file_stat);
+ return;
+ }
+ }
+ }
+} // namespace detail
+} // namespace filesystem3
+} // namespace boost
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp
new file mode 100644
index 0000000..53a4cc6
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp
@@ -0,0 +1,807 @@
+// filesystem path.cpp ------------------------------------------------------------- //
+
+// Copyright Beman Dawes 2008
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/config.hpp>
+#include <boost/filesystem/v3/path.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/assert.hpp>
+#include <cstddef>
+#include <cstring>
+#include <cassert>
+
+#ifdef BOOST_WINDOWS_API
+# include "windows_file_codecvt.hpp"
+# include <windows.h>
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+# include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
+#endif
+
+#ifdef BOOST_FILESYSTEM_DEBUG
+# include <iostream>
+# include <iomanip>
+#endif
+
+namespace fs = boost::filesystem3;
+
+using boost::filesystem3::path;
+
+using std::string;
+using std::wstring;
+
+using boost::system::error_code;
+
+#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE
+# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256
+#endif
+
+//--------------------------------------------------------------------------------------//
+// //
+// class path helpers //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+ //------------------------------------------------------------------------------------//
+ // miscellaneous class path helpers //
+ //------------------------------------------------------------------------------------//
+
+ typedef path::value_type value_type;
+ typedef path::string_type string_type;
+ typedef string_type::size_type size_type;
+
+ const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE;
+
+# ifdef BOOST_WINDOWS_API
+
+ const wchar_t separator = L'/';
+ const wchar_t preferred_separator = L'\\';
+ const wchar_t* const separators = L"/\\";
+ const wchar_t* separator_string = L"/";
+ const wchar_t* preferred_separator_string = L"\\";
+ const wchar_t colon = L':';
+ const wchar_t dot = L'.';
+ const fs::path dot_path(L".");
+ const fs::path dot_dot_path(L"..");
+
+# else
+
+ const char separator = '/';
+ const char preferred_separator = '/';
+ const char* const separators = "/";
+ const char* separator_string = "/";
+ const char* preferred_separator_string = "/";
+ const char colon = ':';
+ const char dot = '.';
+ const fs::path dot_path(".");
+ const fs::path dot_dot_path("..");
+
+# endif
+
+ inline bool is_separator(fs::path::value_type c)
+ {
+ return c == separator
+# ifdef BOOST_WINDOWS_API
+ || c == preferred_separator
+# endif
+ ;
+ }
+
+ bool is_non_root_separator(const string_type& str, size_type pos);
+ // pos is position of the separator
+
+ size_type filename_pos(const string_type& str,
+ size_type end_pos); // end_pos is past-the-end position
+ // Returns: 0 if str itself is filename (or empty)
+
+ size_type root_directory_start(const string_type& path, size_type size);
+ // Returns: npos if no root_directory found
+
+ void first_element(
+ const string_type& src,
+ size_type& element_pos,
+ size_type& element_size,
+# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) // VC++ 7.1
+ size_type size = string_type::npos
+# else
+ size_type size = -1
+# endif
+ );
+
+} // unnamed namespace
+
+//--------------------------------------------------------------------------------------//
+// //
+// class path implementation //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+namespace filesystem3
+{
+
+ path & path::operator/=(const path & p)
+ {
+ if (p.empty())
+ return *this;
+ if (!is_separator(*p.m_pathname.begin()))
+ m_append_separator_if_needed();
+ m_pathname += p.m_pathname;
+ return *this;
+ }
+
+# ifdef BOOST_WINDOWS_API
+
+ void path::m_portable()
+ {
+ for (string_type::iterator it = m_pathname.begin();
+ it != m_pathname.end(); ++it)
+ {
+ if (*it == L'\\')
+ *it = L'/';
+ }
+ }
+
+ const std::string path::generic_string(const codecvt_type& cvt) const
+ {
+ path tmp(*this);
+ tmp.m_portable();
+ return tmp.string(cvt);
+ }
+
+ const std::wstring path::generic_wstring() const
+ {
+ path tmp(*this);
+ tmp.m_portable();
+ return tmp.wstring();
+ }
+
+# endif // BOOST_WINDOWS_API
+
+ // m_append_separator_if_needed ----------------------------------------------------//
+
+ path::string_type::size_type path::m_append_separator_if_needed()
+ {
+ if (!m_pathname.empty() &&
+# ifdef BOOST_WINDOWS_API
+ *(m_pathname.end()-1) != colon &&
+# endif
+ !is_separator(*(m_pathname.end()-1)))
+ {
+ string_type::size_type tmp(m_pathname.size());
+ m_pathname += preferred_separator;
+ return tmp;
+ }
+ return 0;
+ }
+
+ // m_erase_redundant_separator -----------------------------------------------------//
+
+ void path::m_erase_redundant_separator(string_type::size_type sep_pos)
+ {
+ if (sep_pos // a separator was added
+ && sep_pos < m_pathname.size() // and something was appended
+ && (m_pathname[sep_pos+1] == separator // and it was also separator
+# ifdef BOOST_WINDOWS_API
+ || m_pathname[sep_pos+1] == preferred_separator // or preferred_separator
+# endif
+)) { m_pathname.erase(sep_pos, 1); } // erase the added separator
+ }
+
+ // modifiers -----------------------------------------------------------------------//
+
+# ifdef BOOST_WINDOWS_API
+ path & path::make_preferred()
+ {
+ for (string_type::iterator it = m_pathname.begin();
+ it != m_pathname.end(); ++it)
+ {
+ if (*it == L'/')
+ *it = L'\\';
+ }
+ return *this;
+ }
+# endif
+
+ path& path::remove_filename()
+ {
+ m_pathname.erase(m_parent_path_end());
+ return *this;
+ }
+
+ path & path::replace_extension(const path & source)
+ {
+ // erase existing extension if any
+ size_type pos(m_pathname.rfind(dot));
+ if (pos != string_type::npos && pos >= filename_pos(m_pathname, m_pathname.size()))
+ m_pathname.erase(pos);
+
+ // append source extension if any
+ pos = source.m_pathname.rfind(dot);
+ if (pos != string_type::npos)
+ m_pathname += source.c_str() + pos;
+
+ return *this;
+ }
+
+ // decomposition -------------------------------------------------------------------//
+
+ path path::root_path() const
+ {
+ path temp(root_name());
+ if (!root_directory().empty()) temp.m_pathname += root_directory().c_str();
+ return temp;
+ }
+
+ path path::root_name() const
+ {
+ iterator itr(begin());
+
+ return (itr.m_pos != m_pathname.size()
+ && (
+ (itr.m_element.m_pathname.size() > 1
+ && is_separator(itr.m_element.m_pathname[0])
+ && is_separator(itr.m_element.m_pathname[1])
+ )
+# ifdef BOOST_WINDOWS_API
+ || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon
+# endif
+ ))
+ ? itr.m_element
+ : path();
+ }
+
+ path path::root_directory() const
+ {
+ size_type pos(root_directory_start(m_pathname, m_pathname.size()));
+
+ return pos == string_type::npos
+ ? path()
+ : path(m_pathname.c_str() + pos, m_pathname.c_str() + pos + 1);
+ }
+
+ path path::relative_path() const
+ {
+ iterator itr(begin());
+
+ for (; itr.m_pos != m_pathname.size()
+ && (is_separator(itr.m_element.m_pathname[0])
+# ifdef BOOST_WINDOWS_API
+ || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon
+# endif
+ ); ++itr) {}
+
+ return path(m_pathname.c_str() + itr.m_pos);
+ }
+
+ string_type::size_type path::m_parent_path_end() const
+ {
+ size_type end_pos(filename_pos(m_pathname, m_pathname.size()));
+
+ bool filename_was_separator(m_pathname.size()
+ && is_separator(m_pathname[end_pos]));
+
+ // skip separators unless root directory
+ size_type root_dir_pos(root_directory_start(m_pathname, end_pos));
+ for (;
+ end_pos > 0
+ && (end_pos-1) != root_dir_pos
+ && is_separator(m_pathname[end_pos-1])
+ ;
+ --end_pos) {}
+
+ return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator)
+ ? string_type::npos
+ : end_pos;
+ }
+
+ path path::parent_path() const
+ {
+ size_type end_pos(m_parent_path_end());
+ return end_pos == string_type::npos
+ ? path()
+ : path(m_pathname.c_str(), m_pathname.c_str() + end_pos);
+ }
+
+ path path::filename() const
+ {
+ size_type pos(filename_pos(m_pathname, m_pathname.size()));
+ return (m_pathname.size()
+ && pos
+ && is_separator(m_pathname[pos])
+ && is_non_root_separator(m_pathname, pos))
+ ? dot_path
+ : path(m_pathname.c_str() + pos);
+ }
+
+ path path::stem() const
+ {
+ path name(filename());
+ if (name == dot_path || name == dot_dot_path) return name;
+ size_type pos(name.m_pathname.rfind(dot));
+ return pos == string_type::npos
+ ? name
+ : path(name.m_pathname.c_str(), name.m_pathname.c_str() + pos);
+ }
+
+ path path::extension() const
+ {
+ path name(filename());
+ if (name == dot_path || name == dot_dot_path) return path();
+ size_type pos(name.m_pathname.rfind(dot));
+ return pos == string_type::npos
+ ? path()
+ : path(name.m_pathname.c_str() + pos);
+ }
+
+ // m_normalize ----------------------------------------------------------------------//
+
+ path& path::m_normalize()
+ {
+ if (m_pathname.empty()) return *this;
+
+ path temp;
+ iterator start(begin());
+ iterator last(end());
+ iterator stop(last--);
+ for (iterator itr(start); itr != stop; ++itr)
+ {
+ // ignore "." except at start and last
+ if (itr->native().size() == 1
+ && (itr->native())[0] == dot
+ && itr != start
+ && itr != last) continue;
+
+ // ignore a name and following ".."
+ if (!temp.empty()
+ && itr->native().size() == 2
+ && (itr->native())[0] == dot
+ && (itr->native())[1] == dot) // dot dot
+ {
+ string_type lf(temp.filename().native());
+ if (lf.size() > 0
+ && (lf.size() != 1
+ || (lf[0] != dot
+ && lf[0] != separator))
+ && (lf.size() != 2
+ || (lf[0] != dot
+ && lf[1] != dot
+# ifdef BOOST_WINDOWS_API
+ && lf[1] != colon
+# endif
+ )
+ )
+ )
+ {
+ temp.remove_filename();
+ // if not root directory, must also remove "/" if any
+ if (temp.m_pathname.size() > 0
+ && temp.m_pathname[temp.m_pathname.size()-1]
+ == separator)
+ {
+ string_type::size_type rds(
+ root_directory_start(temp.m_pathname, temp.m_pathname.size()));
+ if (rds == string_type::npos
+ || rds != temp.m_pathname.size()-1)
+ { temp.m_pathname.erase(temp.m_pathname.size()-1); }
+ }
+
+ iterator next(itr);
+ if (temp.empty() && ++next != stop
+ && next == last && *last == dot_path) temp /= dot_path;
+ continue;
+ }
+ }
+
+ temp /= *itr;
+ };
+
+ if (temp.empty()) temp /= dot_path;
+ m_pathname = temp.m_pathname;
+ return *this;
+ }
+
+} // namespace filesystem3
+} // namespace boost
+
+//--------------------------------------------------------------------------------------//
+// //
+// class path helpers implementation //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+
+ // is_non_root_separator -------------------------------------------------//
+
+ bool is_non_root_separator(const string_type & str, size_type pos)
+ // pos is position of the separator
+ {
+ BOOST_ASSERT(!str.empty() && is_separator(str[pos])
+ && "precondition violation");
+
+ // subsequent logic expects pos to be for leftmost slash of a set
+ while (pos > 0 && is_separator(str[pos-1]))
+ --pos;
+
+ return pos != 0
+ && (pos <= 2 || !is_separator(str[1])
+ || str.find_first_of(separators, 2) != pos)
+# ifdef BOOST_WINDOWS_API
+ && (pos !=2 || str[1] != colon)
+# endif
+ ;
+ }
+
+ // filename_pos --------------------------------------------------------------------//
+
+ size_type filename_pos(const string_type & str,
+ size_type end_pos) // end_pos is past-the-end position
+ // return 0 if str itself is filename (or empty)
+ {
+ // case: "//"
+ if (end_pos == 2
+ && is_separator(str[0])
+ && is_separator(str[1])) return 0;
+
+ // case: ends in "/"
+ if (end_pos && is_separator(str[end_pos-1]))
+ return end_pos-1;
+
+ // set pos to start of last element
+ size_type pos(str.find_last_of(separators, end_pos-1));
+
+# ifdef BOOST_WINDOWS_API
+ if (pos == string_type::npos)
+ pos = str.find_last_of(colon, end_pos-2);
+# endif
+
+ return (pos == string_type::npos // path itself must be a filename (or empty)
+ || (pos == 1 && is_separator(str[0]))) // or net
+ ? 0 // so filename is entire string
+ : pos + 1; // or starts after delimiter
+ }
+
+ // root_directory_start ------------------------------------------------------------//
+
+ size_type root_directory_start(const string_type & path, size_type size)
+ // return npos if no root_directory found
+ {
+
+# ifdef BOOST_WINDOWS_API
+ // case "c:/"
+ if (size > 2
+ && path[1] == colon
+ && is_separator(path[2])) return 2;
+# endif
+
+ // case "//"
+ if (size == 2
+ && is_separator(path[0])
+ && is_separator(path[1])) return string_type::npos;
+
+ // case "//net {/}"
+ if (size > 3
+ && is_separator(path[0])
+ && is_separator(path[1])
+ && !is_separator(path[2]))
+ {
+ string_type::size_type pos(path.find_first_of(separators, 2));
+ return pos < size ? pos : string_type::npos;
+ }
+
+ // case "/"
+ if (size > 0 && is_separator(path[0])) return 0;
+
+ return string_type::npos;
+ }
+
+ // first_element --------------------------------------------------------------------//
+ // sets pos and len of first element, excluding extra separators
+ // if src.empty(), sets pos,len, to 0,0.
+
+ void first_element(
+ const string_type & src,
+ size_type & element_pos,
+ size_type & element_size,
+ size_type size
+)
+ {
+ if (size == string_type::npos) size = src.size();
+ element_pos = 0;
+ element_size = 0;
+ if (src.empty()) return;
+
+ string_type::size_type cur(0);
+
+ // deal with // [network]
+ if (size >= 2 && is_separator(src[0])
+ && is_separator(src[1])
+ && (size == 2
+ || !is_separator(src[2])))
+ {
+ cur += 2;
+ element_size += 2;
+ }
+
+ // leading (not non-network) separator
+ else if (is_separator(src[0]))
+ {
+ ++element_size;
+ // bypass extra leading separators
+ while (cur+1 < size
+ && is_separator(src[cur+1]))
+ {
+ ++cur;
+ ++element_pos;
+ }
+ return;
+ }
+
+ // at this point, we have either a plain name, a network name,
+ // or (on Windows only) a device name
+
+ // find the end
+ while (cur < size
+# ifdef BOOST_WINDOWS_API
+ && src[cur] != colon
+# endif
+ && !is_separator(src[cur]))
+ {
+ ++cur;
+ ++element_size;
+ }
+
+# ifdef BOOST_WINDOWS_API
+ if (cur == size) return;
+ // include device delimiter
+ if (src[cur] == colon)
+ { ++element_size; }
+# endif
+
+ return;
+ }
+
+} // unnammed namespace
+
+//--------------------------------------------------------------------------------------//
+// //
+// class path::iterator implementation //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+namespace filesystem3
+{
+
+ path::iterator path::begin() const
+ {
+ iterator itr;
+ itr.m_path_ptr = this;
+ size_type element_size;
+ first_element(m_pathname, itr.m_pos, element_size);
+ itr.m_element = m_pathname.substr(itr.m_pos, element_size);
+ if (itr.m_element.m_pathname == preferred_separator_string)
+ itr.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX
+ return itr;
+ }
+
+ path::iterator path::end() const
+ {
+ iterator itr;
+ itr.m_path_ptr = this;
+ itr.m_pos = m_pathname.size();
+ return itr;
+ }
+
+ void path::m_path_iterator_increment(path::iterator & it)
+ {
+ BOOST_ASSERT(it.m_pos < it.m_path_ptr->m_pathname.size() && "path::basic_iterator increment past end()");
+
+ // increment to position past current element
+ it.m_pos += it.m_element.m_pathname.size();
+
+ // if end reached, create end basic_iterator
+ if (it.m_pos == it.m_path_ptr->m_pathname.size())
+ {
+ it.m_element.clear();
+ return;
+ }
+
+ // both POSIX and Windows treat paths that begin with exactly two separators specially
+ bool was_net(it.m_element.m_pathname.size() > 2
+ && is_separator(it.m_element.m_pathname[0])
+ && is_separator(it.m_element.m_pathname[1])
+ && !is_separator(it.m_element.m_pathname[2]));
+
+ // process separator (Windows drive spec is only case not a separator)
+ if (is_separator(it.m_path_ptr->m_pathname[it.m_pos]))
+ {
+ // detect root directory
+ if (was_net
+# ifdef BOOST_WINDOWS_API
+ // case "c:/"
+ || it.m_element.m_pathname[it.m_element.m_pathname.size()-1] == colon
+# endif
+ )
+ {
+ it.m_element.m_pathname = separator;
+ return;
+ }
+
+ // bypass separators
+ while (it.m_pos != it.m_path_ptr->m_pathname.size()
+ && is_separator(it.m_path_ptr->m_pathname[it.m_pos]))
+ { ++it.m_pos; }
+
+ // detect trailing separator, and treat it as ".", per POSIX spec
+ if (it.m_pos == it.m_path_ptr->m_pathname.size()
+ && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1))
+ {
+ --it.m_pos;
+ it.m_element = dot_path;
+ return;
+ }
+ }
+
+ // get next element
+ size_type end_pos(it.m_path_ptr->m_pathname.find_first_of(separators, it.m_pos));
+ if (end_pos == string_type::npos) end_pos = it.m_path_ptr->m_pathname.size();
+ it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos);
+ }
+
+ void path::m_path_iterator_decrement(path::iterator & it)
+ {
+ BOOST_ASSERT(it.m_pos && "path::iterator decrement past begin()");
+
+ size_type end_pos(it.m_pos);
+
+ // if at end and there was a trailing non-root '/', return "."
+ if (it.m_pos == it.m_path_ptr->m_pathname.size()
+ && it.m_path_ptr->m_pathname.size() > 1
+ && is_separator(it.m_path_ptr->m_pathname[it.m_pos-1])
+ && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)
+ )
+ {
+ --it.m_pos;
+ it.m_element = dot_path;
+ return;
+ }
+
+ size_type root_dir_pos(root_directory_start(it.m_path_ptr->m_pathname, end_pos));
+
+ // skip separators unless root directory
+ for (
+ ;
+ end_pos > 0
+ && (end_pos-1) != root_dir_pos
+ && is_separator(it.m_path_ptr->m_pathname[end_pos-1])
+ ;
+ --end_pos) {}
+
+ it.m_pos = filename_pos(it.m_path_ptr->m_pathname, end_pos);
+ it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos);
+ if (it.m_element.m_pathname == preferred_separator_string)
+ it.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX
+ }
+
+} // namespace filesystem3
+} // namespace boost
+
+//--------------------------------------------------------------------------------------//
+// //
+// detail helpers //
+// //
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+
+ //------------------------------------------------------------------------------------//
+ // locale helpers //
+ //------------------------------------------------------------------------------------//
+
+ // std::locale construction can throw (if LC_MESSAGES is wrong, for example),
+ // so a static at function scope is used to ensure that exceptions can be
+ // caught. (A previous version was at namespace scope, so initialization
+ // occurred before main(), preventing exceptions from being caught.)
+
+ std::locale default_locale()
+ {
+# ifdef BOOST_WINDOWS_API
+ std::locale global_loc = std::locale();
+ std::locale loc(global_loc, new windows_file_codecvt);
+ return loc;
+
+# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ // "All BSD system functions expect their string parameters to be in UTF-8 encoding
+ // and nothing else." http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html
+ //
+ // "The kernel will reject any filename that is not a valid UTF-8 string, and it will
+ // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS.
+ // The right way to deal with it would be to always convert the filename to UTF-8
+ // before trying to open/create a file." http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html
+ //
+ // "How a file name looks at the API level depends on the API. Current Carbon APIs
+ // handle file names as an array of UTF-16 characters; POSIX ones handle them as an
+ // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk
+ // depends on the disk format; HFS+ uses UTF-16, but that's not important in most
+ // cases." http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html
+ //
+ // Many thanks to Peter Dimov for digging out the above references!
+ std::locale global_loc = std::locale();
+ std::locale loc(global_loc, new boost::filesystem::detail::utf8_codecvt_facet);
+ return loc;
+
+# else
+ // ISO C calls this "the locale-specific native environment":
+ return std::locale("");
+
+# endif
+ }
+
+ std::locale & path_locale()
+ {
+ static std::locale loc(default_locale());
+ return loc;
+ }
+
+} // unnamed namespace
+
+//--------------------------------------------------------------------------------------//
+// path::imbue implementation //
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+namespace filesystem3
+{
+
+ const path::codecvt_type *&
+ path::wchar_t_codecvt_facet()
+ {
+ static const std::codecvt<wchar_t, char, std::mbstate_t> *
+ facet(
+ &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >
+ (path_locale()));
+ return facet;
+ }
+
+ std::locale path::imbue(const std::locale & loc)
+ {
+ std::locale temp(path_locale());
+ path_locale() = loc;
+ wchar_t_codecvt_facet() = &std::use_facet
+ <std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale());
+ return temp;
+ }
+
+} // namespace filesystem3
+} // namespace boost
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp
new file mode 100644
index 0000000..6606437
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp
@@ -0,0 +1,209 @@
+// filesystem path_traits.cpp --------------------------------------------------------//
+
+// Copyright Beman Dawes 2008, 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/config.hpp>
+#include <boost/filesystem/v3/path_traits.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/scoped_array.hpp>
+#include <locale> // for codecvt_base::result
+#include <cstring> // for strlen
+#include <cwchar> // for wcslen
+
+namespace pt = boost::filesystem3::path_traits;
+namespace fs = boost::filesystem3;
+namespace bs = boost::system;
+
+//--------------------------------------------------------------------------------------//
+// configuration //
+//--------------------------------------------------------------------------------------//
+
+#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE
+# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256
+#endif
+
+namespace {
+
+ const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE;
+
+
+//--------------------------------------------------------------------------------------//
+// //
+// The public convert() functions do buffer management, and then forward to the //
+// convert_aux() functions for the actual call to the codecvt facet. //
+// //
+//--------------------------------------------------------------------------------------//
+
+//--------------------------------------------------------------------------------------//
+// convert_aux const char* to wstring //
+//--------------------------------------------------------------------------------------//
+
+ void convert_aux(
+ const char* from,
+ const char* from_end,
+ wchar_t* to, wchar_t* to_end,
+ std::wstring & target,
+ const pt::codecvt_type & cvt)
+ {
+ //std::cout << std::hex
+ // << " from=" << std::size_t(from)
+ // << " from_end=" << std::size_t(from_end)
+ // << " to=" << std::size_t(to)
+ // << " to_end=" << std::size_t(to_end)
+ // << std::endl;
+
+ std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports
+ const char* from_next;
+ wchar_t* to_next;
+
+ std::codecvt_base::result res;
+
+ if ((res=cvt.in(state, from, from_end, from_next,
+ to, to_end, to_next)) != std::codecvt_base::ok)
+ {
+ //std::cout << " result is " << static_cast<int>(res) << std::endl;
+ BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(),
+ "boost::filesystem::path codecvt to wstring"));
+ }
+ target.append(to, to_next);
+ }
+
+//--------------------------------------------------------------------------------------//
+// convert_aux const wchar_t* to string //
+//--------------------------------------------------------------------------------------//
+
+ void convert_aux(
+ const wchar_t* from,
+ const wchar_t* from_end,
+ char* to, char* to_end,
+ std::string & target,
+ const pt::codecvt_type & cvt)
+ {
+ //std::cout << std::hex
+ // << " from=" << std::size_t(from)
+ // << " from_end=" << std::size_t(from_end)
+ // << " to=" << std::size_t(to)
+ // << " to_end=" << std::size_t(to_end)
+ // << std::endl;
+
+ std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports
+ const wchar_t* from_next;
+ char* to_next;
+
+ std::codecvt_base::result res;
+
+ if ((res=cvt.out(state, from, from_end, from_next,
+ to, to_end, to_next)) != std::codecvt_base::ok)
+ {
+ //std::cout << " result is " << static_cast<int>(res) << std::endl;
+ BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(),
+ "boost::filesystem::path codecvt to string"));
+ }
+ target.append(to, to_next);
+ }
+
+} // unnamed namespace
+
+//--------------------------------------------------------------------------------------//
+// path_traits //
+//--------------------------------------------------------------------------------------//
+
+namespace boost { namespace filesystem3 { namespace path_traits {
+
+//--------------------------------------------------------------------------------------//
+// convert const char* to wstring //
+//--------------------------------------------------------------------------------------//
+
+ BOOST_FILESYSTEM_DECL
+ void convert(const char* from,
+ const char* from_end, // 0 for null terminated MBCS
+ std::wstring & to,
+ const codecvt_type & cvt)
+ {
+ BOOST_ASSERT(from);
+
+ if (!from_end) // null terminated
+ {
+ from_end = from + std::strlen(from);
+ }
+
+ if (from == from_end) return;
+
+ std::size_t buf_size = (from_end - from) * 3; // perhaps too large, but that's OK
+
+ // dynamically allocate a buffer only if source is unusually large
+ if (buf_size > default_codecvt_buf_size)
+ {
+ boost::scoped_array< wchar_t > buf(new wchar_t [buf_size]);
+ convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt);
+ }
+ else
+ {
+ wchar_t buf[default_codecvt_buf_size];
+ convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt);
+ }
+ }
+
+//--------------------------------------------------------------------------------------//
+// convert const wchar_t* to string //
+//--------------------------------------------------------------------------------------//
+
+ BOOST_FILESYSTEM_DECL
+ void convert(const wchar_t* from,
+ const wchar_t* from_end, // 0 for null terminated MBCS
+ std::string & to,
+ const codecvt_type & cvt)
+ {
+ BOOST_ASSERT(from);
+
+ if (!from_end) // null terminated
+ {
+ from_end = from + std::wcslen(from);
+ }
+
+ if (from == from_end) return;
+
+ // The codecvt length functions may not be implemented, and I don't really
+ // understand them either. Thus this code is just a guess; if it turns
+ // out the buffer is too small then an error will be reported and the code
+ // will have to be fixed.
+ std::size_t buf_size = (from_end - from) * 4; // perhaps too large, but that's OK
+ buf_size += 4; // encodings like shift-JIS need some prefix space
+
+ // dynamically allocate a buffer only if source is unusually large
+ if (buf_size > default_codecvt_buf_size)
+ {
+ boost::scoped_array< char > buf(new char [buf_size]);
+ convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt);
+ }
+ else
+ {
+ char buf[default_codecvt_buf_size];
+ convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt);
+ }
+ }
+}}} // namespace boost::filesystem3::path_traits
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp
new file mode 100644
index 0000000..31e0176
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp
@@ -0,0 +1,128 @@
+// portability.cpp -------------------------------------------------------------------//
+
+// Copyright 2002-2005 Beman Dawes
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
+// at http://www.boost.org/LICENSE_1_0.txt)
+
+// See library home page at http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/config.hpp>
+#include <boost/filesystem/v3/path.hpp>
+
+namespace fs = boost::filesystem3;
+
+#include <cstring> // SGI MIPSpro compilers need this
+
+# ifdef BOOST_NO_STDC_NAMESPACE
+ namespace std { using ::strerror; }
+# endif
+
+//--------------------------------------------------------------------------------------//
+
+namespace
+{
+ const char invalid_chars[] =
+ "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
+ "<>:\"/\\|";
+ // note that the terminating '\0' is part of the string - thus the size below
+ // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I
+ const std::string windows_invalid_chars(invalid_chars, sizeof(invalid_chars));
+
+ const std::string valid_posix(
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-");
+
+} // unnamed namespace
+
+namespace boost
+{
+ namespace filesystem3
+ {
+
+ // name_check functions ----------------------------------------------//
+
+# ifdef BOOST_WINDOWS
+ BOOST_FILESYSTEM_DECL bool native(const std::string & name)
+ {
+ return windows_name(name);
+ }
+# else
+ BOOST_FILESYSTEM_DECL bool native(const std::string & name)
+ {
+ return name.size() != 0
+ && name[0] != ' '
+ && name.find('/') == std::string::npos;
+ }
+# endif
+
+ BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name)
+ {
+ return name.size() != 0
+ && name.find_first_not_of(valid_posix) == std::string::npos;
+ }
+
+ BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name)
+ {
+ return name.size() != 0
+ && name[0] != ' '
+ && name.find_first_of(windows_invalid_chars) == std::string::npos
+ && *(name.end()-1) != ' '
+ && (*(name.end()-1) != '.'
+ || name.length() == 1 || name == "..");
+ }
+
+ BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name)
+ {
+ return
+ name.size() != 0
+ && (name == "."
+ || name == ".."
+ || (windows_name(name)
+ && portable_posix_name(name)
+ && name[0] != '.' && name[0] != '-'));
+ }
+
+ BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name)
+ {
+ return
+ name == "."
+ || name == ".."
+ || (portable_name(name)
+ && name.find('.') == std::string::npos);
+ }
+
+ BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name)
+ {
+ std::string::size_type pos;
+ return
+ portable_name(name)
+ && name != "."
+ && name != ".."
+ && ((pos = name.find('.')) == std::string::npos
+ || (name.find('.', pos+1) == std::string::npos
+ && (pos + 5) > name.length()))
+ ;
+ }
+
+ } // namespace filesystem3
+} // namespace boost
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp
new file mode 100644
index 0000000..1569b32
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp
@@ -0,0 +1,151 @@
+// filesystem system_crypt_random.cpp ------------------------------------------------//
+
+// Copyright Beman Dawes 2010
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/operations.hpp>
+
+# ifdef BOOST_POSIX_API
+# include <fcntl.h>
+# else // BOOST_WINDOWS_API
+# include <windows.h>
+# include <wincrypt.h>
+# pragma comment(lib, "Advapi32.lib")
+# endif
+
+namespace {
+
+void fail(int err, boost::system::error_code* ec)
+{
+ if (ec == 0)
+ BOOST_FILESYSTEM_THROW( boost::system::system_error(err,
+ boost::system::system_category(),
+ "boost::filesystem::unique_path"));
+
+ ec->assign(err, boost::system::system_category());
+ return;
+}
+
+void system_crypt_random(void* buf, std::size_t len, boost::system::error_code* ec)
+{
+# ifdef BOOST_POSIX_API
+
+ int file = open("/dev/urandom", O_RDONLY);
+ if (file == -1)
+ {
+ file = open("/dev/random", O_RDONLY);
+ if (file == -1)
+ {
+ fail(errno, ec);
+ return;
+ }
+ }
+
+ size_t bytes_read = 0;
+ while (bytes_read < len)
+ {
+ ssize_t n = read(file, buf, len - bytes_read);
+ if (n == -1)
+ {
+ close(file);
+ fail(errno, ec);
+ return;
+ }
+ bytes_read += n;
+ buf = static_cast<char*>(buf) + n;
+ }
+
+ close(file);
+
+# else // BOOST_WINDOWS_API
+
+ HCRYPTPROV handle;
+ int errval = 0;
+
+ if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0))
+ {
+ errval = ::GetLastError();
+ if (errval == NTE_BAD_KEYSET)
+ {
+ if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET))
+ {
+ errval = ::GetLastError();
+ }
+ else errval = 0;
+ }
+ }
+
+ if (!errval)
+ {
+ BOOL gen_ok = ::CryptGenRandom(handle, len, static_cast<unsigned char*>(buf));
+ if (!gen_ok)
+ errval = ::GetLastError();
+ ::CryptReleaseContext(handle, 0);
+ }
+
+ if (!errval) return;
+
+ fail(errval, ec);
+# endif
+}
+
+} // unnamed namespace
+
+namespace boost { namespace filesystem3 { namespace detail {
+
+BOOST_FILESYSTEM_DECL
+path unique_path(const path& model, system::error_code* ec)
+{
+ std::wstring s (model.wstring()); // std::string ng for MBCS encoded POSIX
+ const wchar_t hex[] = L"0123456789abcdef";
+ const int n_ran = 16;
+ const int max_nibbles = 2 * n_ran; // 4-bits per nibble
+ char ran[n_ran];
+
+ int nibbles_used = max_nibbles;
+ for(std::wstring::size_type i=0; i < s.size(); ++i)
+ {
+ if (s[i] == L'%') // digit request
+ {
+ if (nibbles_used == max_nibbles)
+ {
+ system_crypt_random(ran, sizeof(ran), ec);
+ if (ec != 0 && *ec)
+ return "";
+ nibbles_used = 0;
+ }
+ int c = ran[nibbles_used/2];
+ c >>= 4 * (nibbles_used++ & 1); // if odd, shift right 1 nibble
+ s[i] = hex[c & 0xf]; // convert to hex digit and replace
+ }
+ }
+
+ if (ec != 0) ec->clear();
+
+ return s;
+}
+
+}}}
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/utf8_codecvt_facet.cpp
index 3fe3e95..1849a1a 100644
--- a/3rdParty/Boost/src/libs/filesystem/src/utf8_codecvt_facet.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/utf8_codecvt_facet.cpp
@@ -3,6 +3,10 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
#define BOOST_FILESYSTEM_SOURCE
#include <boost/filesystem/config.hpp>
@@ -14,7 +18,6 @@
#include "libs/detail/utf8_codecvt_facet.cpp"
-
#undef BOOST_UTF8_BEGIN_NAMESPACE
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp
new file mode 100644
index 0000000..dd89c02
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp
@@ -0,0 +1,79 @@
+// filesystem windows_file_codecvt.cpp -----------------------------------------//
+
+// Copyright Beman Dawes 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+//--------------------------------------------------------------------------------------//
+
+#include <boost/config.hpp>
+#if !defined( BOOST_NO_STD_WSTRING )
+// Boost.Filesystem V3 and later requires std::wstring support.
+// During the transition to V3, libraries are compiled with both V2 and V3 sources.
+// On old compilers that don't support V3 anyhow, we just skip everything so the compile
+// will succeed and the library can be built.
+
+// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows
+// the library is being built (possibly exporting rather than importing code)
+#define BOOST_FILESYSTEM_SOURCE
+
+#ifndef BOOST_SYSTEM_NO_DEPRECATED
+# define BOOST_SYSTEM_NO_DEPRECATED
+#endif
+
+#include <boost/filesystem/v3/config.hpp>
+#include <cwchar> // for mbstate_t
+
+#ifdef BOOST_WINDOWS_API
+
+#include "windows_file_codecvt.hpp"
+
+#define WINVER 0x0500 // MinGW for GCC 4.4 requires this
+#include <windows.h>
+
+ std::codecvt_base::result windows_file_codecvt::do_in(
+ std::mbstate_t &,
+ const char* from, const char* from_end, const char*& from_next,
+ wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const
+ {
+ UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP;
+
+ int count;
+ if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from,
+ from_end - from, to, to_end - to)) == 0)
+ {
+ return error; // conversion failed
+ }
+
+ from_next = from_end;
+ to_next = to + count;
+ *to_next = L'\0';
+ return ok;
+ }
+
+ std::codecvt_base::result windows_file_codecvt::do_out(
+ std::mbstate_t &,
+ const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next,
+ char* to, char* to_end, char* & to_next) const
+ {
+ UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP;
+
+ int count;
+ if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from,
+ from_end - from, to, to_end - to, 0, 0)) == 0)
+ {
+ return error; // conversion failed
+ }
+
+ from_next = from_end;
+ to_next = to + count;
+ *to_next = '\0';
+ return ok;
+ }
+
+ # endif // BOOST_WINDOWS_API
+
+#endif // no wide character support
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp
new file mode 100644
index 0000000..d845d37
--- /dev/null
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp
@@ -0,0 +1,56 @@
+// filesystem windows_file_codecvt.hpp -----------------------------------------------//
+
+// Copyright Beman Dawes 2009
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// Library home page: http://www.boost.org/libs/filesystem
+
+#ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
+#define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
+
+#include <boost/filesystem/v3/config.hpp>
+#include <locale>
+
+ //------------------------------------------------------------------------------------//
+ // //
+ // class windows_file_codecvt //
+ // //
+ // Warning: partial implementation; even do_in and do_out only partially meet the //
+ // standard library specifications as the "to" buffer must hold the entire result. //
+ // //
+ //------------------------------------------------------------------------------------//
+
+ class BOOST_FILESYSTEM_DECL windows_file_codecvt
+ : public std::codecvt< wchar_t, char, std::mbstate_t >
+ {
+ public:
+ explicit windows_file_codecvt()
+ : std::codecvt<wchar_t, char, std::mbstate_t>() {}
+ protected:
+
+ virtual bool do_always_noconv() const throw() { return false; }
+
+ // seems safest to assume variable number of characters since we don't
+ // actually know what codepage is active
+ virtual int do_encoding() const throw() { return 0; }
+
+ virtual std::codecvt_base::result do_in(std::mbstate_t& state,
+ const char* from, const char* from_end, const char*& from_next,
+ wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const;
+
+ virtual std::codecvt_base::result do_out(std::mbstate_t & state,
+ const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next,
+ char* to, char* to_end, char*& to_next) const;
+
+ virtual std::codecvt_base::result do_unshift(std::mbstate_t&,
+ char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; }
+
+ virtual int do_length(std::mbstate_t&,
+ const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; }
+
+ virtual int do_max_length() const throw () { return 0; }
+ };
+
+#endif // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
diff --git a/3rdParty/Boost/src/libs/program_options/src/options_description.cpp b/3rdParty/Boost/src/libs/program_options/src/options_description.cpp
index bfd113d..0d8dfd4 100644
--- a/3rdParty/Boost/src/libs/program_options/src/options_description.cpp
+++ b/3rdParty/Boost/src/libs/program_options/src/options_description.cpp
@@ -306,6 +306,7 @@ namespace boost { namespace program_options {
bool short_ignore_case) const
{
shared_ptr<option_description> found;
+ bool had_full_match = false;
vector<string> approximate_matches;
vector<string> full_matches;
@@ -323,15 +324,17 @@ namespace boost { namespace program_options {
if (r == option_description::full_match)
{
full_matches.push_back(m_options[i]->key(name));
+ found = m_options[i];
+ had_full_match = true;
}
else
{
// FIXME: the use of 'key' here might not
// be the best approach.
approximate_matches.push_back(m_options[i]->key(name));
+ if (!had_full_match)
+ found = m_options[i];
}
-
- found = m_options[i];
}
if (full_matches.size() > 1)
boost::throw_exception(
diff --git a/3rdParty/Boost/src/libs/program_options/src/winmain.cpp b/3rdParty/Boost/src/libs/program_options/src/winmain.cpp
index 64cc790..8a7c43f 100644
--- a/3rdParty/Boost/src/libs/program_options/src/winmain.cpp
+++ b/3rdParty/Boost/src/libs/program_options/src/winmain.cpp
@@ -30,6 +30,7 @@ namespace boost { namespace program_options {
std::string current;
bool inside_quoted = false;
+ bool empty_quote = false;
int backslash_count = 0;
for(; i != e; ++i) {
@@ -38,6 +39,7 @@ namespace boost { namespace program_options {
// n/2 backslashes and is a quoted block delimiter
if (backslash_count % 2 == 0) {
current.append(backslash_count / 2, '\\');
+ empty_quote = inside_quoted && current.empty();
inside_quoted = !inside_quoted;
// '"' preceded by odd number (n) of backslashes generates
// (n-1)/2 backslashes and is literal quote.
@@ -59,6 +61,7 @@ namespace boost { namespace program_options {
// Space outside quoted section terminate the current argument
result.push_back(current);
current.resize(0);
+ empty_quote = false;
for(;i != e && isspace((unsigned char)*i); ++i)
;
--i;
@@ -74,7 +77,7 @@ namespace boost { namespace program_options {
// If we have non-empty 'current' or we're still in quoted
// section (even if 'current' is empty), add the last token.
- if (!current.empty() || inside_quoted)
+ if (!current.empty() || inside_quoted || empty_quote)
result.push_back(current);
}
return result;
@@ -94,3 +97,4 @@ namespace boost { namespace program_options {
}}
#endif
+
diff --git a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp
index 6466bc4..a99de14 100644
--- a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp
@@ -155,16 +155,16 @@ c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::loo
char_class_xdigit,
};
- int id = ::boost::re_detail::get_default_class_id(p1, p2);
- if(id < 0)
+ int idx = ::boost::re_detail::get_default_class_id(p1, p2);
+ if(idx < 0)
{
std::string s(p1, p2);
for(std::string::size_type i = 0; i < s.size(); ++i)
s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
- id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
}
- BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0]));
- return masks[id+1];
+ BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0]));
+ return masks[idx+1];
}
bool BOOST_REGEX_CALL c_regex_traits<char>::isctype(char c, char_class_type mask)
diff --git a/3rdParty/Boost/src/libs/regex/src/cregex.cpp b/3rdParty/Boost/src/libs/regex/src/cregex.cpp
index f67d371..5c27330 100644
--- a/3rdParty/Boost/src/libs/regex/src/cregex.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/cregex.cpp
@@ -31,6 +31,9 @@ typedef boost::match_flag_type match_flag_type;
#ifdef BOOST_MSVC
#pragma warning(disable:4309)
#endif
+#ifdef BOOST_INTEL
+#pragma warning(disable:981 383)
+#endif
namespace boost{
diff --git a/3rdParty/Boost/src/libs/regex/src/icu.cpp b/3rdParty/Boost/src/libs/regex/src/icu.cpp
index a815e91..2fa2b3b 100644
--- a/3rdParty/Boost/src/libs/regex/src/icu.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/icu.cpp
@@ -22,6 +22,10 @@
#define BOOST_REGEX_ICU_INSTANTIATE
#include <boost/regex/icu.hpp>
+#ifdef BOOST_INTEL
+#pragma warning(disable:981 2259 383)
+#endif
+
namespace boost{
namespace re_detail{
@@ -388,14 +392,14 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_
char_class_type(U_GC_ND_MASK) | mask_xdigit,
};
- int id = ::boost::re_detail::get_default_class_id(p1, p2);
- if(id >= 0)
- return masks[id+1];
+ int idx = ::boost::re_detail::get_default_class_id(p1, p2);
+ if(idx >= 0)
+ return masks[idx+1];
char_class_type result = lookup_icu_mask(p1, p2);
if(result != 0)
return result;
- if(id < 0)
+ if(idx < 0)
{
string_type s(p1, p2);
string_type::size_type i = 0;
@@ -411,16 +415,16 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_
}
}
if(s.size())
- id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
- if(id >= 0)
- return masks[id+1];
+ idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ if(idx >= 0)
+ return masks[idx+1];
if(s.size())
result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size());
if(result != 0)
return result;
}
- BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0]));
- return masks[id+1];
+ BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0]));
+ return masks[idx+1];
}
icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_type* p1, const char_type* p2) const
diff --git a/3rdParty/Boost/src/libs/regex/src/regex.cpp b/3rdParty/Boost/src/libs/regex/src/regex.cpp
index 0a50382..1f1caa6 100644
--- a/3rdParty/Boost/src/libs/regex/src/regex.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/regex.cpp
@@ -44,6 +44,9 @@
#endif
#endif
+#ifdef BOOST_INTEL
+#pragma warning(disable:383)
+#endif
namespace boost{
diff --git a/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp b/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp
index 31b7918..5f06149 100644
--- a/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/regex_traits_defaults.cpp
@@ -100,7 +100,7 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants
"p",
"P",
"N",
- "g",
+ "gk",
"K",
"R",
};
diff --git a/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp
index 365fccc..8c22214 100644
--- a/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/w32_regex_traits.cpp
@@ -43,10 +43,10 @@ namespace std{
namespace boost{ namespace re_detail{
#ifdef BOOST_NO_ANSI_APIS
-UINT get_code_page_for_locale_id(lcid_type id)
+UINT get_code_page_for_locale_id(lcid_type idx)
{
WCHAR code_page_string[7];
- if (::GetLocaleInfoW(id, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0)
+ if (::GetLocaleInfoW(idx, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0)
return 0;
return static_cast<UINT>(_wtol(code_page_string));
@@ -157,15 +157,15 @@ BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale()
return ::GetUserDefaultLCID();
}
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type idx)
{
#ifndef BOOST_NO_ANSI_APIS
WORD mask;
- if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
return true;
return false;
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if (code_page == 0)
return false;
@@ -174,39 +174,39 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id)
return false;
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER))
return true;
return false;
#endif
}
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type idx)
{
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
return true;
return false;
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type idx)
{
WORD mask;
wchar_t c = ca;
- if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
return true;
return false;
}
#endif
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type idx)
{
#ifndef BOOST_NO_ANSI_APIS
WORD mask;
- if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
return true;
return false;
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if (code_page == 0)
return false;
@@ -215,25 +215,25 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type id)
return false;
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER))
return true;
return false;
#endif
}
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type idx)
{
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
return true;
return false;
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type idx)
{
WORD mask;
wchar_t c = ca;
- if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
return true;
return false;
}
@@ -322,11 +322,11 @@ BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(
}
#endif
#endif
-BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2)
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type idx, const char* p1, const char* p2)
{
#ifndef BOOST_NO_ANSI_APIS
int bytes = ::LCMapStringA(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -337,7 +337,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
return std::string(p1, p2);
std::string result(++bytes, '\0');
bytes = ::LCMapStringA(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -345,7 +345,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
bytes // size of destination buffer
);
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if(code_page == 0)
return std::string(p1, p2);
@@ -355,7 +355,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
return std::string(p1, p2);
int bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
wide_p1, // source string
src_len, // number of characters in source string
@@ -366,7 +366,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
return std::string(p1, p2);
std::string result(++bytes, '\0');
bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
wide_p1, // source string
src_len, // number of characters in source string
@@ -384,10 +384,10 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
}
#ifndef BOOST_NO_WREGEX
-BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const wchar_t* p1, const wchar_t* p2)
+BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type idx, const wchar_t* p1, const wchar_t* p2)
{
int bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -398,7 +398,7 @@ BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const
return std::wstring(p1, p2);
std::string result(++bytes, '\0');
bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -417,10 +417,10 @@ BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const
return r2;
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type id, const unsigned short* p1, const unsigned short* p2)
+BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type idx, const unsigned short* p1, const unsigned short* p2)
{
int bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
(LPCWSTR)p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -431,7 +431,7 @@ BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transfor
return std::basic_string<unsigned short>(p1, p2);
std::string result(++bytes, '\0');
bytes = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_SORTKEY, // mapping transformation type
(LPCWSTR)p1, // source string
static_cast<int>(p2 - p1), // number of characters in source string
@@ -451,12 +451,12 @@ BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transfor
}
#endif
#endif
-BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx)
{
char result[2];
#ifndef BOOST_NO_ANSI_APIS
int b = ::LCMapStringA(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_LOWERCASE, // mapping transformation type
&c, // source string
1, // number of characters in source string
@@ -465,7 +465,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
if(b == 0)
return c;
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if (code_page == 0)
return c;
@@ -475,7 +475,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
WCHAR wide_result;
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_LOWERCASE, // mapping transformation type
&wide_c, // source string
1, // number of characters in source string
@@ -491,11 +491,11 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
}
#ifndef BOOST_NO_WREGEX
-BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type id)
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type idx)
{
wchar_t result[2];
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_LOWERCASE, // mapping transformation type
&c, // source string
1, // number of characters in source string
@@ -506,11 +506,11 @@ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type id)
return result[0];
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type id)
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type idx)
{
wchar_t result[2];
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_LOWERCASE, // mapping transformation type
(wchar_t const*)&c, // source string
1, // number of characters in source string
@@ -522,12 +522,12 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, l
}
#endif
#endif
-BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx)
{
char result[2];
#ifndef BOOST_NO_ANSI_APIS
int b = ::LCMapStringA(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_UPPERCASE, // mapping transformation type
&c, // source string
1, // number of characters in source string
@@ -536,7 +536,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
if(b == 0)
return c;
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if(code_page == 0)
return c;
@@ -546,7 +546,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
WCHAR wide_result;
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_UPPERCASE, // mapping transformation type
&wide_c, // source string
1, // number of characters in source string
@@ -562,11 +562,11 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
}
#ifndef BOOST_NO_WREGEX
-BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type id)
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type idx)
{
wchar_t result[2];
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_UPPERCASE, // mapping transformation type
&c, // source string
1, // number of characters in source string
@@ -577,11 +577,11 @@ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type id)
return result[0];
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type id)
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type idx)
{
wchar_t result[2];
int b = ::LCMapStringW(
- id, // locale identifier
+ idx, // locale identifier
LCMAP_UPPERCASE, // mapping transformation type
(wchar_t const*)&c, // source string
1, // number of characters in source string
@@ -593,14 +593,14 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, l
}
#endif
#endif
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, char c)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, char c)
{
WORD mask;
#ifndef BOOST_NO_ANSI_APIS
- if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
+ if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
return true;
#else
- UINT code_page = get_code_page_for_locale_id(id);
+ UINT code_page = get_code_page_for_locale_id(idx);
if(code_page == 0)
return false;
@@ -608,7 +608,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, c
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
return false;
- if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
return true;
#endif
if((m & w32_regex_traits_implementation<char>::mask_word) && (c == '_'))
@@ -617,10 +617,10 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, c
}
#ifndef BOOST_NO_WREGEX
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, wchar_t c)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, wchar_t c)
{
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
return true;
if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
return true;
@@ -629,10 +629,10 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, w
return false;
}
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, unsigned short c)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, unsigned short c)
{
WORD mask;
- if(::GetStringTypeExW(id, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ if(::GetStringTypeExW(idx, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
return true;
if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
return true;
diff --git a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp
index fb622b5..a9e96d9 100644
--- a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp
@@ -195,16 +195,16 @@ c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t
char_class_xdigit,
};
- int id = ::boost::re_detail::get_default_class_id(p1, p2);
- if(id < 0)
+ int idx = ::boost::re_detail::get_default_class_id(p1, p2);
+ if(idx < 0)
{
std::wstring s(p1, p2);
for(std::wstring::size_type i = 0; i < s.size(); ++i)
s[i] = (std::towlower)(s[i]);
- id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
}
- BOOST_ASSERT(id+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
- return masks[id+1];
+ BOOST_ASSERT(idx+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
+ return masks[idx+1];
}
bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::isctype(wchar_t c, char_class_type mask)
diff --git a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp
index bdb7580..3c693c6 100644
--- a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp
+++ b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp
@@ -29,6 +29,10 @@
#include <cstring>
#include <cstdio>
+#ifdef BOOST_INTEL
+#pragma warning(disable:981)
+#endif
+
#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
namespace std{
# ifndef BOOST_NO_SWPRINTF
diff --git a/3rdParty/Boost/src/libs/system/src/error_code.cpp b/3rdParty/Boost/src/libs/system/src/error_code.cpp
index fa2cb0b..bd87403 100644
--- a/3rdParty/Boost/src/libs/system/src/error_code.cpp
+++ b/3rdParty/Boost/src/libs/system/src/error_code.cpp
@@ -29,8 +29,9 @@ using namespace boost::system::errc;
# if defined( BOOST_WINDOWS_API )
# include <windows.h>
+# include "local_free_on_destruction.hpp"
# ifndef ERROR_INCORRECT_SIZE
-# define ERROR_INCORRECT_SIZE ERROR_BAD_ARGUMENTS
+# define ERROR_INCORRECT_SIZE ERROR_BAD_ARGUMENTS
# endif
# endif
@@ -159,7 +160,7 @@ namespace
switch ( ev )
{
case 0: return make_error_condition( success );
- # if defined(BOOST_POSIX_API)
+# if defined(BOOST_POSIX_API)
// POSIX-like O/S -> posix_errno decode table ---------------------------//
case E2BIG: return make_error_condition( argument_list_too_long );
case EACCES: return make_error_condition( permission_denied );
@@ -221,7 +222,9 @@ namespace
# if ENOTEMPTY != EEXIST // AIX treats ENOTEMPTY and EEXIST as the same value
case ENOTEMPTY: return make_error_condition( directory_not_empty );
# endif // ENOTEMPTY != EEXIST
- case ENOTRECOVERABLE: return make_error_condition( state_not_recoverable );
+ # if ENOTRECOVERABLE != ECONNRESET // the same on some Broadcom chips
+ case ENOTRECOVERABLE: return make_error_condition( state_not_recoverable );
+ # endif // ENOTRECOVERABLE != ECONNRESET
case ENOTSOCK: return make_error_condition( not_a_socket );
case ENOTSUP: return make_error_condition( not_supported );
case ENOTTY: return make_error_condition( inappropriate_io_control_operation );
@@ -230,7 +233,9 @@ namespace
case EOPNOTSUPP: return make_error_condition( operation_not_supported );
# endif // EOPNOTSUPP != ENOTSUP
case EOVERFLOW: return make_error_condition( value_too_large );
- case EOWNERDEAD: return make_error_condition( owner_dead );
+ # if EOWNERDEAD != ECONNABORTED // the same on some Broadcom chips
+ case EOWNERDEAD: return make_error_condition( owner_dead );
+ # endif // EOWNERDEAD != ECONNABORTED
case EPERM: return make_error_condition( operation_not_permitted );
case EPIPE: return make_error_condition( broken_pipe );
case EPROTO: return make_error_condition( protocol_error );
@@ -325,7 +330,7 @@ namespace
case WSAETIMEDOUT: return make_error_condition( timed_out );
case WSAEWOULDBLOCK: return make_error_condition( operation_would_block );
#endif
- default: return error_condition( ev, system_category );
+ default: return error_condition( ev, system_category() );
}
}
@@ -333,28 +338,14 @@ namespace
std::string system_error_category::message( int ev ) const
{
- return generic_category.message( ev );
+ return generic_category().message( ev );
}
# else
-// TODO:
-
-//Some quick notes on the implementation (sorry for the noise if
-//someone has already mentioned them):
-//
-//- The ::LocalFree() usage isn't exception safe.
-//
-//See:
-//
-//<http://boost.cvs.sourceforge.net/boost/boost/boost/asio/system_exception.hpp?revision=1.1&view=markup>
-//
-//in the implementation of what() for an example.
-//
-//Cheers,
-//Chris
+
std::string system_error_category::message( int ev ) const
{
# ifndef BOOST_NO_ANSI_APIS
- LPVOID lpMsgBuf;
+ LPVOID lpMsgBuf = 0;
DWORD retval = ::FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -366,13 +357,13 @@ namespace
0,
NULL
);
+ detail::local_free_on_destruction lfod(lpMsgBuf);
if (retval == 0)
return std::string("Unknown error");
std::string str( static_cast<LPCSTR>(lpMsgBuf) );
- ::LocalFree( lpMsgBuf ); // free the buffer
# else // WinCE workaround
- LPVOID lpMsgBuf;
+ LPVOID lpMsgBuf = 0;
DWORD retval = ::FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -384,6 +375,7 @@ namespace
0,
NULL
);
+ detail::local_free_on_destruction lfod(lpMsgBuf);
if (retval == 0)
return std::string("Unknown error");
@@ -393,7 +385,6 @@ namespace
return std::string("Unknown error");
std::string str( narrow_buffer );
- ::LocalFree( lpMsgBuf ); // free the buffer
# endif
while ( str.size()
&& (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') )
@@ -419,13 +410,13 @@ namespace boost
// address for comparison purposes
# endif
- BOOST_SYSTEM_DECL const error_category & get_system_category()
+ BOOST_SYSTEM_DECL const error_category & system_category()
{
static const system_error_category system_category_const;
return system_category_const;
}
- BOOST_SYSTEM_DECL const error_category & get_generic_category()
+ BOOST_SYSTEM_DECL const error_category & generic_category()
{
static const generic_error_category generic_category_const;
return generic_category_const;
diff --git a/3rdParty/Boost/src/libs/system/src/local_free_on_destruction.hpp b/3rdParty/Boost/src/libs/system/src/local_free_on_destruction.hpp
new file mode 100644
index 0000000..110024f
--- /dev/null
+++ b/3rdParty/Boost/src/libs/system/src/local_free_on_destruction.hpp
@@ -0,0 +1,40 @@
+// local_free_on_exit.hpp ------------------------------------------------------------//
+
+// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2010 Beman Dawes
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// This is derived from boost/asio/detail/local_free_on_block_exit.hpp to avoid
+// a dependency on asio. Thanks to Chris Kohlhoff for pointing it out.
+
+#ifndef BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP
+#define BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP
+
+namespace boost {
+namespace system {
+namespace detail {
+
+class local_free_on_destruction
+{
+public:
+ explicit local_free_on_destruction(void* p)
+ : p_(p) {}
+
+ ~local_free_on_destruction()
+ {
+ ::LocalFree(p_);
+ }
+
+private:
+ void* p_;
+ local_free_on_destruction(const local_free_on_destruction&); // = deleted
+ local_free_on_destruction& operator=(const local_free_on_destruction&); // = deleted
+};
+
+} // namespace detail
+} // namespace system
+} // namespace boost
+
+#endif // BOOST_SYSTEM_LOCAL_FREE_ON_EXIT_HPP
diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp
index 1c13a9a..187c024 100644
--- a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp
+++ b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp
@@ -75,7 +75,7 @@ namespace boost
{
current=next;
++next;
- if(current->second.func && current->second.value)
+ if(current->second.func && (current->second.value!=0))
{
(*current->second.func)(current->second.value);
}
@@ -196,15 +196,14 @@ namespace boost
detach();
}
- detail::thread_data_ptr thread::get_thread_info() const
+ detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
- lock_guard<mutex> l(thread_info_mutex);
return thread_info;
}
void thread::join()
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
bool do_join=false;
@@ -238,7 +237,6 @@ namespace boost
local_thread_info->done_condition.notify_all();
}
- lock_guard<mutex> l1(thread_info_mutex);
if(thread_info==local_thread_info)
{
thread_info.reset();
@@ -248,7 +246,7 @@ namespace boost
bool thread::timed_join(system_time const& wait_until)
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
bool do_join=false;
@@ -285,7 +283,6 @@ namespace boost
local_thread_info->done_condition.notify_all();
}
- lock_guard<mutex> l1(thread_info_mutex);
if(thread_info==local_thread_info)
{
thread_info.reset();
@@ -296,17 +293,14 @@ namespace boost
bool thread::joinable() const
{
- return get_thread_info();
+ return (get_thread_info)();
}
void thread::detach()
{
detail::thread_data_ptr local_thread_info;
- {
- lock_guard<mutex> l1(thread_info_mutex);
- thread_info.swap(local_thread_info);
- }
+ thread_info.swap(local_thread_info);
if(local_thread_info)
{
@@ -381,8 +375,6 @@ namespace boost
{
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
-#elif defined(_GNU_SOURCE)
- return get_nprocs();
#elif defined(__APPLE__) || defined(__FreeBSD__)
int count;
size_t size=sizeof(count);
@@ -390,6 +382,8 @@ namespace boost
#elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
int const count=sysconf(_SC_NPROCESSORS_ONLN);
return (count>0)?count:0;
+#elif defined(_GNU_SOURCE)
+ return get_nprocs();
#else
return 0;
#endif
@@ -397,7 +391,7 @@ namespace boost
thread::id thread::get_id() const
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
return id(local_thread_info);
@@ -410,13 +404,14 @@ namespace boost
void thread::interrupt()
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
lock_guard<mutex> lk(local_thread_info->data_mutex);
local_thread_info->interrupt_requested=true;
if(local_thread_info->current_cond)
{
+ boost::pthread::pthread_mutex_scoped_lock internal_lock(local_thread_info->cond_mutex);
BOOST_VERIFY(!pthread_cond_broadcast(local_thread_info->current_cond));
}
}
@@ -424,7 +419,7 @@ namespace boost
bool thread::interruption_requested() const
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
lock_guard<mutex> lk(local_thread_info->data_mutex);
@@ -438,7 +433,7 @@ namespace boost
thread::native_handle_type thread::native_handle()
{
- detail::thread_data_ptr const local_thread_info=get_thread_info();
+ detail::thread_data_ptr const local_thread_info=(get_thread_info)();
if(local_thread_info)
{
lock_guard<mutex> lk(local_thread_info->data_mutex);
@@ -582,11 +577,11 @@ namespace boost
{
if(tss_data_node* const current_node=find_tss_data(key))
{
- if(cleanup_existing && current_node->func && current_node->value)
+ if(cleanup_existing && current_node->func && (current_node->value!=0))
{
(*current_node->func)(current_node->value);
}
- if(func || tss_data)
+ if(func || (tss_data!=0))
{
current_node->func=func;
current_node->value=tss_data;
diff --git a/3rdParty/Boost/src/libs/thread/src/tss_null.cpp b/3rdParty/Boost/src/libs/thread/src/tss_null.cpp
index ff13b30..e93ba0f 100644
--- a/3rdParty/Boost/src/libs/thread/src/tss_null.cpp
+++ b/3rdParty/Boost/src/libs/thread/src/tss_null.cpp
@@ -8,13 +8,15 @@
#if defined(BOOST_HAS_WINTHREADS) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE))
+namespace boost
+{
/*
This file is a "null" implementation of tss cleanup; it's
purpose is to to eliminate link errors in cases
where it is known that tss cleanup is not needed.
*/
- extern "C" void tss_cleanup_implemented(void)
+ void tss_cleanup_implemented(void)
{
/*
This function's sole purpose is to cause a link error in cases where
@@ -30,5 +32,7 @@
longer needed and can be removed.
*/
}
+
+}
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER)
diff --git a/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp b/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp
index b85e650..05c7a6c 100644
--- a/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp
+++ b/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp
@@ -56,7 +56,10 @@ namespace boost
void set_current_thread_data(detail::thread_data_base* new_data)
{
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
- BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
+ if(current_thread_tls_key)
+ BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
+ else
+ boost::throw_exception(thread_resource_error());
}
#ifdef BOOST_NO_THREADEX
@@ -221,7 +224,15 @@ namespace boost
void make_external_thread_data()
{
externally_launched_thread* me=detail::heap_new<externally_launched_thread>();
- set_current_thread_data(me);
+ try
+ {
+ set_current_thread_data(me);
+ }
+ catch(...)
+ {
+ detail::heap_delete(me);
+ throw;
+ }
}
detail::thread_data_base* get_or_make_current_thread_data()
@@ -244,17 +255,17 @@ namespace boost
thread::id thread::get_id() const
{
- return thread::id(get_thread_info());
+ return thread::id((get_thread_info)());
}
bool thread::joinable() const
{
- return get_thread_info();
+ return (get_thread_info)();
}
void thread::join()
{
- detail::thread_data_ptr local_thread_info=get_thread_info();
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
if(local_thread_info)
{
this_thread::interruptible_wait(local_thread_info->thread_handle,detail::timeout::sentinel());
@@ -264,7 +275,7 @@ namespace boost
bool thread::timed_join(boost::system_time const& wait_until)
{
- detail::thread_data_ptr local_thread_info=get_thread_info();
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
if(local_thread_info)
{
if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until)))
@@ -283,13 +294,12 @@ namespace boost
void thread::release_handle()
{
- lock_guard<mutex> l1(thread_info_mutex);
thread_info=0;
}
void thread::interrupt()
{
- detail::thread_data_ptr local_thread_info=get_thread_info();
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
if(local_thread_info)
{
local_thread_info->interrupt();
@@ -298,26 +308,25 @@ namespace boost
bool thread::interruption_requested() const
{
- detail::thread_data_ptr local_thread_info=get_thread_info();
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
return local_thread_info.get() && (detail::win32::WaitForSingleObject(local_thread_info->interruption_handle,0)==0);
}
unsigned thread::hardware_concurrency()
{
- SYSTEM_INFO info={0};
+ SYSTEM_INFO info={{0}};
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
}
thread::native_handle_type thread::native_handle()
{
- detail::thread_data_ptr local_thread_info=get_thread_info();
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
return local_thread_info?(detail::win32::handle)local_thread_info->thread_handle:detail::win32::invalid_handle_value;
}
- detail::thread_data_ptr thread::get_thread_info() const
+ detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
- boost::mutex::scoped_lock l(thread_info_mutex);
return thread_info;
}
@@ -327,7 +336,7 @@ namespace boost
{
LARGE_INTEGER get_due_time(detail::timeout const& target_time)
{
- LARGE_INTEGER due_time={0};
+ LARGE_INTEGER due_time={{0}};
if(target_time.relative)
{
unsigned long const elapsed_milliseconds=GetTickCount()-target_time.start;
@@ -356,7 +365,23 @@ namespace boost
else
{
long const hundred_nanoseconds_in_one_second=10000000;
- due_time.QuadPart+=target_time.abs_time.time_of_day().fractional_seconds()*(hundred_nanoseconds_in_one_second/target_time.abs_time.time_of_day().ticks_per_second());
+ posix_time::time_duration::tick_type const ticks_per_second=
+ target_time.abs_time.time_of_day().ticks_per_second();
+ if(ticks_per_second>hundred_nanoseconds_in_one_second)
+ {
+ posix_time::time_duration::tick_type const
+ ticks_per_hundred_nanoseconds=
+ ticks_per_second/hundred_nanoseconds_in_one_second;
+ due_time.QuadPart+=
+ target_time.abs_time.time_of_day().fractional_seconds()/
+ ticks_per_hundred_nanoseconds;
+ }
+ else
+ {
+ due_time.QuadPart+=
+ target_time.abs_time.time_of_day().fractional_seconds()*
+ (hundred_nanoseconds_in_one_second/ticks_per_second);
+ }
}
}
return due_time;
@@ -526,8 +551,8 @@ namespace boost
{
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
thread_exit_callback_node* const new_node=
- heap_new<thread_exit_callback_node>(func,
- current_thread_data->thread_exit_callbacks);
+ heap_new<thread_exit_callback_node>(
+ func,current_thread_data->thread_exit_callbacks);
current_thread_data->thread_exit_callbacks=new_node;
}
@@ -569,30 +594,31 @@ namespace boost
current_node->func=func;
current_node->value=tss_data;
}
- else
+ else if(func && tss_data)
{
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
- tss_data_node* const new_node=heap_new<tss_data_node>(key,func,tss_data,current_thread_data->tss_data);
+ tss_data_node* const new_node=
+ heap_new<tss_data_node>(key,func,tss_data,current_thread_data->tss_data);
current_thread_data->tss_data=new_node;
}
}
}
-}
+ BOOST_THREAD_DECL void __cdecl on_process_enter()
+ {}
+ BOOST_THREAD_DECL void __cdecl on_thread_enter()
+ {}
-extern "C" BOOST_THREAD_DECL void on_process_enter()
-{}
+ BOOST_THREAD_DECL void __cdecl on_process_exit()
+ {
+ boost::cleanup_tls_key();
+ }
-extern "C" BOOST_THREAD_DECL void on_thread_enter()
-{}
+ BOOST_THREAD_DECL void __cdecl on_thread_exit()
+ {
+ boost::run_thread_exit_callbacks();
+ }
-extern "C" BOOST_THREAD_DECL void on_process_exit()
-{
- boost::cleanup_tls_key();
}
-extern "C" BOOST_THREAD_DECL void on_thread_exit()
-{
- boost::run_thread_exit_callbacks();
-}
diff --git a/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp b/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp
index 0522a12..9699a12 100644
--- a/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp
+++ b/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp
@@ -24,27 +24,27 @@
{
case DLL_PROCESS_ATTACH:
{
- on_process_enter();
- on_thread_enter();
+ boost::on_process_enter();
+ boost::on_thread_enter();
break;
}
case DLL_THREAD_ATTACH:
{
- on_thread_enter();
+ boost::on_thread_enter();
break;
}
case DLL_THREAD_DETACH:
{
- on_thread_exit();
+ boost::on_thread_exit();
break;
}
case DLL_PROCESS_DETACH:
{
- on_thread_exit();
- on_process_exit();
+ boost::on_thread_exit();
+ boost::on_process_exit();
break;
}
}
@@ -52,7 +52,9 @@
return TRUE;
}
- extern "C" void tss_cleanup_implemented(void)
+namespace boost
+{
+ void tss_cleanup_implemented()
{
/*
This function's sole purpose is to cause a link error in cases where
@@ -68,5 +70,7 @@
longer needed and can be removed.
*/
}
+}
+
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
diff --git a/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp b/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp
index ae89bc4..8ef045b 100644
--- a/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp
+++ b/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp
@@ -1,4 +1,4 @@
-// $Id: tss_pe.cpp 49324 2008-10-13 20:30:13Z anthonyw $
+// $Id: tss_pe.cpp 66259 2010-10-29 23:27:00Z anthonyw $
// (C) Copyright Aaron W. LaFramboise, Roland Schwarz, Michael Glassford 2004.
// (C) Copyright 2007 Roland Schwarz
// (C) Copyright 2007 Anthony Williams
@@ -19,7 +19,10 @@
#include <cstdlib>
-extern "C" void tss_cleanup_implemented(void) {}
+namespace boost
+{
+ void tss_cleanup_implemented() {}
+}
namespace {
void NTAPI on_tls_callback(void* h, DWORD dwReason, PVOID pv)
@@ -28,33 +31,24 @@ namespace {
{
case DLL_THREAD_DETACH:
{
- on_thread_exit();
+ boost::on_thread_exit();
break;
}
}
}
-
- void on_after_ctors(void)
- {
- on_process_enter();
- }
-
- void on_before_dtors(void)
- {
- on_thread_exit();
- }
-
- void on_after_dtors(void)
- {
- on_process_exit();
- }
}
+#if (__MINGW32_MAJOR_VERSION >3) || ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
+extern "C"
+{
+ PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback;
+}
+#else
extern "C" {
- void (* after_ctors )(void) __attribute__((section(".ctors"))) = on_after_ctors;
- void (* before_dtors)(void) __attribute__((section(".dtors"))) = on_before_dtors;
- void (* after_dtors )(void) __attribute__((section(".dtors.zzz"))) = on_after_dtors;
+ void (* after_ctors )() __attribute__((section(".ctors"))) = boost::on_process_enter;
+ void (* before_dtors)() __attribute__((section(".dtors"))) = boost::on_thread_exit;
+ void (* after_dtors )() __attribute__((section(".dtors.zzz"))) = boost::on_process_exit;
ULONG __tls_index__ = 0;
char __tls_end__ __attribute__((section(".tls$zzz"))) = 0;
@@ -62,10 +56,8 @@ extern "C" {
PIMAGE_TLS_CALLBACK __crt_xl_start__ __attribute__ ((section(".CRT$XLA"))) = 0;
- PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback;
PIMAGE_TLS_CALLBACK __crt_xl_end__ __attribute__ ((section(".CRT$XLZ"))) = 0;
}
-
extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) =
{
(DWORD) &__tls_start__,
@@ -75,6 +67,7 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
(DWORD) 0,
(DWORD) 0
};
+#endif
#elif defined(_MSC_VER) && !defined(UNDER_CE)
@@ -89,13 +82,13 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
//Definitions required by implementation
#if (_MSC_VER < 1300) // 1300 == VC++ 7.0
- typedef void (__cdecl *_PVFV)(void);
+ typedef void (__cdecl *_PVFV)();
#define INIRETSUCCESS
- #define PVAPI void
+ #define PVAPI void __cdecl
#else
- typedef int (__cdecl *_PVFV)(void);
+ typedef int (__cdecl *_PVFV)();
#define INIRETSUCCESS 0
- #define PVAPI int
+ #define PVAPI int __cdecl
#endif
typedef void (NTAPI* _TLSCB)(HINSTANCE, DWORD, PVOID);
@@ -112,9 +105,9 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
{
//Forward declarations
- static PVAPI on_tls_prepare(void);
- static PVAPI on_process_init(void);
- static PVAPI on_process_term(void);
+ static PVAPI on_tls_prepare();
+ static PVAPI on_process_init();
+ static PVAPI on_process_term();
static void NTAPI on_tls_callback(HINSTANCE, DWORD, PVOID);
//The .CRT$Xxx information is taken from Codeguru:
@@ -169,7 +162,7 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
#pragma warning(disable:4189)
#endif
- PVAPI on_tls_prepare(void)
+ PVAPI on_tls_prepare()
{
//The following line has an important side effect:
//if the TLS directory is not already there, it will
@@ -210,7 +203,7 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
#pragma warning(pop)
#endif
- PVAPI on_process_init(void)
+ PVAPI on_process_init()
{
//Schedule on_thread_exit() to be called for the main
//thread before destructors of global objects have been
@@ -221,18 +214,18 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
//for destructors of global objects, so that
//shouldn't be a problem.
- atexit(on_thread_exit);
+ atexit(boost::on_thread_exit);
//Call Boost process entry callback here
- on_process_enter();
+ boost::on_process_enter();
return INIRETSUCCESS;
}
- PVAPI on_process_term(void)
+ PVAPI on_process_term()
{
- on_process_exit();
+ boost::on_process_exit();
return INIRETSUCCESS;
}
@@ -241,7 +234,7 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
switch (dwReason)
{
case DLL_THREAD_DETACH:
- on_thread_exit();
+ boost::on_thread_exit();
break;
}
}
@@ -251,10 +244,10 @@ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata
switch (dwReason)
{
case DLL_THREAD_DETACH:
- on_thread_exit();
+ boost::on_thread_exit();
break;
case DLL_PROCESS_DETACH:
- on_process_exit();
+ boost::on_process_exit();
break;
}
return true;
@@ -265,8 +258,9 @@ extern "C"
{
extern BOOL (WINAPI * const _pRawDllMain)(HANDLE, DWORD, LPVOID)=&dll_callback;
}
-
- extern "C" void tss_cleanup_implemented(void)
+namespace boost
+{
+ void tss_cleanup_implemented()
{
/*
This function's sole purpose is to cause a link error in cases where
@@ -282,6 +276,8 @@ extern "C"
longer needed and can be removed.
*/
}
+}
+
#endif //defined(_MSC_VER) && !defined(UNDER_CE)
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)