From 5bbe190b3b95b46dfa9e362b06fe85c4e5b05df6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 10 May 2017 14:13:16 +0800 Subject: [PATCH] apps/smtp: Make smtp_send_bodyh_data takes "const char **from" parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes below build error: cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/apps/smtp/smtp.c ../../../../lwip/src/apps/smtp/smtp.c: In function ‘smtp_send_body_data_handler’: ../../../../lwip/src/apps/smtp/smtp.c:1487:41: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] if((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) ^ ../../../../lwip/src/apps/smtp/smtp.c:1507:47: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] ((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) == BDHALLDATASENT) ^ cc1: all warnings being treated as errors ../../Common.allports.mk:94: recipe for target 'smtp.o' failed make: *** [smtp.o] Error 1 Signed-off-by: Axel Lin --- src/apps/smtp/smtp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/smtp/smtp.c b/src/apps/smtp/smtp.c index ff04c786..efca1b68 100644 --- a/src/apps/smtp/smtp.c +++ b/src/apps/smtp/smtp.c @@ -1414,7 +1414,7 @@ smtp_process(void *arg, struct altcp_pcb *pcb, struct pbuf *p) * 0 no data has been written */ static int -smtp_send_bodyh_data(struct altcp_pcb *pcb, char **from, u16_t *howmany) +smtp_send_bodyh_data(struct altcp_pcb *pcb, const char **from, u16_t *howmany) { err_t err; u16_t len = *howmany; @@ -1484,7 +1484,7 @@ smtp_send_body_data_handler(struct smtp_session *s, struct altcp_pcb *pcb) /* resume any leftovers from prior memory constraints */ if (s->body_len) { LWIP_DEBUGF(SMTP_DEBUG_TRACE, ("smtp_send_body_data_handler: resume\n")); - if((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) + if((res = smtp_send_bodyh_data(pcb, (const char **)&s->body, &s->body_len)) != BDHALLDATASENT) { s->body_sent = s->body_len - 1; return; @@ -1504,7 +1504,7 @@ smtp_send_body_data_handler(struct smtp_session *s, struct altcp_pcb *pcb) s->body_len = bdh->exposed.length; LWIP_DEBUGF(SMTP_DEBUG_TRACE, ("smtp_send_body_data_handler: trying to send %u bytes\n", (unsigned int)s->body_len)); } while (s->body_len && - ((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) == BDHALLDATASENT) + ((res = smtp_send_bodyh_data(pcb, (const char **)&s->body, &s->body_len)) == BDHALLDATASENT) && (bdh->state != BDH_STOP)); } if ((bdh->state != BDH_SENDING) && (ret != BDHSOMEDATASENT)) {