Commit Graph

23 Commits

Author SHA1 Message Date
Martchus ad39cbd604 Apply clang-format 2023-04-29 12:53:18 +02:00
Martchus e8b4279062 Don't use sendfile64() if input and output are the same to avoid EBADF
This does not work and leads to sendfile64() running into EBADF ("Bad file
descriptor").
2023-04-23 21:21:32 +02:00
Martchus a55a3604bd Fallback from sendfile64() in case of ENOSYS as well
As suggested on https://man7.org/linux/man-pages/man2/sendfile.2.html.
2023-04-23 21:04:31 +02:00
Martchus 83025c17a1 Fallback to unoptimized version if sendfile64() fails
It might fail on some filesystems such as `ecryptfs`, see
https://github.com/Martchus/cpp-utilities/issues/24.
2023-04-23 19:38:56 +02:00
Martchus 2467c4f815 Make use of platform-specific APIs for optimizing CopyHelper configurable
There might be unexpected limitations like
https://github.com/Martchus/cpp-utilities/issues/24. To be able to at least
workaround those limitations it makes sense to allow disabling the
optimization completely.
2023-04-23 19:23:47 +02:00
Andrew J. Hesford c9131ce6e7 Fix use of `sendfile()` on 32-bit systems 2023-04-06 11:36:06 -04:00
Martchus 9b1a7b3bf4 Fix includes in `copy.h` when using `sendfile()` 2023-03-19 20:09:14 +01:00
Martchus ec891b48f6 Use `sendfile()` to speed up copying 2023-03-19 20:02:32 +01:00
Martchus fe6ad81340 Fix copy helper for large data sizes on 32-bit platforms
On 32-bit platforms `std::size_t` is just 4 bytes big which is not enough
to handle large data sizes. Using `std::streamsize` would likely be most
appropriate but switching signdness is likely not the best idea for
compatibility and it would mean a comparison with different signdness
because the buffer size is still `std::size_t`. So using `std::uint64_t`
now.
2022-07-14 00:30:40 +02:00
Martchus 8c033ca243 Fix warnings 2021-03-20 21:56:45 +01:00
Martchus b693c72eb1 Fix old namespaces being mentioned in the documentation 2019-09-04 18:45:28 +02:00
Martchus db4cba4fe5 Add NativeFileStream overloads to CopyHelper
In a future version these overloads could use native APIs such
as POSIX sendfile() to improve the speed. Libraries such as
tagparser will benefit from this change automatically when in
places where NativeFileStream is already used anyways.
2019-08-13 00:32:59 +02:00
Martchus b48b2f5c06 Have everything in one top-level namespace 2019-06-10 21:56:46 +02:00
Martchus e52fd5a4af Apply tidy after updating to clang-format 5.0.0
The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2017-09-17 21:45:23 +02:00
Martchus 59e20b1043 Apply clang-format 2017-05-01 03:13:11 +02:00
Martchus 94a6b47811 Improve documentation 2017-02-03 00:54:44 +01:00
Martchus 4829aa40b9 Fix mistakes in doc 2016-09-17 11:44:49 +02:00
Martchus d6b08b8ed9 Fix decoration for static builds
- Also add improvemnts a few other things in the build system
2016-08-29 15:35:48 +02:00
Martchus a8f7644350 minor adjustments 2016-01-18 23:41:30 +01:00
Martchus d5eb8a1608 fixed doc 2015-12-27 18:16:23 +01:00
Martchus 4d6bf67188 fixed includes 2015-09-06 20:19:09 +02:00
Martchus 603dbf823a fixed includes 2015-09-06 15:30:16 +02:00
Martchus 24ba96a17f First commit 2015-04-22 18:36:40 +02:00