storage: fix and re-enable -Wformat warnings

This commit is contained in:
Ivan Grokhotkov
2022-10-06 16:16:32 +02:00
parent c99a82de28
commit 23e1ae1bc2
19 changed files with 30 additions and 39 deletions
-2
View File
@@ -21,5 +21,3 @@ idf_component_register(SRCS ${srcs}
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation)
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
+6 -6
View File
@@ -148,7 +148,7 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
uint32_t flash_page_size = g_rom_flashchip.page_size;
uint32_t log_page_size = CONFIG_SPIFFS_PAGE_SIZE;
if (log_page_size % flash_page_size != 0) {
ESP_LOGE(TAG, "SPIFFS_PAGE_SIZE is not multiple of flash chip page size (%d)",
ESP_LOGE(TAG, "SPIFFS_PAGE_SIZE is not multiple of flash chip page size (%" PRIu32 ")",
flash_page_size);
return ESP_ERR_INVALID_ARG;
}
@@ -268,11 +268,11 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
efs->cache, efs->cache_sz, spiffs_api_check);
if (conf->format_if_mount_failed && res != SPIFFS_OK) {
ESP_LOGW(TAG, "mount failed, %i. formatting...", SPIFFS_errno(efs->fs));
ESP_LOGW(TAG, "mount failed, %" PRId32 ". formatting...", SPIFFS_errno(efs->fs));
SPIFFS_clearerr(efs->fs);
res = SPIFFS_format(efs->fs);
if (res != SPIFFS_OK) {
ESP_LOGE(TAG, "format failed, %i", SPIFFS_errno(efs->fs));
ESP_LOGE(TAG, "format failed, %" PRId32, SPIFFS_errno(efs->fs));
SPIFFS_clearerr(efs->fs);
esp_spiffs_free(&efs);
return ESP_FAIL;
@@ -281,7 +281,7 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
efs->cache, efs->cache_sz, spiffs_api_check);
}
if (res != SPIFFS_OK) {
ESP_LOGE(TAG, "mount failed, %i", SPIFFS_errno(efs->fs));
ESP_LOGE(TAG, "mount failed, %" PRId32, SPIFFS_errno(efs->fs));
SPIFFS_clearerr(efs->fs);
esp_spiffs_free(&efs);
return ESP_FAIL;
@@ -354,7 +354,7 @@ esp_err_t esp_spiffs_format(const char* partition_label)
s32_t res = SPIFFS_format(_efs[index]->fs);
if (res != SPIFFS_OK) {
ESP_LOGE(TAG, "format failed, %i", SPIFFS_errno(_efs[index]->fs));
ESP_LOGE(TAG, "format failed, %" PRId32, SPIFFS_errno(_efs[index]->fs));
SPIFFS_clearerr(_efs[index]->fs);
/* If the partition was previously mounted, but format failed, don't
* try to mount the partition back (it will probably fail). On the
@@ -371,7 +371,7 @@ esp_err_t esp_spiffs_format(const char* partition_label)
_efs[index]->fds, _efs[index]->fds_sz, _efs[index]->cache,
_efs[index]->cache_sz, spiffs_api_check);
if (res != SPIFFS_OK) {
ESP_LOGE(TAG, "mount failed, %i", SPIFFS_errno(_efs[index]->fs));
ESP_LOGE(TAG, "mount failed, %" PRId32, SPIFFS_errno(_efs[index]->fs));
SPIFFS_clearerr(_efs[index]->fs);
return ESP_FAIL;
}
+5 -5
View File
@@ -27,7 +27,7 @@ s32_t spiffs_api_read(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *dst)
esp_err_t err = esp_partition_read(((esp_spiffs_t *)(fs->user_data))->partition,
addr, dst, size);
if (unlikely(err)) {
ESP_LOGE(TAG, "failed to read addr %08x, size %08x, err %d", addr, size, err);
ESP_LOGE(TAG, "failed to read addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
return -1;
}
return 0;
@@ -38,7 +38,7 @@ s32_t spiffs_api_write(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *src)
esp_err_t err = esp_partition_write(((esp_spiffs_t *)(fs->user_data))->partition,
addr, src, size);
if (unlikely(err)) {
ESP_LOGE(TAG, "failed to write addr %08x, size %08x, err %d", addr, size, err);
ESP_LOGE(TAG, "failed to write addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
return -1;
}
return 0;
@@ -49,7 +49,7 @@ s32_t spiffs_api_erase(spiffs *fs, uint32_t addr, uint32_t size)
esp_err_t err = esp_partition_erase_range(((esp_spiffs_t *)(fs->user_data))->partition,
addr, size);
if (err) {
ESP_LOGE(TAG, "failed to erase addr %08x, size %08x, err %d", addr, size, err);
ESP_LOGE(TAG, "failed to erase addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
return -1;
}
return 0;
@@ -75,10 +75,10 @@ void spiffs_api_check(spiffs *fs, spiffs_check_type type,
};
if (report != SPIFFS_CHECK_PROGRESS) {
ESP_LOGE(TAG, "CHECK: type:%s, report:%s, %x:%x", spiffs_check_type_str[type],
ESP_LOGE(TAG, "CHECK: type:%s, report:%s, %" PRIx32 ":%" PRIx32, spiffs_check_type_str[type],
spiffs_check_report_str[report], arg1, arg2);
} else {
ESP_LOGV(TAG, "CHECK PROGRESS: report:%s, %x:%x",
ESP_LOGV(TAG, "CHECK PROGRESS: report:%s, %" PRIx32 ":%" PRIx32,
spiffs_check_report_str[report], arg1, arg2);
}
}