Fix a couple of warnings (#6445)

* Fix a couple of warnings

* fix build error

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Thomas Göttgens
2025-03-29 14:14:24 +01:00
committed by GitHub
parent 7df327664e
commit 3148e7277d
8 changed files with 26 additions and 23 deletions

View File

@@ -217,9 +217,9 @@ int File::available(void)
_fs->_lockFS();
if (!this->_is_dir) {
uint32_t size = lfs_file_size(_fs->_getFS(), _file);
uint32_t file_size = lfs_file_size(_fs->_getFS(), _file);
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
ret = size - pos;
ret = file_size - pos;
}
_fs->_unlockFS();
@@ -279,10 +279,9 @@ bool File::truncate(uint32_t pos)
bool File::truncate(void)
{
int32_t ret = LFS_ERR_ISDIR;
uint32_t pos;
_fs->_lockFS();
if (!this->_is_dir) {
pos = lfs_file_tell(_fs->_getFS(), _file);
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
}
_fs->_unlockFS();