You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Finder Opta device contains a 2Mbyte QSPI flash.
When calling UFile::available() to get the file size (file position still at 0 after opening), I would expect the file size. But I get almost flash size.
Firstly I have seen that when you call ftell() you use integer type instead of the required
type long. On different platforms, int can use from one to 4 bytes.
UFile::available() return type is uint32_t, but typically size_t should be used, as this
is semantically the same as file position or number of bytes written/read.
In this function there are no check if the call to ftell() was successful. The returned data are just used. but those could be wrong if seeking failed.
Using ftell(,,SEEK_END) is not implemented on every platform.
please see https://en.cppreference.com/w/c/io/fseek (right at the beginning).
For this Finder Opta device (supported by Arduino) the current position returned after
seeking to end and calling tell(), returns 1966048 bytes. Same file on USB returns the correct size (e.g. 128780)
Also UFile should support ftell and fflush as API (see end of page under section "Notes").
If you like you may create several issues for this one and separate it. I just wanted to tell you my findings.
The text was updated successfully, but these errors were encountered:
The Finder Opta device contains a 2Mbyte QSPI flash.
When calling
UFile::available()
to get the file size (file position still at 0 after opening), I would expect the file size. But I get almost flash size.ftell()
you use integer type instead of the requiredtype
long
. On different platforms,int
can use from one to 4 bytes.UFile::available()
return type isuint32_t
, but typicallysize_t
should be used, as thisis semantically the same as file position or number of bytes written/read.
ftell()
was successful. The returned data are just used. but those could be wrong if seeking failed.ftell(,,SEEK_END)
is not implemented on every platform.please see https://en.cppreference.com/w/c/io/fseek (right at the beginning).
For this Finder Opta device (supported by Arduino) the current position returned after
seeking to end and calling
tell()
, returns 1966048 bytes. Same file on USB returns the correct size (e.g. 128780)ftell
andfflush
as API (see end of page under section "Notes").If you like you may create several issues for this one and separate it. I just wanted to tell you my findings.
The text was updated successfully, but these errors were encountered: