summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-03-14 18:35:17 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-03-14 18:35:17 (GMT)
commita135c6ff4dcded5661a2321512960b14cf8c15c8 (patch)
treeb0017ecfe702304f592b9d4e8b943784cff26fb2 /3rdParty/Boost/src/libs/filesystem/v3
parent02d6188ab335e6c62b8341b84579d9549d215118 (diff)
downloadswift-a135c6ff4dcded5661a2321512960b14cf8c15c8.zip
swift-a135c6ff4dcded5661a2321512960b14cf8c15c8.tar.bz2
Updated Boost to 1.46.1.
This should hopefuily fix a hang on shutdown on Mac OS X. Resolves: #782 Release-Notes: Fixed a potential hang on shutdown on Mac OS X.
Diffstat (limited to '3rdParty/Boost/src/libs/filesystem/v3')
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp94
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp22
-rw-r--r--3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp6
3 files changed, 95 insertions, 27 deletions
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp
index 04d9c17..2460c1d 100644
--- a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp
@@ -34,6 +34,7 @@
!defined(_STATVFS_ACPP_PROBLEMS_FIXED))
#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
#endif
+#if !defined(__PGI)
#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.
@@ -44,11 +45,15 @@
// ensure that they are available to all included headers.
// That is required at least on Solaris, and possibly on other
// systems as well.
+#else
+#define _FILE_OFFSET_BITS 64
+#endif
#include <boost/filesystem/v3/operations.hpp>
#include <boost/scoped_array.hpp>
#include <boost/detail/workaround.hpp>
#include <cstdlib> // for malloc, free
+#include <vector>
#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM
# include <iostream>
@@ -147,6 +152,9 @@ typedef struct _REPARSE_DATA_BUFFER {
#define REPARSE_DATA_BUFFER_HEADER_SIZE \
FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+#endif
+
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
#endif
@@ -426,8 +434,9 @@ namespace
if (::stat(from_p.c_str(), &from_stat)!= 0)
{ return false; }
- int oflag = O_CREAT | O_WRONLY;
- if (fail_if_exists)oflag |= O_EXCL;
+ int oflag = O_CREAT | O_WRONLY | O_TRUNC;
+ if (fail_if_exists)
+ oflag |= O_EXCL;
if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0)
{
int open_errno = errno;
@@ -1443,6 +1452,9 @@ namespace detail
{
return process_status_failure(p, ec);
}
+
+ if (!is_reparse_point_a_symlink(p))
+ return file_status(reparse_file);
}
if (ec != 0) ec->clear();
@@ -1512,6 +1524,55 @@ namespace detail
# endif
}
+ // contributed by Jeff Flinn
+ BOOST_FILESYSTEM_DECL
+ path temp_directory_path(system::error_code* ec)
+ {
+# ifdef BOOST_POSIX_API
+ const char* val = 0;
+
+ (val = std::getenv("TMPDIR" )) ||
+ (val = std::getenv("TMP" )) ||
+ (val = std::getenv("TEMP" )) ||
+ (val = std::getenv("TEMPDIR"));
+
+ path p((val!=0) ? val : "/tmp");
+
+ if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+ {
+ errno = ENOTDIR;
+ error(true, p, ec, "boost::filesystem::temp_directory_path");
+ return p;
+ }
+
+ return p;
+
+# else // Windows
+
+ std::vector<path::value_type> buf(GetTempPathW(0, NULL));
+
+ if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0)
+ {
+ if(!buf.empty()) ::SetLastError(ENOTDIR);
+ error(true, ec, "boost::filesystem::temp_directory_path");
+ return path();
+ }
+
+ buf.pop_back();
+
+ path p(buf.begin(), buf.end());
+
+ if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
+ {
+ ::SetLastError(ENOTDIR);
+ error(true, p, ec, "boost::filesystem::temp_directory_path");
+ return path();
+ }
+
+ return p;
+# endif
+ }
+
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec)
{
@@ -1637,6 +1698,10 @@ namespace
return ok;
}
+#if defined(__PGI) && defined(__USE_FILE_OFFSET64)
+#define dirent dirent64
+#endif
+
error_code dir_itr_first(void *& handle, void *& buffer,
const char* dir, string& target,
fs::file_status &, fs::file_status &)
@@ -1742,9 +1807,13 @@ namespace
? 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); }
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ // reparse points are complex, so don't try to handle them here
+ { sf.type(fs::status_error); symlink_sf.type(fs::status_error); }
+ else 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();
}
@@ -1759,9 +1828,13 @@ namespace
return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category());
}
target = data.cFileName;
- if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ // reparse points are complex, so don't try to handle them here
+ { sf.type(fs::status_error); symlink_sf.type(fs::status_error); }
+ else 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); }
+ else
+ { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); }
return error_code();
}
#endif
@@ -1878,7 +1951,12 @@ namespace detail
}
else if (ec != 0) ec->clear();
- if (it.m_imp->handle == 0){ it.m_imp.reset(); return; } // eof, make end
+ if (it.m_imp->handle == 0) // eof, make end
+ {
+ it.m_imp.reset();
+ return;
+ }
+
if (!(filename[0] == dot // !(dot or dot-dot)
&& (filename.size()== 1
|| (filename[1] == dot
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp
index 53a4cc6..cc30570 100644
--- a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp
@@ -27,6 +27,7 @@
#include <boost/scoped_array.hpp>
#include <boost/system/error_code.hpp>
#include <boost/assert.hpp>
+#include <algorithm>
#include <cstddef>
#include <cstring>
#include <cassert>
@@ -155,27 +156,17 @@ namespace filesystem3
# 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();
+ tmp.make_preferred();
return tmp.string(cvt);
}
const std::wstring path::generic_wstring() const
{
path tmp(*this);
- tmp.m_portable();
+ tmp.make_preferred();
return tmp.wstring();
}
@@ -216,12 +207,7 @@ namespace filesystem3
# 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'\\';
- }
+ std::replace(m_pathname.begin(), m_pathname.end(), L'\\', L'/');
return *this;
}
# endif
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
index dd89c02..ae9f9f2 100644
--- a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp
+++ b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp
@@ -31,7 +31,11 @@
#include "windows_file_codecvt.hpp"
-#define WINVER 0x0500 // MinGW for GCC 4.4 requires this
+// Versions of MinGW prior to GCC 4.6 requires this
+#ifndef WINVER
+# define WINVER 0x0500
+#endif
+
#include <windows.h>
std::codecvt_base::result windows_file_codecvt::do_in(