From f558e69181c39000fca9cbd3050b89bee7ee9211 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Tue, 9 Jul 2019 18:19:16 +0200 Subject: [PATCH] Fix warnings in platformio (#2960) Fix : warning: converting to non-pointer type 'int' from NULL [-Wconversion-null] Fix : warning: unused variable 'res' [-Wunused-variable] --- libraries/FFat/src/FFat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/FFat/src/FFat.cpp b/libraries/FFat/src/FFat.cpp index a7a03ac2..3dbda110 100644 --- a/libraries/FFat/src/FFat.cpp +++ b/libraries/FFat/src/FFat.cpp @@ -68,7 +68,7 @@ void F_Fat::end() log_e("Unmounting FFat partition failed! Error: %d", err); return; } - _wl_handle = NULL; + _wl_handle = 0; _impl->mountpoint(NULL); } } @@ -109,7 +109,9 @@ size_t F_Fat::totalBytes() BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle); char drv[3] = {(char)(48+pdrv), ':', 0}; - FRESULT res = f_getfree(drv, &free_clust, &fs); + if ( f_getfree(drv, &free_clust, &fs) != FR_OK){ + return 0; + } tot_sect = (fs->n_fatent - 2) * fs->csize; sect_size = CONFIG_WL_SECTOR_SIZE; return tot_sect * sect_size; @@ -123,7 +125,9 @@ size_t F_Fat::freeBytes() BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle); char drv[3] = {(char)(48+pdrv), ':', 0}; - FRESULT res = f_getfree(drv, &free_clust, &fs); + if ( f_getfree(drv, &free_clust, &fs) != FR_OK){ + return 0; + } free_sect = free_clust * fs->csize; sect_size = CONFIG_WL_SECTOR_SIZE; return free_sect * sect_size;