Commit Graph

254 Commits

Author SHA1 Message Date
Alexei Khlebnikov
3d3d504b25 Do not define _FILE_OFFSET_BITS for Android APIs < 24. 2018-03-06 23:53:03 +01:00
Alexei Khlebnikov
f721c56ea6 Improved comment about why _FILE_OFFSET_BITS should be defined for most systems. 2018-03-04 16:56:59 +01:00
Andrey Semashev
716567aa9e Added a check for whether the size argument to resize_file exceeds off_t limit.
This check is especially useful on 32-bit systems which have no support for
64-bit file offsets (like older Android).
2018-03-03 17:49:23 +01:00
Alexei Khlebnikov
b37e83640a Do not define _FILE_OFFSET_BITS for Android APIs < 21. 2018-03-03 17:35:28 +01:00
Alexei Khlebnikov
7717db0b3e Deduplicated and cleaned up _FILE_OFFSET_BITS #if-ery. 2018-03-03 16:50:57 +01:00
Alexei Khlebnikov
18c7f93440 Replaced for-internal-use macro __USE_FILE_OFFSET64 by for-public-use macro _FILE_OFFSET_BITS. 2018-03-03 16:47:54 +01:00
Alexei Khlebnikov
aea71c5864 Transformed _FILE_OFFSET_BITS #if-ery even more for better understanding. 2018-03-03 16:43:34 +01:00
Alexei Khlebnikov
e5b3740440 Transformed _FILE_OFFSET_BITS #if-ery for better understanding. 2018-03-03 16:39:18 +01:00
Peter Dimov
c6a977c99f Avoid clang warning by removing the extra parentheses 2018-01-29 19:18:05 +02:00
Peter Dimov
399dd6e1d6 Use ad-hoc extension comparison to avoid initialization issues 2017-11-22 19:20:16 +02:00
Beman
23b79b9459 Clear two -Wconversion warnings 2017-04-03 09:47:32 -04:00
Beman
7fd4214912 is_empty()overload with error_code parameter should not throw on error. Thanks to ldqrk for pull request #42 2017-04-03 09:36:43 -04:00
drgler
0e831d5c2d Extended patch for ticket #10731 and ticket #9480: Replace expensive call of RtlInitUnicodeString by wcslen and get rid of CompareStringOrdinal completely, because it has no longer any advantages. Also, replace Windows TEXT macro by selecting GetModuleHandleW with wide character argument to prevent any additional conversions. 2017-03-19 16:21:46 +01:00
drgler
14935c4c6d Extended patch for ticket #10731 and ticket #9480: Replace usage of non-portable _wcsicmp by appropriate Windows functions to realize a locale invariant case-insensitive binary Unicode comparison that match the underlying file name comparison. 2017-03-18 22:28:29 +01:00
drgler
755766a053 Patch for ticket #10731 and ticket #9480: Evaluate path.extension only once, perform (case-insensitive) string comparisons using the wchar_t variants from the CRT to prevent code conversions via path.string() calls. 2017-03-14 21:46:12 +01:00
Christoph Müllner
7f1a6992e3 Fix errno propagation in space(p, ec).
The space(p, ec) implementation assigned a wrong
error value to the given error_code object.
Instead of getting the error value from errno,
the code used the value '-1!=0'.

Signed-off-by: Christoph Müllner <christophm30@gmail.com>
2016-12-12 00:42:54 +01:00
Beman
4e4374336c Fix #7307, remove_all(dirname,ec) throws on write protected directories. This is a tough one to test. There are three internal function calls where errors might arise, and it would take too much time to write tests for each of those cases. Someday we will have Titus Winter's mock installable file system, but for now are relying on code inspection rather than testing. 2016-11-23 12:02:09 -05:00
Beman Dawes
cbefb2b9f0 Merge pull request #30 from thtrummer/develop
Fix warning, build error, for GCC under Cygwin
2016-11-23 10:46:37 -05:00
Beman
216720de55 Fix #12495, create_directories() crashes when passed empty string as path, from Samantha Ritter. Also affected create_directory(). Charles Olivi submitted a pull request with some particularly helpful test cases. 2016-11-23 09:58:43 -05:00
Thomas Trummer
3c2c9812f0 Fix warning for GCC under Cygwin 2016-07-04 14:14:11 +02:00
Beman
a682eaa476 Remove two constants that are no longer used. Quiets warnings. 2015-12-01 11:01:11 -05:00
Beman
2f6391b931 Add class path constexpr constants separator and dot of the type appropriate for the platform, and add class path member query functions filename_is_dot() and filename_is_dot_dot(). These add convenience and the implementations may be more efficient that user coded equivalent functions. Also add detail functions is_directory_separator() and is_element_separator(), and replace all uses of local is_separator() in path.cpp with detail::is_directory_separator(). 2015-12-01 10:17:45 -05:00
Beman
3c344a5f0b Revert to lexical functions back to being members of class path. This is not the time to redesign the library's lexical vs operational conventions. It would break existing users mental model of lexical vs operational.
See doc/relative_proposal.html#Add-lexical-functions for additional rationale.
2015-10-25 13:28:49 -04:00
Beman
7e3e5ef60c Fix #11733, Missing unistd.h include in boost/libs/filesystem/src/unique_path.cpp by apply a patch from Idar Tollefsen. 2015-10-16 16:03:45 -04:00
Beman
74c5f5fe3e Fix a forward declaration that was missed in a prior pull request. This clears a GCC warning. 2015-10-08 07:04:13 -04:00
Beman
5610f974be Merge branch 'feature/relative2' into develop 2015-09-04 15:24:22 -04:00
Beman
011522bd42 Fix #7258, create_directories returns false if the path ends with a slash. Also fix related issues if path contains dot or dot-dot elements, and add test cases to the test suite. 2015-09-02 08:24:41 -04:00
Beman
a2d4f99cc8 Resolve #11166 by mitigating (i.e. reducing the likelihood of) a possible external file system race in remove(), using a slight refinement of the patch supplied by Jeff Epler. Made no attempt to fix or mitigate the thread data race in the test program provided. 2015-09-01 11:34:24 -04:00
Beman
f6aa067256 Minor code and comment tweaks. 2015-08-31 10:23:41 -04:00
Beman
2b019a8483 Fix #11288 A patch to avoid redundant string allocations 2015-08-30 16:44:27 -04:00
Beman
810f40becf Add a quote from the standard 2015-08-30 16:33:39 -04:00
Beman
efe50fad52 Work issue, but no fix yet 2015-08-30 16:32:44 -04:00
Beman
90517e4596 Fix #11447, __OpenBSD__ macro name misspelled, by applying a patch submitted by Jasper Lievisse Adriaanse. 2015-08-29 10:13:36 -04:00
Beman
5e5b529dc2 Fix #10591, boost::filesystem does not build on iOS 8, by applying a patch submitted by Daniel Seither. 2015-08-28 16:41:13 -04:00
Sebastian Redl
26b24ed329 Fix a race condition in unique_path.
If two threads call unique_path at the same time for the first time in the program run,
both initial calls to CryptAcquireContext can fail. Both threads will then call the function
with CRYPT_NEWKEYSET, but only one of these threads can succeed. The other will
fail with NTE_EXISTS.

This patch makes it so that if a call fails with that error, it will try to call without the
flag one more time, in case another thread created the key set in the meantime.

This also applies the patch from trac report #7506. Using these additional flags
is the right thing to do.
2015-08-27 11:42:56 +02:00
Beman
732609a2da Change member normal() and relative() to non-member lexically_normal() and lexically_relative(). See doc/relative_proposal.html#Add-lexical-functions-as-non-members for rationale. 2015-08-23 09:33:21 -04:00
Beman
c739cee694 Apply normal() to weakly_canonical results, but only when know to be needed or it is not known if it may be needed. 2015-08-19 08:43:36 -04:00
Beman
cb11081a7d Finish initial proposed wording section of relative_proposal.html. Drive-by tweaks to other stuff. Add example/directory_symlink_parent_resolution.cpp, include/boost/filesystem/string_file.hpp, and related infrastructure. 2015-08-12 17:26:03 -04:00
Beman
a7ac4c088f Add relative_test to Jamfile, fix Cygwin/GCC C++03 enum constant usage error. 2015-08-10 08:09:48 -04:00
Beman
7d6429554a Bring operational functions weakly_canonical() and relative() up to production quality: move implementations to operations.cpp, add error handling, replace tail recursion with iteration, rename weak_canonical to weakly_canonical. The weak_canonical name grated on me every type I used it. 2015-08-10 07:10:59 -04:00
Beman
34dd2c7718 Add a new path member function: "path normal() const;" and change the old deprecated normalize() non-const function to be implemented in terms of the new function. The implementation remains the same, except for returning by value rather than modifying in place. Motivation: Jamie Alsop has identified removal of redundant .. and . elements (i.e. normalization) as a need closely related to the relative path functionality requested by numerous Boost issue requests, the C++ LWG, and NB comments to the Filesystem TS. Given that both lexical and operational relative functionality is needed, there is less risk in providing a well-documented path::normal() lexical function. 2015-08-08 16:29:44 -04:00
Beman
9706dbb9b1 Revert "Change the name of path::relative to path::relative_to to distinguish it a bit from path::relative_path."
This reverts commit d5fb8323f8.

Leave possible renaming for bikeshed discussions. KISS.
2015-08-08 05:44:30 -04:00
Beman
d5fb8323f8 Change the name of path::relative to path::relative_to to distinguish it a bit from path::relative_path. 2015-08-07 16:50:47 -04:00
Beman
6da5f657fb Remove lexically_relative() free function. Add path::rel 2015-08-07 16:41:06 -04:00
Beman
dc794ea95b Merge branch 'feature/relative' into feature/relative2 2015-08-06 08:08:46 -04:00
Beman
95175ef819 Fix #11491, temp_directory_path doesn't return valid temp path on Android. 2015-07-22 11:13:06 -04:00
Adrien Destugues
3a02e54625 haiku: don't crash because of unsupported locale in libstdc++
See https://svn.boost.org/trac/boost/ticket/4688
We do the same as on Mac OS X and assume the filesystem uses utf-8.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2015-03-17 22:26:31 +00:00
Beman
424f09019c Rewrite Windows implementation of temp_directory_path() to (1) avoid GetTempPath() failure if path length > 130 (ticket #5300) and (2) provide a more sensible sequence of directories than provided by GetTempPath(), per boost list discussion "[filesystem] temp_directory_path() behavior on Windows". 2015-02-03 11:31:57 -05:00
Beman
06bddf3bc3 Rename typedef causing conflict with cygwin libraries. Fix refactoring missed in create_directory_symlink() that only affected cygwin tests. Clear gcc warning on cygwin tests. 2015-01-31 08:53:02 -05:00
Beman
01bbe99241 Refactor operations error handling helpers to (1) be less confusing and (2) fix a Windows problem where ::SetLastError() values were getting cleared before they could be retrieved by the error handling helpers. 2015-01-31 08:00:59 -05:00