Browse code

sipcapture: fixed clang compile warnings

- extra parameters for sprintf() match format specifiers

(cherry picked from commit b131f4402cf604bbe90123aa95a6cbc8412c2de0)

Daniel-Constantin Mierla authored on 06/12/2013 17:54:52
Showing 1 changed files
... ...
@@ -486,7 +486,7 @@ int capture_mode_set_params (_capture_mode_data_t * n, str * params){
486 486
 		}
487 487
 
488 488
 		else if (pit->name.len == 10 && strncmp (pit->name.s, "table_name", pit->name.len)==0){
489
-			if ((n->no_tables = parse_table_names(pit->body, &n->table_names))<0){
489
+			if ((int)(n->no_tables = parse_table_names(pit->body, &n->table_names))<0){
490 490
 				LM_ERR("parsing capture_mode: table name parsing failed\n");
491 491
 				goto error;
492 492
 			}
... ...
@@ -781,14 +781,14 @@ static int mod_init(void) {
781 781
 	while (c){
782 782
 		/*for the default capture_mode, don't add it's name to the stat name*/
783 783
 		def = (capture_def && c == capture_def)?1:0;
784
-		stat_name = (char *)shm_malloc(sizeof (char) * snprintf(NULL, 0 , (def)?"captured_requests":"captured_requests[%.*s]", c->name.len, c->name.s) + 1);
785
-		sprintf(stat_name, (def)?"captured_requests":"captured_requests[%.*s]", c->name.len, c->name.s);
784
+		stat_name = (char *)shm_malloc(sizeof (char) * (snprintf(NULL, 0 , (def)?"captured_requests%.*s":"captured_requests[%.*s]", (def)?0:c->name.len, (def)?"":c->name.s) + 1));
785
+		sprintf(stat_name, (def)?"captured_requests%.*s":"captured_requests[%.*s]", (def)?0:c->name.len, (def)?"":c->name.s);
786 786
 		stats[i].name = stat_name;
787 787
 		stats[i].flags = 0;
788 788
 		stats[i].stat_pointer = &c->sipcapture_req;
789 789
 		i++;
790
-		stat_name = (char *)shm_malloc(sizeof (char) * snprintf(NULL, 0 , (def)?"captured_replies":"captured_replies[%.*s]", c->name.len, c->name.s) + 1);
791
-		sprintf(stat_name, (def)?"captured_replies":"captured_replies[%.*s]", c->name.len, c->name.s);
790
+		stat_name = (char *)shm_malloc(sizeof (char) * (snprintf(NULL, 0 , (def)?"captured_replies%.*s":"captured_replies[%.*s]", (def)?0:c->name.len, (def)?"":c->name.s) + 1));
791
+		sprintf(stat_name, (def)?"captured_replies%.*s":"captured_replies[%.*s]", (def)?0:c->name.len, (def)?"":c->name.s);
792 792
 		stats[i].name = stat_name;
793 793
 		stats[i].flags = 0;
794 794
 		stats[i].stat_pointer = &c->sipcapture_rpl;