Fix compiler warnings over const losses.

This commit is contained in:
Our Air Quality 2019-04-06 11:30:53 +11:00
parent d0373af5c0
commit 2d9c701c37
13 changed files with 22 additions and 22 deletions

View file

@ -184,7 +184,7 @@ uint32_t IRAM run_test(const char *string, test_with_fn_t testfn, const char *te
return instructions; return instructions;
} }
void test_string(const char *string, char *label, bool evict_cache) void test_string(const char *string, const char *label, bool evict_cache)
{ {
printf("Testing %s (%p) '%s'\r\n", label, string, string); printf("Testing %s (%p) '%s'\r\n", label, string, string);
printf("Formats as: '"); printf("Formats as: '");

View file

@ -43,7 +43,7 @@ int32_t ssi_handler(int32_t iIndex, char *pcInsert, int32_t iInsertLen)
return (strlen(pcInsert)); return (strlen(pcInsert));
} }
char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[]) const char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{ {
for (int i = 0; i < iNumParams; i++) { for (int i = 0; i < iNumParams; i++) {
if (strcmp(pcParam[i], "on") == 0) { if (strcmp(pcParam[i], "on") == 0) {
@ -63,12 +63,12 @@ char *gpio_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValu
return "/index.ssi"; return "/index.ssi";
} }
char *about_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[]) const char *about_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{ {
return "/about.html"; return "/about.html";
} }
char *websocket_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[]) const char *websocket_cgi_handler(int iIndex, int iNumParams, char *pcParam[], char *pcValue[])
{ {
return "/websockets.html"; return "/websockets.html";
} }

View file

@ -32,7 +32,7 @@
void sntp_tsk(void *pvParameters) void sntp_tsk(void *pvParameters)
{ {
char *servers[] = {SNTP_SERVERS}; const char *servers[] = {SNTP_SERVERS};
UNUSED_ARG(pvParameters); UNUSED_ARG(pvParameters);
/* Wait until we have joined AP and are assigned an IP */ /* Wait until we have joined AP and are assigned an IP */

View file

@ -19,7 +19,7 @@ void httpd_task(void *pvParameters)
if ((err = netconn_recv(client, &nb)) == ERR_OK) { if ((err = netconn_recv(client, &nb)) == ERR_OK) {
struct sdk_station_config config; struct sdk_station_config config;
sdk_wifi_station_get_config(&config); sdk_wifi_station_get_config(&config);
char * buf = const char * buf =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<root>\ <root>\
<device>\ <device>\
@ -50,4 +50,4 @@ void httpd_task(void *pvParameters)
netconn_close(client); netconn_close(client);
netconn_delete(client); netconn_delete(client);
} }
} }

View file

@ -25,7 +25,7 @@ static const char* get_my_ip(void)
* @param recv the lwip UDP callback * @param recv the lwip UDP callback
* @retval udp_pcb* or NULL if joining failed * @retval udp_pcb* or NULL if joining failed
*/ */
static struct udp_pcb* mcast_join_group(char *group_ip, uint16_t group_port, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)) static struct udp_pcb* mcast_join_group(const char *group_ip, uint16_t group_port, void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port))
{ {
bool status = false; bool status = false;
struct udp_pcb *upcb; struct udp_pcb *upcb;

View file

@ -19,7 +19,7 @@
typedef void (*handle_http_token)(char *); typedef void (*handle_http_token)(char *);
struct http_token_table { struct http_token_table {
char * token; const char * token;
handle_http_token http_tock_cb; handle_http_token http_tock_cb;
}; };

View file

@ -15,9 +15,9 @@ typedef enum {
} HTTP_Client_State; } HTTP_Client_State;
typedef struct { typedef struct {
char * server; const char * server;
char * port; const char * port;
char * path; const char * path;
char * buffer; char * buffer;
uint16_t buffer_size; uint16_t buffer_size;
http_final_cb buffer_full_cb; http_final_cb buffer_full_cb;

View file

@ -38,10 +38,10 @@ typedef enum {
* Struct that contains all info for start ota. * Struct that contains all info for start ota.
*/ */
typedef struct { typedef struct {
char *server; /**< Server domain */ const char *server; /**< Server domain */
char *port; /**< Server port */ const char *port; /**< Server port */
char *binary_path; /**< Server Path dowload new update binary */ const char *binary_path; /**< Server Path dowload new update binary */
char *sha256_path; /**< Server Path of SHA256 sum for check binary, could be NULL, check will be skipped */ const char *sha256_path; /**< Server Path of SHA256 sum for check binary, could be NULL, check will be skipped */
} ota_info; } ota_info;
/** /**

View file

@ -239,7 +239,7 @@ typedef struct __attribute__((packed)) {
bool rboot_verify_image(uint32_t initial_offset, uint32_t *image_length, const char **error_message) bool rboot_verify_image(uint32_t initial_offset, uint32_t *image_length, const char **error_message)
{ {
uint32_t offset = initial_offset; uint32_t offset = initial_offset;
char *error = NULL; const char *error = NULL;
RBOOT_DEBUG("rboot_verify_image: verifying image at 0x%08x\n", initial_offset); RBOOT_DEBUG("rboot_verify_image: verifying image at 0x%08x\n", initial_offset);
if(offset % 4) { if(offset % 4) {
error = "Unaligned flash offset"; error = "Unaligned flash offset";

View file

@ -690,7 +690,7 @@ sntp_request(void *arg)
void void
sntp_init(void) sntp_init(void)
{ {
char *def_addr[] = {SNTP_SERVER_ADDRESS}; const char *def_addr[] = {SNTP_SERVER_ADDRESS};
sntp_num_servers = 0; sntp_num_servers = 0;
sntp_set_servers(def_addr, sizeof(def_addr) / sizeof(char*)); sntp_set_servers(def_addr, sizeof(def_addr) / sizeof(char*));
@ -715,7 +715,7 @@ sntp_init(void)
/** /**
* Set the NTP servers * Set the NTP servers
*/ */
int sntp_set_servers(char *server_url[], int num_servers) int sntp_set_servers(const char *server_url[], int num_servers)
{ {
int i; int i;

View file

@ -52,7 +52,7 @@ void sntp_set_timezone(const struct timezone *tz);
* Returns 0 if OK, less than 0 if error. * Returns 0 if OK, less than 0 if error.
* NOTE: This function must NOT be called before sntp_initialize(). * NOTE: This function must NOT be called before sntp_initialize().
*/ */
int sntp_set_servers(char *server_url[], int num_servers); int sntp_set_servers(const char *server_url[], int num_servers);
/* /*
* Sets the update delay in ms. If requested value is less than 15s, * Sets the update delay in ms. If requested value is less than 15s,

View file

@ -1007,7 +1007,7 @@ int ssd1306_draw_char(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font
return d->width; return d->width;
} }
int ssd1306_draw_string(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font, uint8_t x, uint8_t y, char *str, int ssd1306_draw_string(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font, uint8_t x, uint8_t y, const char *str,
ssd1306_color_t foreground, ssd1306_color_t background) ssd1306_color_t foreground, ssd1306_color_t background)
{ {
uint8_t t = x; uint8_t t = x;

View file

@ -493,7 +493,7 @@ int ssd1306_draw_char(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font
* @param background Background color * @param background Background color
* @return Width of the string or negative value if error occured * @return Width of the string or negative value if error occured
*/ */
int ssd1306_draw_string(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font, uint8_t x, uint8_t y, char *str, ssd1306_color_t foreground, ssd1306_color_t background); int ssd1306_draw_string(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font, uint8_t x, uint8_t y, const char *str, ssd1306_color_t foreground, ssd1306_color_t background);
/** /**
* Stop scrolling (the ram data needs to be rewritten) * Stop scrolling (the ram data needs to be rewritten)