Skip to content

Commit

Permalink
Merge pull request #168 from kamailio/vseva/gcc_warnings
Browse files Browse the repository at this point in the history
clean some gcc warnings
  • Loading branch information
linuxmaniac committed May 22, 2015
2 parents f9be1bd + e15d415 commit 46cc69f
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 56 deletions.
6 changes: 0 additions & 6 deletions modules/db_berkeley/bdb_cmd.c
Expand Up @@ -507,17 +507,11 @@ int bdb_cmd_first(db_res_t* res)

int bdb_cmd_next(db_res_t* res)
{
db_con_t *con;
bdb_res_t *bres;
bdb_con_t *bcon;
bdb_cmd_t *bcmd;
DBT key, data;
int ret;
static char dbuf[MAX_ROW_SIZE];

con = res->cmd->ctx->con[db_payload_idx];
bres = DB_GET_PAYLOAD(res);
bcon = DB_GET_PAYLOAD(con);
bcmd = DB_GET_PAYLOAD(res->cmd);

if (bcmd->next_flag == 2 || bcmd->next_flag == -2) return 1;
Expand Down
3 changes: 0 additions & 3 deletions modules/db_berkeley/bdb_con.c
Expand Up @@ -49,12 +49,9 @@
*/
static void bdb_con_free(db_con_t* con, bdb_con_t *payload)
{
bdb_uri_t *buri;
if (!payload)
return;

buri = DB_GET_PAYLOAD(con->uri);

/* Delete the structure only if there are no more references
* to it in the connection pool
*/
Expand Down
4 changes: 4 additions & 0 deletions modules/db_berkeley/km_bdb_res.c
Expand Up @@ -429,6 +429,8 @@ int bdb_is_neq_type(db_type_t _t0, db_type_t _t1)
case DB1_BITMAP:
if (_t0==DB1_INT)
return 0;
default:
break;
}
return 1;
}
Expand Down Expand Up @@ -545,6 +547,8 @@ int bdb_cmp_val(db_val_t* _vp, db_val_t* _v)
case DB1_BITMAP:
return (_vp->val.int_val<_v->val.bitmap_val)?-1:
(_vp->val.int_val>_v->val.bitmap_val)?1:0;
default:
break;
}
return -2;
}
2 changes: 2 additions & 0 deletions modules/db_berkeley/km_bdb_val.c
Expand Up @@ -173,6 +173,8 @@ int bdb_str2val(db_type_t _t, db_val_t* _v, char* _s, int _l)
VAL_TYPE(_v) = DB1_BLOB;
LM_DBG("got blob len %d\n", _l);
return 0;
default:
break;
}

return -6;
Expand Down
8 changes: 4 additions & 4 deletions modules/db_berkeley/km_db_berkeley.c
Expand Up @@ -776,13 +776,13 @@ int bdb_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, int _n)
tbl_cache_p _tbc = NULL;
table_p _tp = NULL;
char kbuf[MAX_ROW_SIZE];
int i, j, ret, klen;
int ret, klen;
int *lkey=NULL;
DBT key;
DB *db;
DBC *dbcp;

i = j = ret = 0;
ret = 0;
klen=MAX_ROW_SIZE;

if (_op)
Expand Down Expand Up @@ -904,13 +904,13 @@ int _bdb_delete_cursor(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
db1_res_t* _r = NULL;
char kbuf[MAX_ROW_SIZE];
char dbuf[MAX_ROW_SIZE];
int i, ret, klen=MAX_ROW_SIZE;
int ret, klen=MAX_ROW_SIZE;
DBT key, data;
DB *db;
DBC *dbcp;
int *lkey=NULL;

i = ret = 0;
ret = 0;

if ((!_h) || !CON_TABLE(_h))
return -1;
Expand Down
3 changes: 3 additions & 0 deletions modules/db_perlvdb/perlvdb_conv.c
Expand Up @@ -140,6 +140,9 @@ inline SV *valdata(db_val_t* val) {
case DB1_BITMAP:
data = newSViv(VAL_BITMAP(val));
break;

default:
break;
}

return data;
Expand Down
8 changes: 0 additions & 8 deletions modules/db_postgres/pg_cmd.c
Expand Up @@ -180,10 +180,8 @@ static void free_pg_params(struct pg_params* params)
*/
static int check_types(db_cmd_t* cmd)
{
struct pg_cmd* pcmd;
struct pg_con* pcon;

pcmd = DB_GET_PAYLOAD(cmd);
/* FIXME: The function should take the connection as one of parameters */
pcon = DB_GET_PAYLOAD(cmd->ctx->con[db_payload_idx]);

Expand Down Expand Up @@ -369,11 +367,8 @@ int pg_cmd(db_cmd_t* cmd)

int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap)
{
struct pg_cmd* pcmd;
long long* id;

pcmd = (struct pg_cmd*)DB_GET_PAYLOAD(cmd);

if (!strcasecmp("last_id", optname)) {
id = va_arg(ap, long long*);
if (id == NULL) {
Expand All @@ -393,9 +388,6 @@ int pg_getopt(db_cmd_t* cmd, char* optname, va_list ap)

int pg_setopt(db_cmd_t* cmd, char* optname, va_list ap)
{
struct pg_cmd* pcmd;

pcmd = (struct pg_cmd*)DB_GET_PAYLOAD(cmd);
return 1;
}

Expand Down
12 changes: 6 additions & 6 deletions modules/db_text/dbt_raw_util.c
Expand Up @@ -166,7 +166,7 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
char** _o1 = NULL;
db_val_t* _v1 = NULL;
regmatch_t* matches = NULL;
int n, l;
int l;
int len;
regex_t preg;
int offset = 0;
Expand Down Expand Up @@ -233,11 +233,11 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
_v1[idx].val.str_val.s = pkg_malloc(l+1);
strncpy(_v1[idx].val.str_val.s, buffer+matches[5].rm_so, l);
}

// for(n=0; n < MAX_MATCH; n++) {
// LM_ERR("MATCH RESULT %d - %d,%d\n", n, matches[n].rm_so, matches[n].rm_eo);
// }

/* int n;
for(n=0; n < MAX_MATCH; n++) {
LM_ERR("MATCH RESULT %d - %d,%d\n", n, matches[n].rm_so, matches[n].rm_eo);
}
*/
if(matches[0].rm_eo != -1)
offset += matches[0].rm_eo;

Expand Down
2 changes: 1 addition & 1 deletion modules/ims_isc/mark.c
Expand Up @@ -313,7 +313,7 @@ inline int isc_mark_write_route(struct sip_msg *msg, str *as, str *iscmark) {
*/
int isc_mark_write_psu(struct sip_msg *msg, isc_mark *mark) {
struct lump *l = msg->add_rm;
int hlen;
size_t hlen;
char * hstr = NULL;
const str *regstate, *sescase;

Expand Down
23 changes: 11 additions & 12 deletions modules/pua_reginfo/usrloc_cb.c
Expand Up @@ -65,7 +65,6 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
str * body= NULL;
ucontact_t * ptr;
char buf[512];
int buf_len;
int reg_active = 0;
time_t cur_time = time(0);

Expand Down Expand Up @@ -99,7 +98,7 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {

/* Add the properties to this Node for AOR and ID: */
xmlNewProp(registration_node, BAD_CAST "aor", BAD_CAST uri.s);
buf_len = snprintf(buf, sizeof(buf), "%p", record);
snprintf(buf, sizeof(buf), "%p", record);
xmlNewProp(registration_node, BAD_CAST "id", BAD_CAST buf);

ptr = record->contacts;
Expand All @@ -113,7 +112,7 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
goto error;
}
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%p", ptr);
snprintf(buf, sizeof(buf), "%p", ptr);
xmlNewProp(contact_node, BAD_CAST "id", BAD_CAST buf);
/* Check, if this is the modified contact: */
if (ptr == c) {
Expand All @@ -128,50 +127,50 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
else if (type & UL_CONTACT_DELETE) xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unregistered");
else xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unknown");
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
} else {
reg_active = 1;
xmlNewProp(contact_node, BAD_CAST "state", BAD_CAST "active");
xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "registered");
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-cur_time));
xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
}
if (ptr->q != Q_UNSPECIFIED) {
float q = (float)ptr->q/1000;
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.3f", q);
snprintf(buf, sizeof(buf), "%.3f", q);
xmlNewProp(contact_node, BAD_CAST "q", BAD_CAST buf);
}
/* CallID Attribute */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->callid.len, ptr->callid.s);
snprintf(buf, sizeof(buf), "%.*s", ptr->callid.len, ptr->callid.s);
xmlNewProp(contact_node, BAD_CAST "callid", BAD_CAST buf);

/* CSeq Attribute */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%d", ptr->cseq);
snprintf(buf, sizeof(buf), "%d", ptr->cseq);
xmlNewProp(contact_node, BAD_CAST "cseq", BAD_CAST buf);

/* received Attribute */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->received.len, ptr->received.s);
snprintf(buf, sizeof(buf), "%.*s", ptr->received.len, ptr->received.s);
xmlNewProp(contact_node, BAD_CAST "received", BAD_CAST buf);

/* path Attribute */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->path.len, ptr->path.s);
snprintf(buf, sizeof(buf), "%.*s", ptr->path.len, ptr->path.s);
xmlNewProp(contact_node, BAD_CAST "path", BAD_CAST buf);

/* user_agent Attribute */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->user_agent.len, ptr->user_agent.s);
snprintf(buf, sizeof(buf), "%.*s", ptr->user_agent.len, ptr->user_agent.s);
xmlNewProp(contact_node, BAD_CAST "user_agent", BAD_CAST buf);

/* URI-Node */
memset(buf, 0, sizeof(buf));
buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->c.len, ptr->c.s);
snprintf(buf, sizeof(buf), "%.*s", ptr->c.len, ptr->c.s);
uri_node = xmlNewChild(contact_node, NULL, BAD_CAST "uri", BAD_CAST buf) ;
if(uri_node == NULL) {
LM_ERR("while adding child\n");
Expand Down
4 changes: 2 additions & 2 deletions modules/purple/hashtable.c
Expand Up @@ -36,11 +36,11 @@ static int *get_counter(char *key) {
if (d == NULL) {
gchar *k = g_strdup(key);
d = (int*) pkg_malloc(sizeof(int));
LM_DBG("counter created @0x%08x\n", (unsigned int)d);
LM_DBG("counter created @0x%p\n", d);
*d = 0;
g_hash_table_insert(hash, k, d);
}
LM_DBG("counter@0x%08x: key: %s ; value: %d\n", (unsigned int)d, key, *d);
LM_DBG("counter@0x%p: key: %s ; value: %d\n", d, key, *d);
return d;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/purple/purple_sip.c
Expand Up @@ -74,7 +74,7 @@ static str* build_pidf(char *uri, char *id, enum purple_publish_basic basic, enu
xmlNodePtr root_node = NULL, status_node = NULL;
xmlNodePtr tuple_node = NULL, basic_node = NULL;
xmlNodePtr person_node = NULL, activities_node = NULL;
xmlNsPtr pidf_ns, dm_ns, rpid_ns, cipid_ns;
xmlNsPtr pidf_ns, dm_ns, rpid_ns;
char* entity = NULL;

entity = (char*)pkg_malloc(7+ strlen(uri)*sizeof(char));
Expand Down Expand Up @@ -104,7 +104,7 @@ static str* build_pidf(char *uri, char *id, enum purple_publish_basic basic, enu
pidf_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf", NULL);
dm_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:data-model", BAD_CAST "dm");
rpid_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:rpid", BAD_CAST "rpid");
cipid_ns = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:cipid", BAD_CAST "c");
xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:pidf:cipid", BAD_CAST "c");

tuple_node = xmlNewChild(root_node, NULL, BAD_CAST "tuple", NULL);
if( tuple_node == NULL) {
Expand Down
2 changes: 0 additions & 2 deletions modules/snmpstats/hashTable.c
Expand Up @@ -165,7 +165,6 @@ void deleteUser(hashSlot_t *theTable, char *aor, int hashTableSize)
int hashIndex = calculateHashSlot(aor, hashTableSize);
int searchStringLength = strlen(aor);

aorToIndexStruct_t *previousRecord = theTable[hashIndex].first;
aorToIndexStruct_t *currentRecord = theTable[hashIndex].first;

while (currentRecord != NULL) {
Expand Down Expand Up @@ -227,7 +226,6 @@ void deleteUser(hashSlot_t *theTable, char *aor, int hashTableSize)
}

/* Advance to the next records. */
previousRecord = currentRecord;
currentRecord = currentRecord->next;
}

Expand Down
5 changes: 0 additions & 5 deletions modules/snmpstats/kamailioNet.c
Expand Up @@ -977,11 +977,6 @@ handle_kamailioNetTcpKeepIdle(netsnmp_mib_handler *handler,

switch(reqinfo->mode) {

struct cfg_group_tcp t;
unsigned int value;

tcp_options_get(&t);
value = t.con_lifetime;
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) &value, sizeof(int));
Expand Down
3 changes: 0 additions & 3 deletions modules/snmpstats/snmpSIPRegUserLookupTable.c
Expand Up @@ -459,15 +459,12 @@ void kamailioSIPRegUserLookupTable_set_reserve2( netsnmp_request_group *rg )

netsnmp_request_group_item *current;

netsnmp_variable_list *var;

int rc;

rg->rg_void = rg->list->ri;

for( current = rg->list; current; current = current->next ) {

var = current->ri->requestvb;
rc = SNMP_ERR_NOERROR;

switch(current->tri->colnum)
Expand Down
2 changes: 0 additions & 2 deletions modules/snmpstats/snmpSIPStatusCodesTable.c
Expand Up @@ -490,15 +490,13 @@ void kamailioSIPStatusCodesTable_set_reserve2( netsnmp_request_group *rg )
(kamailioSIPStatusCodesTable_context *)rg->undo_info;

netsnmp_request_group_item *current;
netsnmp_variable_list *var;

int rc;

rg->rg_void = rg->list->ri;

for( current = rg->list; current; current = current->next ) {

var = current->ri->requestvb;
rc = SNMP_ERR_NOERROR;

switch(current->tri->colnum)
Expand Down

0 comments on commit 46cc69f

Please sign in to comment.