diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/posix.c b/libraries/AP_HAL_ChibiOS/hwdef/common/posix.c index a5f842ae21..70b05cbf5f 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/posix.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/posix.c @@ -109,6 +109,7 @@ along with this program. If not, see . #include #include "posix.h" +#include "stdio.h" #undef strerror_r /// Note: fdevopen assigns stdin,stdout,stderr @@ -231,7 +232,6 @@ fgetc(FILE *stream) } else { if(!stream->get) { - printf("fgetc stream->get NULL\n"); return(EOF); } // get character from device or file @@ -266,13 +266,6 @@ fputc(int c, FILE *stream) errno = 0; int ret; - if(stream == NULL) - { - errno = EBADF; // Bad File Number - return(EOF); - } - - if(stream != stdout && stream != stderr) { return(fatfs_putc(c,stream)); @@ -291,7 +284,6 @@ fputc(int c, FILE *stream) } else { if(!stream->put) { - printf("fputc stream->put NULL\n"); return(EOF); } ret = stream->put(c, stream); @@ -1225,7 +1217,8 @@ ssize_t write(int fd, const void *buf, size_t count) FILE * __wrap_freopen ( const char * filename, const char * mode, FILE * stream ) { - int ret = close(stream); + int fn = fileno(stream); + int ret = close(fn); if (ret < 0) { return NULL; } @@ -1411,7 +1404,7 @@ int utime(const char *filename, const struct utimbuf *times) int64_t fs_getfree() { FATFS *fs; - DWORD fre_clust, fre_sect, tot_sect; + DWORD fre_clust, fre_sect; /* Get volume information and free clusters of drive 1 */ @@ -1426,7 +1419,7 @@ int64_t fs_getfree() { int64_t fs_gettotal() { FATFS *fs; - DWORD fre_clust, fre_sect, tot_sect; + DWORD fre_clust, tot_sect; /* Get volume information and free clusters of drive 1 */ @@ -2238,7 +2231,6 @@ int fatfs_to_fileno(FIL *fh) */ static time_t replace_mktime(const struct tm *t) { - struct tm *u; time_t epoch = 0; int n; int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, y, m, i; diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c index e823b5522d..ce15a2b571 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/stdio.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "stdio.h" int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) @@ -236,7 +237,8 @@ atob(uint32_t *vp, char *p, int base) int vsscanf (const char *buf, const char *s, va_list ap) { - int count, noassign, width, base, lflag; + int count, noassign, base=0, lflag; + uint32_t width; const char *tc; char *t, tmp[MAXLN]; @@ -318,6 +320,8 @@ vsscanf (const char *buf, const char *s, va_list ap) return (count); } +static int vfscanf(FILE *stream, const char *fmt, va_list ap); + /* * fscanf(stream,fmt,va_alist) */