|
8 | 8 |
|
9 | 9 | #pragma once |
10 | 10 |
|
| 11 | +#include <cstring> |
11 | 12 | #include <executorch/runtime/core/data_loader.h> |
12 | 13 | #include <executorch/runtime/core/error.h> |
13 | 14 | #include <executorch/runtime/core/result.h> |
14 | 15 | #include <executorch/runtime/platform/log.h> |
15 | 16 | #include <memory> |
16 | | -#include <cstring> |
17 | 17 |
|
18 | 18 | namespace executorch { |
19 | 19 | namespace extension { |
@@ -45,18 +45,19 @@ class SharedPtrDataLoader final : public executorch::runtime::DataLoader { |
45 | 45 | static_cast<uint8_t*>(data_.get()) + offset, size, /*free_fn=*/nullptr); |
46 | 46 | } |
47 | 47 |
|
48 | | - ET_NODISCARD executorch::runtime::Error load_into( |
49 | | - size_t offset, |
50 | | - size_t size, |
51 | | - const DataLoader::SegmentInfo& segment_info, |
52 | | - void* buffer) const override { |
| 48 | + ET_NODISCARD |
| 49 | + executorch::runtime::Error load_into( |
| 50 | + size_t offset, |
| 51 | + size_t size, |
| 52 | + const DataLoader::SegmentInfo& segment_info, |
| 53 | + void* buffer) const override { |
53 | 54 | ET_CHECK_OR_RETURN_ERROR( |
54 | | - offset + size <= size_, |
55 | | - executorch::runtime::Error::OutOfBounds, |
56 | | - "offset %zu + size %zu exceeds buffer size %zu", |
57 | | - offset, |
58 | | - size, |
59 | | - size_); |
| 55 | + offset + size <= size_, |
| 56 | + executorch::runtime::Error::OutOfBounds, |
| 57 | + "offset %zu + size %zu exceeds buffer size %zu", |
| 58 | + offset, |
| 59 | + size, |
| 60 | + size_); |
60 | 61 |
|
61 | 62 | std::memcpy(buffer, static_cast<uint8_t*>(data_.get()) + offset, size); |
62 | 63 | return executorch::runtime::Error::Ok; |
|
0 commit comments