Skip to content

Commit f558e69

Browse files
luc-githubme-no-dev
authored andcommitted
Fix warnings in platformio (#2960)
Fix : warning: converting to non-pointer type 'int' from NULL [-Wconversion-null] Fix : warning: unused variable 'res' [-Wunused-variable]
1 parent 5bf3aab commit f558e69

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void F_Fat::end()
6868
log_e("Unmounting FFat partition failed! Error: %d", err);
6969
return;
7070
}
71-
_wl_handle = NULL;
71+
_wl_handle = 0;
7272
_impl->mountpoint(NULL);
7373
}
7474
}
@@ -109,7 +109,9 @@ size_t F_Fat::totalBytes()
109109

110110
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
111111
char drv[3] = {(char)(48+pdrv), ':', 0};
112-
FRESULT res = f_getfree(drv, &free_clust, &fs);
112+
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
113+
return 0;
114+
}
113115
tot_sect = (fs->n_fatent - 2) * fs->csize;
114116
sect_size = CONFIG_WL_SECTOR_SIZE;
115117
return tot_sect * sect_size;
@@ -123,7 +125,9 @@ size_t F_Fat::freeBytes()
123125

124126
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
125127
char drv[3] = {(char)(48+pdrv), ':', 0};
126-
FRESULT res = f_getfree(drv, &free_clust, &fs);
128+
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
129+
return 0;
130+
}
127131
free_sect = free_clust * fs->csize;
128132
sect_size = CONFIG_WL_SECTOR_SIZE;
129133
return free_sect * sect_size;

0 commit comments

Comments
 (0)