Read n bytes into destination buffer Returns false on out-of-bounds or error
| 41 | // Read n bytes into destination buffer |
| 42 | // Returns false on out-of-bounds or error |
| 43 | bool read(size_t n, uint8_t* dst) { |
| 44 | if (!dst || n == 0) { |
| 45 | return false; |
| 46 | } |
| 47 | if (pos_ + n > length_) { |
| 48 | return false; // Out of bounds |
| 49 | } |
| 50 | std::memcpy(dst, data_ + pos_, n); |
| 51 | pos_ += n; |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | // Read 1 byte (uint8_t) |
| 56 | bool read1(uint8_t* dst) { |
nothing calls this directly
no outgoing calls
no test coverage detected