[libc-commits] [libc] [libc] Support _IONBF buffering for read_unlocked (PR #120677)
via libc-commits
libc-commits at lists.llvm.org
Fri Dec 20 02:09:22 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff fbc18b85d6ce5ab6489a2b08f9b38d446fe9d6f6 394dd062b1c49f361885b31cf38d47edfc7f0ce6 --extensions h,cpp -- libc/src/__support/File/file.cpp libc/src/__support/File/file.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index 4929947854..8b70db32d4 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -233,7 +233,8 @@ FileIOResult File::read_unlocked_fbf(uint8_t *data, size_t len) {
// Update the dataref to reflect that fact that we have already
// copied |available_data| into |data|.
size_t to_fetch = len - available_data;
- cpp::span<uint8_t> dataref(static_cast<uint8_t *>(data) + available_data, to_fetch);
+ cpp::span<uint8_t> dataref(static_cast<uint8_t *>(data) + available_data,
+ to_fetch);
if (to_fetch > bufsize) {
auto result = platform_read(this, dataref.data(), to_fetch);
@@ -272,7 +273,8 @@ FileIOResult File::read_unlocked_nbf(uint8_t *data, size_t len) {
return available_data;
// Directly copy the data into |data|.
- cpp::span<uint8_t> dataref(static_cast<uint8_t *>(data) + available_data, len - available_data);
+ cpp::span<uint8_t> dataref(static_cast<uint8_t *>(data) + available_data,
+ len - available_data);
auto result = platform_read(this, dataref.data(), dataref.size());
if (result.has_error() || result < dataref.size()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/120677
More information about the libc-commits
mailing list