DataFlash: fixed some build warnings

This commit is contained in:
Andrew Tridgell 2015-05-04 17:27:15 +10:00
parent d8ca0658d7
commit 438f954379
2 changed files with 8 additions and 2 deletions

View File

@ -149,7 +149,9 @@ bool DataFlash_File::NeedErase(void)
char *DataFlash_File::_log_file_name(uint16_t log_num)
{
char *buf = NULL;
asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num);
if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == 0) {
return NULL;
}
return buf;
}
@ -160,7 +162,9 @@ char *DataFlash_File::_log_file_name(uint16_t log_num)
char *DataFlash_File::_lastlog_file_name(void)
{
char *buf = NULL;
asprintf(&buf, "%s/LASTLOG.TXT", _log_directory);
if (asprintf(&buf, "%s/LASTLOG.TXT", _log_directory) == 0) {
return NULL;
}
return buf;
}

View File

@ -16,6 +16,8 @@
#include <assert.h>
#include "DataFlash.h"
#pragma GCC diagnostic ignored "-Wunused-result"
#define DF_PAGE_SIZE 512
#define DF_NUM_PAGES 16384