diff --git a/examples/experiments/unaligned_load/unaligned_load.c b/examples/experiments/unaligned_load/unaligned_load.c index 9f02162..aa26a81 100644 --- a/examples/experiments/unaligned_load/unaligned_load.c +++ b/examples/experiments/unaligned_load/unaligned_load.c @@ -184,7 +184,7 @@ uint32_t IRAM run_test(const char *string, test_with_fn_t testfn, const char *te 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("Formats as: '"); diff --git a/examples/http_server/http_server.c b/examples/http_server/http_server.c index 985732e..cbe9a58 100644 --- a/examples/http_server/http_server.c +++ b/examples/http_server/http_server.c @@ -43,7 +43,7 @@ int32_t ssi_handler(int32_t iIndex, char *pcInsert, int32_t iInsertLen) 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++) { 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"; } -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"; } -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"; } diff --git a/examples/sntp/sntp_example.c b/examples/sntp/sntp_example.c index 0a933a2..fd16766 100644 --- a/examples/sntp/sntp_example.c +++ b/examples/sntp/sntp_example.c @@ -32,7 +32,7 @@ void sntp_tsk(void *pvParameters) { - char *servers[] = {SNTP_SERVERS}; + const char *servers[] = {SNTP_SERVERS}; UNUSED_ARG(pvParameters); /* Wait until we have joined AP and are assigned an IP */ diff --git a/examples/upnp/httpd.c b/examples/upnp/httpd.c index 9db2465..ea543d4 100644 --- a/examples/upnp/httpd.c +++ b/examples/upnp/httpd.c @@ -19,7 +19,7 @@ void httpd_task(void *pvParameters) if ((err = netconn_recv(client, &nb)) == ERR_OK) { struct sdk_station_config config; sdk_wifi_station_get_config(&config); - char * buf = + const char * buf = "\ \ \ @@ -50,4 +50,4 @@ void httpd_task(void *pvParameters) netconn_close(client); netconn_delete(client); } -} \ No newline at end of file +} diff --git a/examples/upnp/upnp.c b/examples/upnp/upnp.c index bb34cae..0b85855 100644 --- a/examples/upnp/upnp.c +++ b/examples/upnp/upnp.c @@ -25,7 +25,7 @@ static const char* get_my_ip(void) * @param recv the lwip UDP callback * @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; struct udp_pcb *upcb; diff --git a/extras/http_client_ota/http_buffered_client.c b/extras/http_client_ota/http_buffered_client.c index a0d79bf..ef792a6 100644 --- a/extras/http_client_ota/http_buffered_client.c +++ b/extras/http_client_ota/http_buffered_client.c @@ -19,7 +19,7 @@ typedef void (*handle_http_token)(char *); struct http_token_table { - char * token; + const char * token; handle_http_token http_tock_cb; }; diff --git a/extras/http_client_ota/http_buffered_client.h b/extras/http_client_ota/http_buffered_client.h index cfeb8da..aa30da3 100644 --- a/extras/http_client_ota/http_buffered_client.h +++ b/extras/http_client_ota/http_buffered_client.h @@ -15,9 +15,9 @@ typedef enum { } HTTP_Client_State; typedef struct { - char * server; - char * port; - char * path; + const char * server; + const char * port; + const char * path; char * buffer; uint16_t buffer_size; http_final_cb buffer_full_cb; diff --git a/extras/http_client_ota/http_client_ota.h b/extras/http_client_ota/http_client_ota.h index 56c7ea0..f6841e6 100644 --- a/extras/http_client_ota/http_client_ota.h +++ b/extras/http_client_ota/http_client_ota.h @@ -38,10 +38,10 @@ typedef enum { * Struct that contains all info for start ota. */ typedef struct { - char *server; /**< Server domain */ - char *port; /**< Server port */ - 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 *server; /**< Server domain */ + const char *port; /**< Server port */ + const char *binary_path; /**< Server Path dowload new update binary */ + const char *sha256_path; /**< Server Path of SHA256 sum for check binary, could be NULL, check will be skipped */ } ota_info; /** diff --git a/extras/rboot-ota/rboot-api.c b/extras/rboot-ota/rboot-api.c index 85b459d..755e397 100644 --- a/extras/rboot-ota/rboot-api.c +++ b/extras/rboot-ota/rboot-api.c @@ -239,7 +239,7 @@ typedef struct __attribute__((packed)) { bool rboot_verify_image(uint32_t initial_offset, uint32_t *image_length, const char **error_message) { 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); if(offset % 4) { error = "Unaligned flash offset"; diff --git a/extras/sntp/sntp.c b/extras/sntp/sntp.c index 274c7cd..26ac110 100644 --- a/extras/sntp/sntp.c +++ b/extras/sntp/sntp.c @@ -690,7 +690,7 @@ sntp_request(void *arg) void sntp_init(void) { - char *def_addr[] = {SNTP_SERVER_ADDRESS}; + const char *def_addr[] = {SNTP_SERVER_ADDRESS}; sntp_num_servers = 0; sntp_set_servers(def_addr, sizeof(def_addr) / sizeof(char*)); @@ -715,7 +715,7 @@ sntp_init(void) /** * 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; diff --git a/extras/sntp/sntp.h b/extras/sntp/sntp.h index dd25cf0..4fde486 100644 --- a/extras/sntp/sntp.h +++ b/extras/sntp/sntp.h @@ -52,7 +52,7 @@ void sntp_set_timezone(const struct timezone *tz); * Returns 0 if OK, less than 0 if error. * 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, diff --git a/extras/ssd1306/ssd1306.c b/extras/ssd1306/ssd1306.c index df188c5..4c1fc28 100644 --- a/extras/ssd1306/ssd1306.c +++ b/extras/ssd1306/ssd1306.c @@ -1007,7 +1007,7 @@ int ssd1306_draw_char(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font 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) { uint8_t t = x; diff --git a/extras/ssd1306/ssd1306.h b/extras/ssd1306/ssd1306.h index 86abaab..045d86f 100644 --- a/extras/ssd1306/ssd1306.h +++ b/extras/ssd1306/ssd1306.h @@ -493,7 +493,7 @@ int ssd1306_draw_char(const ssd1306_t *dev, uint8_t *fb, const font_info_t *font * @param background Background color * @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)