From 895623861df62d2f8cf130e8c19b7a79b20d0c6b Mon Sep 17 00:00:00 2001 From: Hrishikesh Dhayagude Date: Fri, 14 Jun 2019 22:25:06 +0800 Subject: [PATCH] NimBLE: Fix compilation warnings and errors 1. Remove networking macros from endian.h. They are not used in NimBLE (only used in socket transport, which our port does not use) 2. nvs_handle => nvs_handle_t 3. rom/queue.h => sys/queue.h --- nimble/host/store/config/src/ble_store_nvs.c | 6 +++--- porting/nimble/include/os/endian.h | 3 +++ porting/nimble/include/os/queue.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nimble/host/store/config/src/ble_store_nvs.c b/nimble/host/store/config/src/ble_store_nvs.c index e3e8bed9d..c57c992f0 100644 --- a/nimble/host/store/config/src/ble_store_nvs.c +++ b/nimble/host/store/config/src/ble_store_nvs.c @@ -96,7 +96,7 @@ get_nvs_db_value(int obj_type, char *key_string, union ble_store_value *val) { esp_err_t err; size_t required_size = 0; - nvs_handle nimble_handle; + nvs_handle_t nimble_handle; err = nvs_open(NIMBLE_NVS_NAMESPACE, NVS_READWRITE, &nimble_handle); if (err != ESP_OK) { @@ -191,7 +191,7 @@ static int ble_nvs_delete_value(int obj_type, int8_t index) { esp_err_t err; - nvs_handle nimble_handle; + nvs_handle_t nimble_handle; char key_string[NIMBLE_NVS_STR_NAME_MAX_LEN]; if (index > get_nvs_max_bonds(obj_type)) { @@ -227,7 +227,7 @@ error: static int ble_nvs_write_key_value(char *key, const void *value, size_t required_size) { - nvs_handle nimble_handle; + nvs_handle_t nimble_handle; esp_err_t err; err = nvs_open(NIMBLE_NVS_NAMESPACE, NVS_READWRITE, &nimble_handle); diff --git a/porting/nimble/include/os/endian.h b/porting/nimble/include/os/endian.h index 021a73ed6..5a7ede578 100644 --- a/porting/nimble/include/os/endian.h +++ b/porting/nimble/include/os/endian.h @@ -137,6 +137,8 @@ extern "C" { #define htonll ntohll #endif +/* These are not used in NimBLE and ESP-IDF uses them from LwIP */ +#if 0 #ifndef ntohl #define ntohl(x) os_bswap_32(x) #endif @@ -152,6 +154,7 @@ extern "C" { #ifndef ntohs #define ntohs htons #endif +#endif #ifndef htobe16 #define htobe16(x) os_bswap_16(x) diff --git a/porting/nimble/include/os/queue.h b/porting/nimble/include/os/queue.h index 8778d7600..c184a394e 100644 --- a/porting/nimble/include/os/queue.h +++ b/porting/nimble/include/os/queue.h @@ -34,7 +34,7 @@ #define _QUEUE_H_ /* The common BSD linked list queue macros are already defined here for ESP-IDF */ -#include +#include #ifdef __cplusplus extern "C" { @@ -43,7 +43,7 @@ extern "C" { /* * This file defines circular queues. The other types of data structures: * singly-linked lists, singly-linked tail queues, lists and tail queues - * are used from rom/queue.h + * are used from sys/queue.h * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at