From: <arc...@us...> - 2013-02-15 00:43:44
|
Revision: 629 http://sourceforge.net/p/sipp/code/629 Author: arcady-91 Date: 2013-02-15 00:43:41 +0000 (Fri, 15 Feb 2013) Log Message: ----------- Fixing errors when compiling with -Wall -Wextra Modified Paths: -------------- sipp/trunk/auth.c sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/message.cpp sipp/trunk/prepare_pcap.c sipp/trunk/scenario.cpp sipp/trunk/scenario.hpp sipp/trunk/send_packets.c sipp/trunk/sipp.cpp Modified: sipp/trunk/auth.c =================================================================== --- sipp/trunk/auth.c 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/auth.c 2013-02-15 00:43:41 UTC (rev 629) @@ -246,11 +246,11 @@ // Load in A1 md5_init(&Md5Ctx); - md5_append(&Md5Ctx, user, strlen(user)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, tmp, strlen(tmp)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, password, password_len); + md5_append(&Md5Ctx, (md5_byte_t *) user, strlen(user)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) tmp, strlen(tmp)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) password, password_len); md5_finish(&Md5Ctx, ha1); hashToHex(&ha1[0], &ha1_hex[0]); @@ -266,7 +266,7 @@ // If using Auth-Int make a hash of the body - which is NULL for REG if (stristr(authtype, "auth-int") != NULL) { md5_init(&Md5Ctx); - md5_append(&Md5Ctx, msgbody, strlen(msgbody)); + md5_append(&Md5Ctx, (md5_byte_t *) msgbody, strlen(msgbody)); md5_finish(&Md5Ctx, body); hashToHex(&body[0], &body_hex[0]); sprintf(authtype, "auth-int"); @@ -274,11 +274,11 @@ // Load in A2 md5_init(&Md5Ctx); - md5_append(&Md5Ctx, method, strlen(method)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, tmp, strlen(tmp)); + md5_append(&Md5Ctx, (md5_byte_t *) method, strlen(method)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) tmp, strlen(tmp)); if (stristr(authtype, "auth-int") != NULL) { - md5_append(&Md5Ctx, ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); md5_append(&Md5Ctx, (md5_byte_t *) &body_hex, HASH_HEX_SIZE); } md5_finish(&Md5Ctx, ha2); @@ -299,17 +299,17 @@ md5_init(&Md5Ctx); md5_append(&Md5Ctx, (md5_byte_t *) &ha1_hex, HASH_HEX_SIZE); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, tmp, strlen(tmp)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) tmp, strlen(tmp)); if (cnonce[0] != '\0') { - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, nc, strlen(nc)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, cnonce, strlen(cnonce)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, authtype, strlen(authtype)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) nc, strlen(nc)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) cnonce, strlen(cnonce)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) authtype, strlen(authtype)); } - md5_append(&Md5Ctx, ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); md5_append(&Md5Ctx, (md5_byte_t *) &ha2_hex, HASH_HEX_SIZE); md5_finish(&Md5Ctx, resp); hashToHex(&resp[0], &resp_hex[0]); @@ -335,11 +335,11 @@ // Load in A1 md5_init(&Md5Ctx); - md5_append(&Md5Ctx, user, strlen(user)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, realm, strlen(realm)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, password, password_len); + md5_append(&Md5Ctx, (md5_byte_t *) user, strlen(user)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) realm, strlen(realm)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) password, password_len); md5_finish(&Md5Ctx, ha1); hashToHex(&ha1[0], &ha1_hex[0]); @@ -351,17 +351,17 @@ // Load in A2 md5_init(&Md5Ctx); - md5_append(&Md5Ctx, method, strlen(method)); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, tmp, strlen(tmp)); + md5_append(&Md5Ctx, (md5_byte_t *) method, strlen(method)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) tmp, strlen(tmp)); md5_finish(&Md5Ctx, ha2); hashToHex(&ha2[0], &ha2_hex[0]); md5_init(&Md5Ctx); md5_append(&Md5Ctx, (md5_byte_t *) &ha1_hex, HASH_HEX_SIZE); - md5_append(&Md5Ctx, ":", 1); - md5_append(&Md5Ctx, nonce, strlen(nonce)); - md5_append(&Md5Ctx, ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); + md5_append(&Md5Ctx, (md5_byte_t *) nonce, strlen(nonce)); + md5_append(&Md5Ctx, (md5_byte_t *) ":", 1); md5_append(&Md5Ctx, (md5_byte_t *) &ha2_hex, HASH_HEX_SIZE); md5_finish(&Md5Ctx, resp); hashToHex(&resp[0], result); @@ -377,14 +377,13 @@ char nonce[MAX_HEADER_LEN]; char uri[MAX_HEADER_LEN]; char *start; - int len; if ((start = stristr(auth, "Digest")) == NULL) { WARNING("verifyAuthHeader: authentication must be digest is %s", auth); return 0; } - len = getAuthParameter("algorithm", auth, algo, sizeof(algo)); + getAuthParameter("algorithm", auth, algo, sizeof(algo)); if (algo[0] == '\0') { strcpy(algo, "MD5"); } @@ -479,7 +478,8 @@ char * base64_decode_string( const char *buf, unsigned int len, int *newlen ) { - int i,j,x1,x2,x3,x4; + unsigned long i; + int j,x1,x2,x3,x4; char *out; out = (char *)malloc( ( len * 3/4 ) + 8 ); for(i=0,j=0;i+3<len;i+=4){ @@ -598,7 +598,6 @@ int has_auts = 0, resuf = 1; char *nonce64, *nonce; int noncelen; - RESHEX resp_hex; AMF amf; OP op; RAND rnd; @@ -625,7 +624,6 @@ tmp[end - start] ='\0'; /* Compute the AKA RES */ - resp_hex[0]=0; nonce64 = tmp; nonce = base64_decode_string(nonce64,end-start,&noncelen); if (noncelen<RANDLEN+AUTNLEN) { @@ -653,7 +651,7 @@ f1(k,rnd,sqn,(unsigned char *) aka_AMF,xmac,op); if (memcmp(mac,xmac,MACLEN)!=0) { sprintf(result,"createAuthHeaderAKAv1MD5 : MAC != eXpectedMAC -> Server might not know the secret (man-in-the-middle attack?) \n"); - //return 0; + return 0; } /* Check SQN, compute AUTS if needed and authorization parameter */ @@ -665,6 +663,10 @@ has_auts = 0; /* RES has to be used as password to compute response */ resuf = createAuthHeaderMD5(user, (char *) res, RESLEN, method, uri, msgbody, auth, algo, result); + if (resuf == 0) { + sprintf(result,"createAuthHeaderAKAv1MD5 : Unexpected return value from createAuthHeaderMD5\n"); + return 0; + } } else { sqn_ms[5] = sqn_he[5] + 1; f5star(k, rnd, ak, op); @@ -674,7 +676,11 @@ has_auts = 1; /* When re-synchronisation occurs an empty password has to be used */ /* to compute MD5 response (Cf. rfc 3310 section 3.2) */ - resuf=createAuthHeaderMD5(user,"",0,method,uri,msgbody,auth,algo,result); + resuf = createAuthHeaderMD5(user,"",0,method,uri,msgbody,auth,algo,result); + if (resuf == 0) { + sprintf(result,"createAuthHeaderAKAv1MD5 : Unexpected return value from createAuthHeaderMD5\n"); + return 0; + } } if (has_auts) { /* Format data for output in the SIP message */ Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/call.cpp 2013-02-15 00:43:41 UTC (rev 629) @@ -206,7 +206,7 @@ uint16_t get_remote_port_media(const char *msg, int pattype) { const char *pattern; - const char *begin, *end; + char *begin, *end; char number[7]; if (pattype == PAT_AUDIO) { @@ -956,28 +956,6 @@ } } - -char * call::compute_cseq(char * src) -{ - static char cseq[MAX_HEADER_LEN]; - - /* If we find a CSeq in incoming msg */ - char * last_header = get_last_header("CSeq:"); - if(last_header) { - int i; - /* Extract the integer value of the last CSeq */ - last_header = strstr(last_header, ":"); - last_header++; - while(isspace(*last_header)) last_header++; - sscanf(last_header,"%d", &i); - /* Add 1 to the last CSeq value */ - sprintf(cseq, "%s%d", "CSeq: ", (i+1)); - } else { - sprintf(cseq, "%s", "CSeq: 2"); - } - return cseq; -} - char * call::get_header_field_code(const char *msg, const char * name) { static char code[MAX_HEADER_LEN]; @@ -1054,7 +1032,7 @@ do { snprintf(src_tmp, MAX_HEADER_LEN, "\n%s", name); - src = const_cast<char*>(message); /* BUG.. but won't fix right now */ + src = strdup(message); dest = last_header; while((src = strcasestr2(src, src_tmp))) { @@ -1097,6 +1075,7 @@ } /* We didn't find the header, even in its short form. */ if (short_form) { + free(src); return last_header; } @@ -1120,6 +1099,7 @@ name = "v:"; } else { /* There is no short form to try. */ + free(src); return last_header; } } @@ -1155,6 +1135,7 @@ memmove(ptr, ptr+1, strlen(ptr)); } + free(src); return start; } @@ -1434,9 +1415,6 @@ int varId = curmsg->pause_variable; pause = (int) M_callVariableTable->getVar(varId)->getDouble(); } - if (pause < 0) { - pause = 0; - } if (pause > INT_MAX) { pause = INT_MAX; } @@ -1884,6 +1862,7 @@ { char buffer[MAX_HEADER_LEN]; char *desc = buffer; + int res = 0; message *curmsg = call_scenario->messages[msg_index]; @@ -1928,7 +1907,10 @@ if (default_behaviors & DEFAULT_BEHAVIOR_ABORTUNEXP) { // if twin socket call => reset the other part here if (twinSippSocket && (msg_index > 0)) { - sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + if (res) { + WARNING("sendCmdBuffer returned %d", res); + } } // usage of last_ keywords => for call aborting @@ -1970,8 +1952,6 @@ if ((creationMode != MODE_SERVER) && (msg_index > 0)) { if ((call_established == false) && (is_inv)) { src_recv = last_recv_msg ; - char L_msg_buffer[SIPP_MAX_MSG_SIZE]; - L_msg_buffer[0] = '\0'; // Answer unexpected errors (4XX, 5XX and beyond) with an ACK // Contributed by F. Tarek Rogers @@ -2005,8 +1985,6 @@ * because the earlier check depends on the first message being an INVITE * (although it could be something like a message message, therefore we * check that we received a message. */ - char L_msg_buffer[SIPP_MAX_MSG_SIZE]; - L_msg_buffer[0] = '\0'; sendBuffer(createSendingMessage(get_default_message("bye"), -1)); } } @@ -2018,11 +1996,10 @@ } stopListening(); - deadcall *deadcall_ptr = NULL; if (deadcall_wait && !initCall) { char reason[100]; sprintf(reason, "aborted at index %d", msg_index); - deadcall_ptr = new deadcall(id, reason); + new deadcall(id, reason); } delete this; @@ -2497,7 +2474,7 @@ sscanf(tmp,"%s", method); if (!auth_body) { - auth_body = ""; + strcpy(auth_body, ""); } /* Determine the type of credentials. */ @@ -2928,7 +2905,7 @@ static char request[65]; char responsecseqmethod[65]; char txn[MAX_HEADER_LEN]; - unsigned long cookie; + unsigned long cookie = 0; char * ptr; int search_index; bool found = false; @@ -3055,9 +3032,9 @@ /* In case of INVITE or re-INVITE, ACK or PRACK get the media info if needed (= we got a pcap play action) */ - if ((strncmp(request, "INVITE", 6) == 0) + if (((strncmp(request, "INVITE", 6) == 0) || (strncmp(request, "ACK", 3) == 0) - || (strncmp(request, "PRACK", 5) == 0) + || (strncmp(request, "PRACK", 5) == 0)) && (hasMedia == 1)) get_remote_media_addr(msg); #endif @@ -3243,7 +3220,7 @@ } } - if (request) { // update [cseq] with received CSeq + if (*request) { // update [cseq] with received CSeq unsigned long int rcseq = get_cseq_value(msg); if (rcseq > cseq) cseq = rcseq; } @@ -3356,9 +3333,9 @@ /* If this was a mandatory message, or if there is an explicit next label set * we must update our state machine. */ - if (!(call_scenario->messages[search_index] -> optional) || - call_scenario->messages[search_index]->next && - ((test == -1) || (M_callVariableTable->getVar(test)->isSet())) + if ((!(call_scenario->messages[search_index] -> optional) + || call_scenario->messages[search_index]->next) + && (((test == -1) || (M_callVariableTable->getVar(test)->isSet()))) ) { /* If we are paused, then we need to wake up so that we properly go through the state machine. */ paused_until = 0; @@ -3434,7 +3411,7 @@ currentAction->getCaseIndep(), currentAction->getOccurence(), currentAction->getHeadersOnly()); - if(currentAction->getCheckIt() == true && (strlen(msgPart) < 0)) { + if(currentAction->getCheckIt() == true && (strlen(msgPart) == 0)) { // the sub message is not found and the checking action say it // MUST match --> Call will be marked as failed but will go on WARNING("Failed regexp match: header %s not found in message %s\n", currentAction->getLookingChar(), msg); @@ -3744,7 +3721,7 @@ char *q = strdup(p); var->setString(q); int l = strlen(q); - for (int i = l - 1; i >= 0 & isspace(q[i]); i--) { + for (int i = l - 1; (i >= 0) && isspace(q[i]); i--) { q[i] = '\0'; } } else if (currentAction->getActionType() == CAction::E_AT_VAR_TO_DOUBLE) { @@ -3828,7 +3805,7 @@ #ifdef PCAPPLAY } else if ((currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) || (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO)) { - play_args_t *play_args; + play_args_t *play_args = 0; if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) { play_args = &(this->play_args_a); } else if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) { @@ -3999,7 +3976,10 @@ // if twin socket call => reset the other part here if (twinSippSocket && (msg_index > 0)) { - res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + if (res) { + WARNING("sendCmdBuffer returned %d", res); + } } computeStat(CStat::E_CALL_FAILED); computeStat(CStat::E_FAILED_UNEXPECTED_MSG); @@ -4024,8 +4004,10 @@ // if twin socket call => reset the other part here if (twinSippSocket && (msg_index > 0)) { - res = sendCmdBuffer - (createSendingMessage(get_default_message("3pcc_abort"), -1)); + res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + if (res) { + WARNING("sendCmdBuffer returned %d", res); + } } computeStat(CStat::E_CALL_FAILED); @@ -4049,6 +4031,9 @@ // if twin socket call => reset the other part here if (twinSippSocket && (msg_index > 0)) { res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort"), -1)); + if (res) { + WARNING("sendCmdBuffer returned %d", res); + } } CStat::globalStat(CStat::E_AUTO_ANSWERED); Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/call.hpp 2013-02-15 00:43:41 UTC (rev 629) @@ -285,7 +285,6 @@ 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(const char * msg, const char * code); char * get_last_header(const char * name); char * get_header_content(const char * message, const char * name); Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/message.cpp 2013-02-15 00:43:41 UTC (rev 629) @@ -375,6 +375,7 @@ if (skip_sanity) { cancel = response = ack = false; method = NULL; + free(osrc); return; } @@ -418,7 +419,8 @@ ack = (!strcmp(method, "ACK")); cancel = (!strcmp(method, "CANCEL")); response = false; - } + }; + free(osrc); } SendingMessage::~SendingMessage() { @@ -426,7 +428,6 @@ freeMessageComponent(messageComponents[i]); } free(method); - free(src); } bool SendingMessage::isAck() { return ack; } @@ -442,12 +443,12 @@ while (char c = *src++) { switch(c) { case '"': - *len++; + (*len)++; *dest = '\0'; return; case '\\': c = *src++; - *len++; + (*len)++; if (c == 0) { *dest = '\0'; return; @@ -455,7 +456,7 @@ /* Fall-Through. */ default: *dest++ = c; - *len++; + (*len)++; } } *dest = '\0'; Modified: sipp/trunk/prepare_pcap.c =================================================================== --- sipp/trunk/prepare_pcap.c 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/prepare_pcap.c 2013-02-15 00:43:41 UTC (rev 629) @@ -197,7 +197,7 @@ } void free_pkts(pcap_pkts *pkts) { - pcap_pkt *pkt_index; + pcap_pkt *pkt_index = 0; while (pkt_index < pkts->max) { free(pkt_index->data); } Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/scenario.cpp 2013-02-15 00:43:41 UTC (rev 629) @@ -368,7 +368,7 @@ return txnNum; } -int scenario::find_var(const char *varName, const char *what) { +int scenario::find_var(const char *varName) { return allocVars->find(varName, false); } @@ -577,10 +577,9 @@ int get_cr_number(const char *src) { int res=0; - const char *ptr = src; - while(*ptr) { - if(*ptr == '\n') res++; - *ptr++; + while(*src) { + if(*src == '\n') res++; + src++; } return res; } @@ -999,8 +998,8 @@ } else { unexpected_jump = -1; } - retaddr = find_var("_unexp.retaddr", "unexpected return address"); - pausedaddr = find_var("_unexp.pausedaddr", "unexpected paused until"); + retaddr = find_var("_unexp.retaddr"); + pausedaddr = find_var("_unexp.pausedaddr"); /* Patch up the labels. */ apply_labels(messages, labelMap); @@ -1071,7 +1070,7 @@ CSample *parse_distribution(bool oldstyle = false) { CSample *distribution; const char *distname; - char *ptr; + char *ptr = 0; if(!(distname = xp_get_value("distribution"))) { if (!oldstyle) { Modified: sipp/trunk/scenario.hpp =================================================================== --- sipp/trunk/scenario.hpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/scenario.hpp 2013-02-15 00:43:41 UTC (rev 629) @@ -184,7 +184,7 @@ int get_var(const char *varName, const char *what); int get_counter(const char *varName, const char *what); int get_rtd(const char *ptr, bool start); - int find_var(const char *varName, const char *what); + int find_var(const char *varName); CStat *stats; AllocVariableTable *allocVars; Modified: sipp/trunk/send_packets.c =================================================================== --- sipp/trunk/send_packets.c 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/send_packets.c 2013-02-15 00:43:41 UTC (rev 629) @@ -115,10 +115,10 @@ struct timeval *, struct timeval *); void send_packets_cleanup(void *arg) { - int sock = (int) arg; + int * sock = (int *) arg; // Close send socket - close(sock); + close(*sock); } @@ -184,7 +184,7 @@ /* Ensure the sender socket is closed when the thread exits - this * allows the thread to be cancelled cleanly. */ - pthread_cleanup_push(send_packets_cleanup, ((void *) sock)); + pthread_cleanup_push(send_packets_cleanup, ((void *) &sock)); while (pkt_index < pkt_max) { Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2013-02-15 00:43:32 UTC (rev 628) +++ sipp/trunk/sipp.cpp 2013-02-15 00:43:41 UTC (rev 629) @@ -36,6 +36,7 @@ */ #define GLOBALS_FULL_DEFINITION +#define NOTLAST 0 #include <dlfcn.h> #include "sipp.hpp" @@ -806,7 +807,7 @@ /***************** Check of the message received ***************/ -bool sipMsgCheck (const char *P_msg, int P_msgSize, struct sipp_socket *socket) { +bool sipMsgCheck (const char *P_msg, struct sipp_socket *socket) { const char C_sipHeader[] = "SIP/2.0" ; if (socket == twinSippSocket || socket == localTwinSippSocket || @@ -822,7 +823,7 @@ /************** Statistics display & User control *************/ -void print_stats_in_file(FILE * f, int last) +void print_stats_in_file(FILE * f) { static char temp_str[256]; int divisor; @@ -1285,7 +1286,7 @@ fflush(f); } -void print_header_line(FILE *f, int last) +void print_header_line(FILE *f) { switch(currentScreenToDisplay) { @@ -1463,25 +1464,25 @@ int oldRepartition = currentRepartitionToDisplay; currentScreenToDisplay = DISPLAY_SCENARIO_SCREEN; - print_header_line( screenf, 0); - print_stats_in_file( screenf, 0); - print_bottom_line( screenf, 0); + print_header_line( screenf); + print_stats_in_file( screenf); + print_bottom_line( screenf, NOTLAST); currentScreenToDisplay = DISPLAY_STAT_SCREEN; - print_header_line( screenf, 0); + print_header_line( screenf); display_scenario->stats->displayStat(screenf); - print_bottom_line( screenf, 0); + print_bottom_line( screenf, NOTLAST); currentScreenToDisplay = DISPLAY_REPARTITION_SCREEN; - print_header_line( screenf, 0); + print_header_line( screenf); display_scenario->stats->displayRepartition(screenf); - print_bottom_line( screenf, 0); + print_bottom_line( screenf, NOTLAST); currentScreenToDisplay = DISPLAY_SECONDARY_REPARTITION_SCREEN; for (currentRepartitionToDisplay = 2; currentRepartitionToDisplay <= display_scenario->stats->nRtds(); currentRepartitionToDisplay++) { - print_header_line( screenf, 0); + print_header_line( screenf); display_scenario->stats->displayRtdRepartition(screenf, currentRepartitionToDisplay); - print_bottom_line( screenf, 0); + print_bottom_line( screenf, NOTLAST); } currentScreenToDisplay = oldScreen; @@ -1505,7 +1506,7 @@ if (command_mode) { printf(SIPP_ENDL); } - print_header_line(stdout,last); + print_header_line(stdout); switch(currentScreenToDisplay) { case DISPLAY_STAT_SCREEN : display_scenario->stats->displayStat(stdout); @@ -1524,7 +1525,7 @@ break; case DISPLAY_SCENARIO_SCREEN : default: - print_stats_in_file(stdout, last); + print_stats_in_file(stdout); break; } print_bottom_line(stdout,last); @@ -2197,7 +2198,7 @@ { /* non reentrant. consider accepting char buffer as param */ static char last_header[MAX_HEADER_LEN * 10]; - char * src, *dest; + char * src; /* returns empty string in case of error */ memset(last_header, 0, sizeof(last_header)); @@ -2207,7 +2208,6 @@ } src = message; - dest = last_header; int i=0; while (*src){ @@ -3115,7 +3115,7 @@ struct socketbuf *socketbuf; char *buffer; - int ret; + int ret = -1; /* Where should we start sending packets to, ideally we should begin to parse * the Via, Contact, and Route headers. But for now SIPp always sends to the * host specified on the command line; or for UAS mode to the address that @@ -3308,7 +3308,7 @@ if(msg_size <= 0) { return; } - if (sipMsgCheck(msg, msg_size, socket) == false) { + if (sipMsgCheck(msg, socket) == false) { WARNING("non SIP message discarded"); return; } @@ -3777,6 +3777,10 @@ sigset_t mask; sigfillset(&mask); /* Mask all allowed signals */ rc = pthread_sigmask(SIG_BLOCK, &mask, NULL); + if (rc) { + WARNING("pthread_sigmask returned %d", rc); + return; + } for (;;) { len = sizeof(remote_rtp_addr); @@ -4190,7 +4194,7 @@ } int socket_fd(bool use_ipv6, int transport) { - int socket_type; + int socket_type = -1; int protocol=0; int fd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |