MCPcopy Create free account
hub / github.com/FastLED/FastLED / read

Method read

src/platforms/wasm/fs_wasm.cpp.hpp:166–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 size_t size() const override { return mData->capacity(); }
165
166 size_t read(char *dst, size_t bytesToRead) override {
167 if (mPos >= mData->capacity()) {
168 return 0;
169 }
170 if (mPos + bytesToRead > mData->capacity()) {
171 bytesToRead = mData->capacity() - mPos;
172 }
173 if (!mData->ready(mPos)) {
174 FL_WARN("File is not ready yet. This is a major error because "
175 "FastLED-wasm does not support async yet, the file "
176 "will fail to read.");
177 return 0;
178 }
179 size_t bytesRead = mData->read(mPos, reinterpret_cast<u8*>(dst), bytesToRead); // ok reinterpret cast
180 mPos += bytesRead;
181 return bytesRead;
182 }
183 using filebuf::read; // Pull in u8 overload
184
185 size_t write(const char *data, size_t count) override {

Callers

nothing calls this directly

Calls 3

capacityMethod · 0.45
readyMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected