From: <arc...@us...> - 2013-02-15 00:43:27
|
Revision: 627 http://sourceforge.net/p/sipp/code/627 Author: arcady-91 Date: 2013-02-15 00:43:24 +0000 (Fri, 15 Feb 2013) Log Message: ----------- Applying sipp.osso.nl patches to fix const char warnings Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/deadcall.cpp sipp/trunk/deadcall.hpp sipp/trunk/listener.cpp sipp/trunk/listener.hpp sipp/trunk/message.cpp sipp/trunk/message.hpp sipp/trunk/scenario.cpp sipp/trunk/scenario.hpp sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp sipp/trunk/variables.cpp sipp/trunk/xp_parser.c sipp/trunk/xp_parser.h Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/call.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -203,10 +203,10 @@ */ #define PAT_AUDIO 1 #define PAT_VIDEO 2 -uint16_t get_remote_port_media(char *msg, int pattype) +uint16_t get_remote_port_media(const char *msg, int pattype) { - char *pattern; - char *begin, *end; + const char *pattern; + const char *begin, *end; char number[7]; if (pattype == PAT_AUDIO) { @@ -297,7 +297,7 @@ /******* Very simple hash for retransmission detection *******/ -unsigned long call::hash(char * msg) { +unsigned long call::hash(const char * msg) { unsigned long hash = 0; int c; @@ -307,7 +307,7 @@ } else if (rtcheck == RTCHECK_LOOSE) { /* Based on section 11.5 (bullet 2) of RFC2543 we only take into account * the To, From, Call-ID, and CSeq values. */ - char *hdr = get_header_content(msg,"To:"); + const char *hdr = get_header_content(msg,"To:"); while ((c = *hdr++)) hash = c + (hash << 6) + (hash << 16) - hash; hdr = get_header_content(msg,"From:"); @@ -342,15 +342,15 @@ } /******************* Call class implementation ****************/ -call::call(char *p_id, bool use_ipv6, int userId, struct sockaddr_storage *dest) : listener(p_id, true) { +call::call(const char *p_id, bool use_ipv6, int userId, struct sockaddr_storage *dest) : listener(p_id, true) { init(main_scenario, NULL, dest, p_id, userId, use_ipv6, false, false); } -call::call(char *p_id, struct sipp_socket *socket, struct sockaddr_storage *dest) : listener(p_id, true) { +call::call(const char *p_id, struct sipp_socket *socket, struct sockaddr_storage *dest) : listener(p_id, true) { init(main_scenario, socket, dest, p_id, 0 /* No User. */, socket->ss_ipv6, false /* Not Auto. */, false); } -call::call(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitialization) : listener(p_id, true) { +call::call(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitialization) : listener(p_id, true) { init(call_scenario, socket, dest, p_id, userId, ipv6, isAutomatic, isInitialization); } @@ -358,7 +358,7 @@ { static char call_id[MAX_HEADER_LEN]; - char * src = call_id_string; + const char * src = call_id_string; int count = 0; if(!next_number) { next_number ++; } @@ -390,7 +390,7 @@ } -void call::init(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall) +void call::init(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall) { this->call_scenario = call_scenario; zombie = false; @@ -576,7 +576,7 @@ setRunning(); } -int call::_callDebug(char *fmt, ...) { +int call::_callDebug(const char *fmt, ...) { va_list ap; if (!useCallDebugf) { @@ -861,7 +861,7 @@ return (((double)rand() / (double)RAND_MAX) < (percent / 100.0)); } -int call::send_raw(char * msg, int index, int len) +int call::send_raw(const char * msg, int index, int len) { struct sipp_socket *sock; int rc; @@ -871,7 +871,7 @@ if (useShortMessagef == 1) { struct timeval currentTime; GET_TIME (¤tTime); - char* cs=get_header_content(msg,"CSeq:"); + const char * cs=get_header_content(msg,"CSeq:"); TRACE_SHORTMSG("%s\tS\t%s\tCSeq:%s\t%s\n", CStat::formatTime(¤tTime),id, cs, get_first_line(msg)); } @@ -978,10 +978,10 @@ return cseq; } -char * call::get_header_field_code(char *msg, char * name) +char * call::get_header_field_code(const char *msg, const char * name) { static char code[MAX_HEADER_LEN]; - char * last_header; + const char * last_header; int i; last_header = NULL; @@ -997,7 +997,7 @@ return code; } -char * call::get_last_header(char * name) +char * call::get_last_header(const char * name) { int len; @@ -1022,17 +1022,17 @@ } } -char * call::get_header_content(char* message, char * name) +char * call::get_header_content(const char* message, const char * name) { return get_header(message, name, true); } /* If content is true, we only return the header's contents. */ -char * call::get_header(char* message, char * name, bool content) +char * call::get_header(const char* message, const char * name, bool content) { /* non reentrant. consider accepting char buffer as param */ static char last_header[MAX_HEADER_LEN * 10]; - char * src, *dest, *start, *ptr; + char *src, *dest, *start, *ptr; /* Are we searching for a short form header? */ bool short_form = false; bool first_time = true; @@ -1054,7 +1054,7 @@ do { snprintf(src_tmp, MAX_HEADER_LEN, "\n%s", name); - src = message; + src = const_cast<char*>(message); /* BUG.. but won't fix right now */ dest = last_header; while((src = strcasestr2(src, src_tmp))) { @@ -1158,11 +1158,11 @@ return start; } -char * call::get_first_line(char * message) +char * call::get_first_line(const char * message) { /* non reentrant. consider accepting char buffer as param */ static char last_header[MAX_HEADER_LEN * 10]; - char * src, *dest; + const char * src; /* returns empty string in case of error */ memset(last_header, 0, sizeof(last_header)); @@ -1172,7 +1172,6 @@ } src = message; - dest = last_header; int i=0; while (*src){ @@ -1775,7 +1774,7 @@ return executeMessage(curmsg); } -char *default_message_names[] = { +const char *default_message_names[] = { "3pcc_abort", "ack", "ack2", @@ -1783,7 +1782,7 @@ "cancel", "200", }; -char *default_message_strings[] = { +const char *default_message_strings[] = { /* 3pcc_abort */ "call-id: [call_id]\ninternal-cmd: abort_call\n\n", /* ack */ @@ -1845,7 +1844,7 @@ int messages = sizeof(default_message_strings)/sizeof(default_message_strings[0]); default_messages = new SendingMessage* [messages]; for (int i = 0; i < messages; i++) { - default_messages[i] = new SendingMessage(main_scenario, default_message_strings[i]); + default_messages[i] = new SendingMessage(main_scenario, const_cast<char*>(default_message_strings[i])); /* BUG */ } } Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/call.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -68,10 +68,10 @@ public: /* These are wrappers for various circumstances, (private) init does the real work. */ //call(char * p_id, int userId, bool ipv6, bool isAutomatic); - call(char *p_id, bool use_ipv6, int userId, struct sockaddr_storage *dest); - call(char *p_id, struct sipp_socket *socket, struct sockaddr_storage *dest); + call(const char *p_id, bool use_ipv6, int userId, struct sockaddr_storage *dest); + call(const char *p_id, struct sipp_socket *socket, struct sockaddr_storage *dest); static call *add_call(int userId, bool ipv6, struct sockaddr_storage *dest); - call(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall); + call(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall); virtual ~call(); @@ -108,7 +108,7 @@ private: /* This is the core constructor function. */ - void init(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall); + void init(scenario * call_scenario, struct sipp_socket *socket, struct sockaddr_storage *dest, const char * p_id, int userId, bool ipv6, bool isAutomatic, bool isInitCall); /* This this call for initialization? */ bool initCall; @@ -281,18 +281,18 @@ void extract_cseq_method (char* responseCseq, char* msg); void extract_transaction (char* txn, char* msg); - int send_raw(char * msg, int index, int len); + int send_raw(const char * msg, int index, int len); char * send_scene(int index, int *send_status, int *msgLen); bool connect_socket_if_needed(); char * compute_cseq(char * src); - char * get_header_field_code(char * msg, char * code); - char * get_last_header(char * name); - char * get_header_content(char* message, char * name); - char * get_header(char* message, char * name, bool content); - char * get_first_line(char* message); + char * get_header_field_code(const char * msg, const char * code); + char * get_last_header(const char * name); + char * get_header_content(const char * message, const char * name); + char * get_header(const char * message, const char * name, bool content); + char * get_first_line(const char * message); char * get_last_request_uri(); - unsigned long hash(char * msg); + unsigned long hash(const char * msg); typedef std::map <std::string, int> file_line_map; file_line_map *m_lineNumber; @@ -318,7 +318,7 @@ BIO *m_bio ; #endif - int _callDebug(char *fmt, ...); + int _callDebug(const char *fmt, ...); char *debugBuffer; int debugLength; }; Modified: sipp/trunk/deadcall.cpp =================================================================== --- sipp/trunk/deadcall.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/deadcall.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -52,7 +52,7 @@ /* Defined in call.cpp. */ extern timewheel paused_calls; -deadcall::deadcall(char *id, char *reason) : listener(id, true) { +deadcall::deadcall(const char *id, const char *reason) : listener(id, true) { this->expiration = clock_tick + deadcall_wait; this->reason = strdup(reason); setPaused(); Modified: sipp/trunk/deadcall.hpp =================================================================== --- sipp/trunk/deadcall.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/deadcall.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -2,7 +2,7 @@ class deadcall : public virtual task, public virtual listener { public: - deadcall(char *id, char * reason); + deadcall(const char *id, const char * reason); ~deadcall(); virtual bool process_incoming(char * msg, struct sockaddr_storage *); Modified: sipp/trunk/listener.cpp =================================================================== --- sipp/trunk/listener.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/listener.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -28,7 +28,7 @@ listener_map listeners; -listener::listener(char *id, bool listening) { +listener::listener(const char *id, bool listening) { this->id = strdup(id); this->listening = false; if (listening) { @@ -65,7 +65,7 @@ } -listener *get_listener(char *id) { +listener *get_listener(const char *id) { listener_map::iterator listener_it = listeners.find(listener_map::key_type(id)); if (listener_it == listeners.end()) { return NULL; Modified: sipp/trunk/listener.hpp =================================================================== --- sipp/trunk/listener.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/listener.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -31,7 +31,7 @@ class listener { public: - listener(char *id, bool listening); + listener(const char *id, bool listening); virtual ~listener(); char *getId(); virtual bool process_incoming(char * msg, struct sockaddr_storage *src) = 0; @@ -46,6 +46,6 @@ }; typedef std::map<std::string, listener *> listener_map; -listener * get_listener(char *); +listener * get_listener(const char *); #endif Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/message.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -40,7 +40,7 @@ #include "message.hpp" struct KeywordMap { - char *keyword; + const char *keyword; MessageCompType type; }; @@ -475,7 +475,7 @@ } } -void SendingMessage::getKeywordParam(char * src, char * param, char * output) +void SendingMessage::getKeywordParam(char * src, const char * param, char * output) { char *key, *tmp; int len; Modified: sipp/trunk/message.hpp =================================================================== --- sipp/trunk/message.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/message.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -120,7 +120,7 @@ // Get parameters from a [keyword] static void getQuotedParam(char * dest, char * src, int * len); static void getHexStringParam(char * dest, char * src, int * len); - static void getKeywordParam(char * src, char * param, char * output); + static void getKeywordParam(char * src, const char * param, char * output); }; /* Custom Keyword Function Type. */ Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/scenario.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -574,10 +574,10 @@ } } -int get_cr_number(char *src) +int get_cr_number(const char *src) { int res=0; - char *ptr = src; + const char *ptr = src; while(*ptr) { if(*ptr == '\n') res++; *ptr++; @@ -1070,7 +1070,7 @@ CSample *parse_distribution(bool oldstyle = false) { CSample *distribution; - char *distname; + const char *distname; char *ptr; if(!(distname = xp_get_value("distribution"))) { @@ -1297,7 +1297,7 @@ ERROR("Unable to determine send mode of the tool (server, client)\n"); } -void scenario::handle_rhs(CAction *tmpAction, char *what) { +void scenario::handle_rhs(CAction *tmpAction, const char *what) { if (xp_get_value("value")) { tmpAction->setDoubleValue(xp_get_double("value", what)); if (xp_get_value("variable")) { @@ -1313,7 +1313,7 @@ } } -void scenario::handle_arithmetic(CAction *tmpAction, char *what) { +void scenario::handle_arithmetic(CAction *tmpAction, const char *what) { tmpAction->setVarId(xp_get_var("assign_to", what)); handle_rhs(tmpAction, what); } @@ -1843,7 +1843,7 @@ } /* These are the names of the scenarios, they must match the default_scenario table. */ -char *scenario_table[] = { +const char *scenario_table[] = { "uac", "uas", "regexp", @@ -1874,9 +1874,8 @@ // TIP: to integrate an existing XML scenario, use the following sed line: // cat ../3pcc-controller-B.xml | sed -e 's/\"/\\\"/g' -e 's/\(.*\)/\"\1\\n\"/' -char * default_scenario [] = { +const char * default_scenario [] = { /************* Default_scenario[0] ***************/ -(char *) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -1998,7 +1997,6 @@ , /************* Default_scenario[1] ***************/ -(char *) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2116,7 +2114,6 @@ "\n", /************* Default_scenario[2] ***************/ -(char *) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2273,7 +2270,6 @@ "\n", /************* Default_scenario[3] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2400,7 +2396,6 @@ "\n", /************* Default_scenario[4] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2532,7 +2527,6 @@ "\n", /************* Default_scenario[5] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2628,7 +2622,6 @@ "\n", /************* Default_scenario[6] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2723,7 +2716,6 @@ "</scenario>\n", /************* Default_scenario[7] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -2873,7 +2865,6 @@ "\n", /************* Default_scenario[8] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" @@ -3042,7 +3033,6 @@ * dumped it and passed it with -sf. */ /************* Default_scenario[9] ***************/ -(char*) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" "<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n" "\n" Modified: sipp/trunk/scenario.hpp =================================================================== --- sipp/trunk/scenario.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/scenario.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -203,8 +203,8 @@ void getCommonAttributes(message *message); void getActionForThisMessage(message *message); void parseAction(CActions *actions); - void handle_arithmetic(CAction *tmpAction, char *what); - void handle_rhs(CAction *tmpAction, char *what); + void handle_arithmetic(CAction *tmpAction, const char *what); + void handle_rhs(CAction *tmpAction, const char *what); void checkOptionalRecv(char *elem, unsigned int scenario_file_cursor); void apply_labels(msgvec v, str_int_map labels); @@ -252,7 +252,7 @@ int find_scenario(const char *scenario); -extern char * default_scenario[12]; +extern const char * default_scenario[12]; /* Useful utility functions for parsing integers, etc. */ long get_long(const char *ptr, const char *what); @@ -263,6 +263,6 @@ int time_string(double ms, char *res, int reslen); int get_var(const char *varName, const char *what); -extern int get_cr_number(char *msg); +extern int get_cr_number(const char *msg); #endif Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/sipp.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -746,7 +746,7 @@ return tolower_table[c]; } -char * strcasestr2(char *s, char *find) { +char * strcasestr2(char *s, const char *find) { char c, sc; size_t len; @@ -764,7 +764,7 @@ return ((char *)s); } -char * strncasestr(char *s, char *find, size_t n) { +char * strncasestr(char *s, const char *find, size_t n) { char *end = s + n; char c, sc; size_t len; @@ -2125,7 +2125,7 @@ return tag; } -char * get_incoming_header_content(char* message, char * name) +char * get_incoming_header_content(char* message, const char * name) { /* non reentrant. consider accepting char buffer as param */ static char last_header[MAX_HEADER_LEN * 10]; @@ -2532,7 +2532,7 @@ } } -static ssize_t socket_write_primitive(struct sipp_socket *socket, char *buffer, size_t len, struct sockaddr_storage *dest) { +static ssize_t socket_write_primitive(struct sipp_socket *socket, const char *buffer, size_t len, struct sockaddr_storage *dest) { ssize_t rc; /* Refuse to write to invalid sockets. */ @@ -2769,11 +2769,11 @@ return 0; } -void buffer_write(struct sipp_socket *socket, char *buffer, size_t len, struct sockaddr_storage *dest) { +void buffer_write(struct sipp_socket *socket, const char *buffer, size_t len, struct sockaddr_storage *dest) { struct socketbuf *buf = socket->ss_out; if (!buf) { - socket->ss_out = alloc_socketbuf(buffer, len, DO_COPY, dest); + socket->ss_out = alloc_socketbuf(const_cast<char*>(buffer), len, DO_COPY, dest); /* NO BUG BECAUSE OF DO_COPY */ TRACE_MSG("Added first buffered message to socket %d\n", socket->ss_fd); return; } @@ -2782,7 +2782,7 @@ buf = buf->next; } - buf->next = alloc_socketbuf(buffer, len, DO_COPY, dest); + buf->next = alloc_socketbuf(const_cast<char*>(buffer), len, DO_COPY, dest); /* NO BUG BECAUSE OF DO_COPY */ TRACE_MSG("Appended buffered message to socket %d\n", socket->ss_fd); } @@ -2804,7 +2804,7 @@ } /* Write data to a socket. */ -int write_socket(struct sipp_socket *socket, char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest) { +int write_socket(struct sipp_socket *socket, const char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest) { int rc; if ( socket == NULL ) { //FIX coredump when trying to send data but no master yet ... ( for example after unexpected mesdsage) @@ -6209,7 +6209,7 @@ #ifdef __cplusplus extern "C" { #endif -int _trace (struct logfile_info *lfi, char *fmt, va_list ap) { +int _trace (struct logfile_info *lfi, const char *fmt, va_list ap) { int ret = 0; if(lfi->fptr) { ret = vfprintf(lfi->fptr, fmt, ap); @@ -6231,7 +6231,7 @@ } -int TRACE_MSG(char *fmt, ...) { +int TRACE_MSG(const char *fmt, ...) { int ret; va_list ap; @@ -6242,7 +6242,7 @@ return ret; } -int TRACE_SHORTMSG(char *fmt, ...) { +int TRACE_SHORTMSG(const char *fmt, ...) { int ret; va_list ap; @@ -6253,7 +6253,7 @@ return ret; } -int LOG_MSG(char *fmt, ...) { +int LOG_MSG(const char *fmt, ...) { int ret; va_list ap; @@ -6264,7 +6264,7 @@ return ret; } -int TRACE_CALLDEBUG(char *fmt, ...) { +int TRACE_CALLDEBUG(const char *fmt, ...) { int ret; va_list ap; Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/sipp.hpp 2013-02-15 00:43:24 UTC (rev 627) @@ -214,14 +214,14 @@ extern int peripfield _DEFVAL(0); extern bool bind_local _DEFVAL(false); extern void * monosocket_comp_state _DEFVAL(0); -extern char * service _DEFVAL(DEFAULT_SERVICE); -extern char * auth_password _DEFVAL(DEFAULT_AUTH_PASSWORD); -extern char * auth_username _DEFVAL(0); +extern const char * service _DEFVAL(DEFAULT_SERVICE); +extern const char * auth_password _DEFVAL(DEFAULT_AUTH_PASSWORD); +extern const char * auth_username _DEFVAL(0); extern unsigned long report_freq _DEFVAL(DEFAULT_REPORT_FREQ); extern unsigned long report_freq_dumpLog _DEFVAL (DEFAULT_REPORT_FREQ_DUMP_LOG); -extern bool periodic_rtd _DEFVAL(false); -extern char * stat_delimiter _DEFVAL(";"); +extern bool periodic_rtd _DEFVAL(false); +extern const char * stat_delimiter _DEFVAL(";"); extern bool timeout_exit _DEFVAL(false); extern bool timeout_error _DEFVAL(false); @@ -294,7 +294,7 @@ extern int currentRepartitionToDisplay _DEFVAL(1); extern unsigned int base_cseq _DEFVAL(0); extern char * auth_uri _DEFVAL(0); -extern char * call_id_string _DEFVAL("%u-%p@%s"); +extern const char * call_id_string _DEFVAL("%u-%p@%s"); extern char **generic[100]; /* TDM map */ @@ -493,7 +493,7 @@ }; struct logfile_info { - char *name; + const char *name; bool check; FILE *fptr; int nfiles; @@ -595,7 +595,7 @@ }; /* Write data to a socket. */ -int write_socket(struct sipp_socket *socket, char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest); +int write_socket(struct sipp_socket *socket, const char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest); /* Mark a socket as "bad". */ void sipp_socket_invalidate(struct sipp_socket *socket); /* Actually free the socket. */ @@ -623,7 +623,7 @@ /********************* Utilities functions *******************/ -char *strcasestr2 ( char *__haystack, char *__needle); +char *strcasestr2 ( char *__haystack, const char *__needle); char *get_peer_addr(char *); int get_decimal_from_hex(char hex); @@ -655,10 +655,10 @@ #ifdef __cplusplus extern "C" { #endif -int TRACE_MSG(char *fmt, ...); -int TRACE_CALLDEBUG(char *fmt, ...); -int TRACE_SHORTMSG(char *fmt, ...); -int LOG_MSG(char *fmt, ...); +int TRACE_MSG(const char *fmt, ...); +int TRACE_CALLDEBUG(const char *fmt, ...); +int TRACE_SHORTMSG(const char *fmt, ...); +int LOG_MSG(const char *fmt, ...); #ifdef __cplusplus } #endif Modified: sipp/trunk/variables.cpp =================================================================== --- sipp/trunk/variables.cpp 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/variables.cpp 2013-02-15 00:43:24 UTC (rev 627) @@ -113,7 +113,7 @@ } else if (M_type == E_VT_REGEXP && M_matchingValue) { return(M_matchingValue); } else { - return ""; + return const_cast<char*>(""); /* BUG BUT NOT SO SERIOUS */ } } Modified: sipp/trunk/xp_parser.c =================================================================== --- sipp/trunk/xp_parser.c 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/xp_parser.c 2013-02-15 00:43:24 UTC (rev 627) @@ -50,9 +50,9 @@ int xp_stack = 0; /****************** Internal routines ********************/ -int xp_replace(char *source, char *dest, char *search, char *replace) +int xp_replace(const char *source, char *dest, const char *search, const char *replace) { - char *position; + const char *position; char *occurances; int number = 0; @@ -155,7 +155,7 @@ /********************* Interface routines ********************/ -int xp_set_xml_buffer_from_string(char * str) +int xp_set_xml_buffer_from_string(const char * str) { size_t len = strlen(str); @@ -174,7 +174,7 @@ return 1; } -int xp_set_xml_buffer_from_file(char * filename) +int xp_set_xml_buffer_from_file(const char * filename) { FILE * f = fopen(filename, "rb"); int index = 0; @@ -371,8 +371,8 @@ char * xp_get_cdata() { static char buffer[XP_MAX_FILE_LEN + 1]; - char * end = xp_find_local_end(); - char * ptr; + const char *end = xp_find_local_end(); + const char *ptr; ptr = strstr(xp_position[xp_stack],"<![CDATA["); if(!ptr) { return NULL; } @@ -386,9 +386,9 @@ return buffer; } -int xp_get_content_length(char * P_buffer) +int xp_get_content_length(const char * P_buffer) { - char * L_ctl_hdr; + const char * L_ctl_hdr; int L_content_length = -1 ; unsigned char short_form; Modified: sipp/trunk/xp_parser.h =================================================================== --- sipp/trunk/xp_parser.h 2013-02-15 00:43:12 UTC (rev 626) +++ sipp/trunk/xp_parser.h 2013-02-15 00:43:24 UTC (rev 627) @@ -23,15 +23,15 @@ extern "C" { #endif -int xp_replace(char *source, char *dest, char *search, char *replace); -int xp_set_xml_buffer_from_string(char * str); -int xp_set_xml_buffer_from_file(char * filename); +int xp_replace(const char *source, char *dest, const char *search, const char *replace); +int xp_set_xml_buffer_from_string(const char * str); +int xp_set_xml_buffer_from_file(const char * filename); char * xp_open_element(int index); void xp_close_element(); -int xp_search_element_from_name(char * element, int occurence); +int xp_search_element_from_name(const char * element, int occurence); char * xp_get_value(const char * name); char * xp_get_cdata(); -int xp_get_content_length(char * P_buffer); +int xp_get_content_length(const char * P_buffer); #ifdef __cplusplus } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |