MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / findBytes

Function findBytes

src/webInterface.cpp:323–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323int findBytes(const std::vector<uint8_t> &data, const String &needle) {
324 if (needle.isEmpty() || data.size() < static_cast<size_t>(needle.length())) return -1;
325 for (size_t i = 0; i <= data.size() - needle.length(); ++i) {
326 bool match = true;
327 for (int j = 0; j < needle.length(); ++j) {
328 if (data[i + j] != static_cast<uint8_t>(needle[j])) {
329 match = false;
330 break;
331 }
332 }
333 if (match) return i;
334 }
335 return -1;
336}
337
338bool writeUploadData(File &file, const uint8_t *data, size_t len, size_t written) {
339 if (!update) return file.write(data, len) == len;

Callers 1

streamMultipartUploadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected