MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / Length

Method Length

src/Storage/FileStore.cpp:298–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298FilePosition FileStore::Length() const noexcept
299{
300 switch (usageMode)
301 {
302 case FileUseMode::free:
303 REPORT_INTERNAL_ERROR;
304 return 0;
305
306 case FileUseMode::readOnly:
307#if HAS_SBC_INTERFACE
308 if (reprap.UsingSbcInterface())
309 {
310 return length;
311 }
312#endif
313#if HAS_MASS_STORAGE
314 return f_size(&file);
315#elif HAS_EMBEDDED_FILES
316 return EmbeddedFiles::Length(fileIndex);
317#else
318 return 0;
319#endif
320
321 case FileUseMode::readWrite:
322#if HAS_SBC_INTERFACE
323 if (reprap.UsingSbcInterface())
324 {
325 return (writeBuffer != nullptr) ? length + writeBuffer->BytesStored() : length;
326 }
327#endif
328#if HAS_MASS_STORAGE
329 return (writeBuffer != nullptr) ? f_size(&file) + writeBuffer->BytesStored() : f_size(&file);
330#else
331 return 0;
332#endif
333
334 case FileUseMode::invalidated:
335 default:
336 return 0;
337 }
338}
339
340#endif
341

Callers 15

ProcessLineMethod · 0.45
SendFileInfoMethod · 0.45
SendFileMethod · 0.45
SendJsonResponseMethod · 0.45
FinishUploadMethod · 0.45
THROWSFunction · 0.45
SendFileCredentialMethod · 0.45
SendUpdateFileMethod · 0.45
THROWSFunction · 0.45
HandleReplyMethod · 0.45
GCodes2.cppFile · 0.45
WriteBinaryToFileMethod · 0.45

Calls 3

f_sizeFunction · 0.85
UsingSbcInterfaceMethod · 0.80
BytesStoredMethod · 0.80

Tested by

no test coverage detected