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;
}
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: '");

View file

@ -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";
}

View file

@ -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 */

View file

@ -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 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<root>\
<device>\

View file

@ -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;

View file

@ -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;
};

View file

@ -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;

View file

@ -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;
/**

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)
{
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";

View file

@ -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;

View file

@ -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,

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;
}
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;

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
* @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)