diff --git a/core/AmMimeBody.cpp b/core/AmMimeBody.cpp index 164f9b7a..e0a13cd9 100644 --- a/core/AmMimeBody.cpp +++ b/core/AmMimeBody.cpp @@ -481,8 +481,8 @@ int AmMimeBody::findNextBoundary(unsigned char** beg, unsigned char** end) int AmMimeBody::parseSinglePart(unsigned char* buf, unsigned int len) { list hdrs; - char* c = (char*)buf; - char* end = c + len; + const char* c = (char*)buf; + const char* end = c + len; // parse headers first if(parse_headers(hdrs,&c,c+len) < 0) { diff --git a/core/SipCtrlInterface.cpp b/core/SipCtrlInterface.cpp index 2d43c780..60094e8d 100644 --- a/core/SipCtrlInterface.cpp +++ b/core/SipCtrlInterface.cpp @@ -244,10 +244,10 @@ int SipCtrlInterface::send(AmSipRequest &req, const string& dialog_id, * Contact * Max-Forwards */ - char * c = (char*)req.from.c_str(); + const char* c = req.from.c_str(); int err = parse_headers(msg, &c, (c + req.from.length())); - c = (char*)req.to.c_str(); + c = req.to.c_str(); err = err || parse_headers(msg, &c, (c + req.to.length())); if (err) { @@ -373,7 +373,7 @@ int SipCtrlInterface::send(const AmSipReply &rep, const string& dialog_id, if(!rep.hdrs.empty()) { - char* c = (char*)rep.hdrs.c_str(); + const char* c = rep.hdrs.c_str(); int err = parse_headers(&msg,&c,c+rep.hdrs.length()); if(err){ ERROR("Malformed additional header\n"); @@ -383,7 +383,7 @@ int SipCtrlInterface::send(const AmSipReply &rep, const string& dialog_id, if(!rep.contact.empty()){ - char* c = (char*)rep.contact.c_str(); + const char* c = rep.contact.c_str(); int err = parse_headers(&msg,&c,c+rep.contact.length()); if(err){ ERROR("Malformed Contact header\n"); diff --git a/core/sip/parse_header.cpp b/core/sip/parse_header.cpp index 7730b5a5..70d22b09 100644 --- a/core/sip/parse_header.cpp +++ b/core/sip/parse_header.cpp @@ -268,7 +268,7 @@ void add_parsed_header(list& hdrs, sip_header* hdr) hdrs.push_back(hdr); } -int parse_headers(list& hdrs, char** c, char* end) +int parse_headers(list& hdrs, const char** c, const char* end) { // // Header states @@ -283,7 +283,7 @@ int parse_headers(list& hdrs, char** c, char* end) int st = H_NAME; int saved_st = 0; - char* begin = *c; + const char* begin = *c; if(!(*c) || (*c == end)) { return 0; } diff --git a/core/sip/parse_header.h b/core/sip/parse_header.h index 701044c2..59a2f94b 100644 --- a/core/sip/parse_header.h +++ b/core/sip/parse_header.h @@ -82,7 +82,7 @@ struct sip_header int parse_header_type(sip_header* h); -int parse_headers(list& hdrs, char** c, char* end); +int parse_headers(list& hdrs, const char** c, const char* end); void free_headers(list& hdrs); #endif diff --git a/core/sip/sip_parser.cpp b/core/sip/sip_parser.cpp index b3849dd9..bbf9dd27 100644 --- a/core/sip/sip_parser.cpp +++ b/core/sip/sip_parser.cpp @@ -241,7 +241,7 @@ int parse_method(int* method, const char* beg, int len) } -static int parse_first_line(sip_msg* msg, char** c, char* end) +static int parse_first_line(sip_msg* msg, const char** c, const char* end) { enum { FL_METH=0, @@ -267,7 +267,7 @@ static int parse_first_line(sip_msg* msg, char** c, char* end) FL_ERR }; - char* beg = *c; + const char* beg = *c; int saved_st=0, st=FL_SIPVER1; int err=0; @@ -454,7 +454,7 @@ static int parse_first_line(sip_msg* msg, char** c, char* end) return UNEXPECTED_EOT; } -int parse_headers(sip_msg* msg, char** c, char* end) +int parse_headers(sip_msg* msg, const char** c, const char* end) { list hdrs; int err = parse_headers(hdrs,c,end); @@ -528,8 +528,8 @@ int parse_headers(sip_msg* msg, char** c, char* end) int parse_sip_msg(sip_msg* msg, char*& err_msg) { - char* c = msg->buf; - char* end = msg->buf + msg->len; + const char* c = msg->buf; + const char* end = c + msg->len; int err = parse_first_line(msg,&c,end); diff --git a/core/sip/sip_parser.h b/core/sip/sip_parser.h index d8da66f1..559af47f 100644 --- a/core/sip/sip_parser.h +++ b/core/sip/sip_parser.h @@ -156,7 +156,7 @@ struct sip_msg }; int parse_method(int* method, const char* beg, int len); -int parse_headers(sip_msg* msg, char** c, char* end); +int parse_headers(sip_msg* msg, const char** c, const char* end); int parse_sip_msg(sip_msg* msg, char*& err_msg); #define get_contact(msg) (msg->contacts.empty() ? NULL : (*msg->contacts.begin())) diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp index 34bc555c..dfe2cc58 100644 --- a/core/sip/trans_layer.cpp +++ b/core/sip/trans_layer.cpp @@ -654,7 +654,7 @@ int trans_layer::send_sf_error_reply(const trans_ticket* tt, const sip_msg* req, sip_msg reply; reply.u.reply = new sip_reply(reply_code,reason); - char* c = (char*)hdrs.s; + const char* c = hdrs.s; int err = parse_headers(&reply,&c,c+hdrs.len); if(err){ ERROR("Malformed additional header\n");