apps/smtp: Make smtp_send_bodyh_data takes "const char **from" parameter

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 <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2017-05-10 14:13:16 +08:00 committed by Dirk Ziegelmeier
parent f5f34f138c
commit 5bbe190b3b

View File

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