Skip to content

Commit 1529ed0

Browse files
committed
clean up
1 parent 87a3907 commit 1529ed0

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using namespace LittleFilesystem;
3636
File::File (Adafruit_LittleFS &fs)
3737
{
3838
_fs = &fs;
39-
_hdl = NULL;
39+
_file = NULL;
4040
_dir = NULL;
4141
_path = NULL;
4242
_is_dir = false;
@@ -45,7 +45,7 @@ File::File (Adafruit_LittleFS &fs)
4545
File::File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs)
4646
{
4747
_fs = &fs;
48-
_hdl = NULL;
48+
_file = NULL;
4949
_dir = NULL;
5050
_path = NULL;
5151
_is_dir = false;
@@ -56,7 +56,7 @@ File::File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs)
5656
File& File::operator = (const File &rhs)
5757
{
5858
// close if currently opened
59-
if ( _hdl ) close();
59+
if ( _file ) close();
6060
memcpy(this, &rhs, sizeof(File));
6161
return *this;
6262
}
@@ -90,7 +90,7 @@ File File::_open_file (char const *filepath, uint8_t mode)
9090
// move to end of file
9191
if ( mode == FILE_WRITE ) lfs_file_seek(_fs->getFS(), fhdl, 0, LFS_SEEK_END);
9292

93-
file._hdl = fhdl;
93+
file._file = fhdl;
9494
file._is_dir = false;
9595

9696
file._path = (char*) rtos_malloc(strlen(filepath) + 1);
@@ -128,7 +128,7 @@ File File::_open_dir (char const *filepath)
128128
bool File::open (char const *filepath, uint8_t mode)
129129
{
130130
// close if currently opened
131-
if ( _hdl ) close();
131+
if ( _file ) close();
132132

133133
File file(*_fs);
134134
struct lfs_info info;
@@ -149,7 +149,7 @@ bool File::open (char const *filepath, uint8_t mode)
149149
PRINT_LFS_ERR(rc);
150150
}
151151

152-
return _hdl != NULL;
152+
return _file != NULL;
153153
}
154154

155155
size_t File::write (uint8_t ch)
@@ -162,7 +162,7 @@ size_t File::write (uint8_t const *buf, size_t size)
162162
{
163163
VERIFY(!_is_dir, 0);
164164

165-
lfs_ssize_t wrcount = lfs_file_write(_fs->getFS(), _hdl, buf, size);
165+
lfs_ssize_t wrcount = lfs_file_write(_fs->getFS(), _file, buf, size);
166166
VERIFY(wrcount > 0, 0);
167167
return wrcount;
168168
}
@@ -177,7 +177,7 @@ int File::read (void)
177177
int File::read (void *buf, uint16_t nbyte)
178178
{
179179
VERIFY(!_is_dir, 0);
180-
return lfs_file_read(_fs->getFS(), _hdl, buf, nbyte);
180+
return lfs_file_read(_fs->getFS(), _file, buf, nbyte);
181181
}
182182

183183
int File::peek (void)
@@ -198,52 +198,52 @@ int File::available (void)
198198
bool File::seek (uint32_t pos)
199199
{
200200
VERIFY(!_is_dir, false);
201-
return lfs_file_seek(_fs->getFS(), _hdl, pos, LFS_SEEK_SET) >= 0;
201+
return lfs_file_seek(_fs->getFS(), _file, pos, LFS_SEEK_SET) >= 0;
202202
}
203203

204204
uint32_t File::position (void)
205205
{
206206
VERIFY(!_is_dir, 0);
207-
return lfs_file_tell(_fs->getFS(), _hdl);
207+
return lfs_file_tell(_fs->getFS(), _file);
208208
}
209209

210210
uint32_t File::size (void)
211211
{
212212
VERIFY(!_is_dir, 0);
213-
return lfs_file_size(_fs->getFS(), _hdl);
213+
return lfs_file_size(_fs->getFS(), _file);
214214
}
215215

216216
void File::flush (void)
217217
{
218218
VERIFY(!_is_dir,);
219-
lfs_file_sync(_fs->getFS(), _hdl);
219+
lfs_file_sync(_fs->getFS(), _file);
220220
}
221221

222222
void File::close (void)
223223
{
224-
if ( _hdl )
224+
if ( _file )
225225
{
226226
if ( _is_dir )
227227
{
228228
lfs_dir_close(_fs->getFS(), _dir);
229229
}
230230
else
231231
{
232-
lfs_file_close(_fs->getFS(), _hdl);
232+
lfs_file_close(_fs->getFS(), _file);
233233
}
234234

235-
rtos_free(_hdl);
235+
rtos_free(_file);
236236
}
237237

238238
if ( _path ) rtos_free(_path);
239239

240-
_hdl = NULL;
240+
_file = NULL;
241241
_path = NULL;
242242
}
243243

244244
File::operator bool (void)
245245
{
246-
return _hdl != NULL;
246+
return _file != NULL;
247247
}
248248

249249
char const* File::name (void)

libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class File : public Stream
8080
private:
8181
Adafruit_LittleFS* _fs;
8282

83-
lfs_file_t* _hdl; // file hanlde
83+
lfs_file_t* _file; // file hanlde
8484
lfs_dir_t* _dir; // dir handle
8585

8686
char* _path;

0 commit comments

Comments
 (0)