Skip to content

Commit

Permalink
FS library position() to return (size_t) -1 on error (#10002)
Browse files Browse the repository at this point in the history
* position_fix

Fix for error return from position()
Issue #9992

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
drmpf and pre-commit-ci-lite[bot] committed Jul 10, 2024
1 parent 0adf787 commit 0ab2c58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libraries/FS/src/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool File::seek(uint32_t pos, SeekMode mode) {

size_t File::position() const {
if (!*this) {
return 0;
return (size_t)-1;
}

return _p->position();
Expand Down
2 changes: 1 addition & 1 deletion libraries/FS/src/FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class File : public Stream {
bool seek(uint32_t pos) {
return seek(pos, SeekSet);
}
size_t position() const;
size_t position() const; // returns (size_t)-1 on error
size_t size() const;
bool setBufferSize(size_t size);
void close();
Expand Down

0 comments on commit 0ab2c58

Please sign in to comment.