Skip to content

Commit

Permalink
NimBLE: Fix compilation warnings and errors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhrishi authored and ESPAbhinav committed Feb 14, 2024
1 parent 6304435 commit 8956238
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nimble/host/store/config/src/ble_store_nvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -227,7 +227,7 @@ ble_nvs_delete_value(int obj_type, int8_t index)
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);
Expand Down
3 changes: 3 additions & 0 deletions porting/nimble/include/os/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -152,6 +154,7 @@ extern "C" {
#ifndef ntohs
#define ntohs htons
#endif
#endif

#ifndef htobe16
#define htobe16(x) os_bswap_16(x)
Expand Down
4 changes: 2 additions & 2 deletions porting/nimble/include/os/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define _QUEUE_H_

/* The common BSD linked list queue macros are already defined here for ESP-IDF */
#include <rom/queue.h>
#include <sys/queue.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -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
Expand Down

0 comments on commit 8956238

Please sign in to comment.