Skip to content

SPIFFS File implementation of seek is non-standard for Arduino #2553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Makuna opened this issue Sep 27, 2016 · 2 comments
Closed

SPIFFS File implementation of seek is non-standard for Arduino #2553

Makuna opened this issue Sep 27, 2016 · 2 comments

Comments

@Makuna
Copy link
Collaborator

Makuna commented Sep 27, 2016

Basic Infos

SPIFFS File implementation of seek is non-standard for Arduino

Description

All implementations of "seek" for Arduino File objects only take one param and assume seek from the front of the file.
The SPIFFs only implements one "seek" that requires a second param that defines the SeekMode. This makes it difficult to write code/libraries that will work across SD file objects and SPIFFs file objects.

The solution is change the SeekMode to have a default value of SeekSet or add another seek that doesn't take the second parameter.

FS.h

bool seek(uint32_t pos, SeekMode mode = SeekSet);

or

bool seek(uint32_t pos)
{
    seek(pos, SeekSet);
}
@Makuna
Copy link
Collaborator Author

Makuna commented Sep 27, 2016

ALSO, the read method was changed. While agree with returning size_t, the change of the first param from void* to uint8_t* could be problematic; but is easily worked around by always casting to uint8_t* when passing anything that is not already a collection of 8bit types (like a structure).

@devyte
Copy link
Collaborator

devyte commented Oct 12, 2017

Referenced PR is already merged, closing.

@devyte devyte closed this as completed Oct 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants