mirror of
https://github.com/pellepl/spiffs.git
synced 2026-10-08 00:37:38 +00:00
Fix compiler warnings for non-gcc #83
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
// ----------- >8 ------------
|
||||
|
||||
// compile time switches
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ typedef enum {
|
||||
SPIFFS_CHECK_FIX_LOOKUP,
|
||||
SPIFFS_CHECK_DELETE_ORPHANED_INDEX,
|
||||
SPIFFS_CHECK_DELETE_PAGE,
|
||||
SPIFFS_CHECK_DELETE_BAD_FILE,
|
||||
SPIFFS_CHECK_DELETE_BAD_FILE
|
||||
} spiffs_check_report;
|
||||
|
||||
/* file system check callback function */
|
||||
@@ -125,7 +125,7 @@ typedef enum {
|
||||
/* the file has been updated or moved to another page */
|
||||
SPIFFS_CB_UPDATED,
|
||||
/* the file has been deleted */
|
||||
SPIFFS_CB_DELETED,
|
||||
SPIFFS_CB_DELETED
|
||||
} spiffs_fileop_type;
|
||||
|
||||
/* file system listener callback function */
|
||||
|
||||
@@ -255,10 +255,7 @@ s32_t spiffs_gc_find_candidate(
|
||||
s32_t *cand_scores = (s32_t *)(fs->work + max_candidates * sizeof(spiffs_block_ix));
|
||||
|
||||
// align cand_scores on s32_t boundary
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
|
||||
cand_scores = (s32_t*)(((ptrdiff_t)cand_scores + sizeof(ptrdiff_t) - 1) & ~(sizeof(ptrdiff_t) - 1));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
*block_candidates = cand_blocks;
|
||||
|
||||
|
||||
+4
-10
@@ -89,12 +89,9 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
|
||||
fs->work = &work[0];
|
||||
fs->lu_work = &work[SPIFFS_CFG_LOG_PAGE_SZ(fs)];
|
||||
memset(fd_space, 0, fd_space_size);
|
||||
// align fd_space pointer to pointer size byte boundary, below is safe
|
||||
// align fd_space pointer to pointer size byte boundary
|
||||
u8_t ptr_size = sizeof(void*);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
|
||||
u8_t addr_lsb = ((u8_t)fd_space) & (ptr_size-1);
|
||||
#pragma GCC diagnostic pop
|
||||
u8_t addr_lsb = ((u8_t)(intptr_t)fd_space) & (ptr_size-1);
|
||||
if (addr_lsb) {
|
||||
fd_space += (ptr_size-addr_lsb);
|
||||
fd_space_size -= (ptr_size-addr_lsb);
|
||||
@@ -102,11 +99,8 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
|
||||
fs->fd_space = fd_space;
|
||||
fs->fd_count = (fd_space_size/sizeof(spiffs_fd));
|
||||
|
||||
// align cache pointer to 4 byte boundary, below is safe
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
|
||||
addr_lsb = ((u8_t)cache) & (ptr_size-1);
|
||||
#pragma GCC diagnostic pop
|
||||
// align cache pointer to 4 byte boundary
|
||||
addr_lsb = ((u8_t)(intptr_t)cache) & (ptr_size-1);
|
||||
if (addr_lsb) {
|
||||
u8_t *cache_8 = (u8_t *)cache;
|
||||
cache_8 += (ptr_size-addr_lsb);
|
||||
|
||||
@@ -37,15 +37,23 @@ void real_assert(int c, const char *n, const char *file, int l);
|
||||
/////////// SPIFFS BUILD CONFIG ////////////
|
||||
|
||||
// test using filesystem magic
|
||||
#ifndef SPIFFS_USE_MAGIC
|
||||
#define SPIFFS_USE_MAGIC 1
|
||||
#endif
|
||||
// test using filesystem magic length
|
||||
#ifndef SPIFFS_USE_MAGIC_LENGTH
|
||||
#define SPIFFS_USE_MAGIC_LENGTH 1
|
||||
#endif
|
||||
// test using extra param in callback
|
||||
#ifndef SPIFFS_HAL_CALLBACK_EXTRA
|
||||
#define SPIFFS_HAL_CALLBACK_EXTRA 1
|
||||
#endif
|
||||
// test using filehandle offset
|
||||
#ifndef SPIFFS_FILEHDL_OFFSET
|
||||
#define SPIFFS_FILEHDL_OFFSET 1
|
||||
// use this offset
|
||||
#define TEST_SPIFFS_FILEHDL_OFFSET 0x1000
|
||||
#endif
|
||||
|
||||
// dbg output
|
||||
#define SPIFFS_DBG(...) //printf(__VA_ARGS__)
|
||||
|
||||
Reference in New Issue
Block a user