Skip to content

Commit 0ab2c58

Browse files
FS library position() to return (size_t) -1 on error (#10002)
* 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>
1 parent 0adf787 commit 0ab2c58

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: libraries/FS/src/FS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bool File::seek(uint32_t pos, SeekMode mode) {
105105

106106
size_t File::position() const {
107107
if (!*this) {
108-
return 0;
108+
return (size_t)-1;
109109
}
110110

111111
return _p->position();

Diff for: libraries/FS/src/FS.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class File : public Stream {
6464
bool seek(uint32_t pos) {
6565
return seek(pos, SeekSet);
6666
}
67-
size_t position() const;
67+
size_t position() const; // returns (size_t)-1 on error
6868
size_t size() const;
6969
bool setBufferSize(size_t size);
7070
void close();

0 commit comments

Comments
 (0)