Browse code

siputils: proper indentation for analysing code blocks

(cherry picked from commit 1dfde28a60b5a6c11d6e95eefbf760200c86384c)

Daniel-Constantin Mierla authored on 10/06/2015 11:10:23
Showing 1 changed files
... ...
@@ -168,23 +168,23 @@ int uri_param_2(struct sip_msg* _msg, char* _param, char* _value)
168 168
 	value = (str*)_value;
169 169
 
170 170
 	if (parse_sip_msg_uri(_msg) < 0) {
171
-	        LM_ERR("ruri parsing failed\n");
172
-	        return -1;
171
+		LM_ERR("ruri parsing failed\n");
172
+		return -1;
173 173
 	}
174 174
 
175 175
 	t = _msg->parsed_uri.params;
176 176
 
177 177
 	if (parse_params(&t, CLASS_ANY, &hooks, &params) < 0) {
178
-	        LM_ERR("ruri parameter parsing failed\n");
179
-	        return -1;
178
+		LM_ERR("ruri parameter parsing failed\n");
179
+		return -1;
180 180
 	}
181 181
 
182 182
 	for (pit = params; pit; pit = pit->next) {
183 183
 		if ((pit->name.len == param->len) &&
184
-		    (strncmp(pit->name.s, param->s, param->len) == 0)) {
184
+				(strncmp(pit->name.s, param->s, param->len) == 0)) {
185 185
 			if (value) {
186 186
 				if ((value->len == pit->body.len) &&
187
-				    strncmp(value->s, pit->body.s, value->len) == 0) {
187
+						strncmp(value->s, pit->body.s, value->len) == 0) {
188 188
 					goto ok;
189 189
 				} else {
190 190
 					goto nok;
... ...
@@ -198,7 +198,7 @@ int uri_param_2(struct sip_msg* _msg, char* _param, char* _value)
198 198
 			}
199 199
 		}
200 200
 	}
201
-	
201
+
202 202
 nok:
203 203
 	free_params(params);
204 204
 	return -1;
... ...
@@ -226,8 +226,8 @@ int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2)
226 226
 	}
227 227
 
228 228
 	if (parse_sip_msg_uri(_msg) < 0) {
229
-	        LM_ERR("ruri parsing failed\n");
230
-	        return -1;
229
+		LM_ERR("ruri parsing failed\n");
230
+		return -1;
231 231
 	}
232 232
 
233 233
 	parsed_uri = &(_msg->parsed_uri);
... ...
@@ -264,7 +264,7 @@ int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2)
264 264
 		parsed_uri->params.len + param->len + 1 +
265 265
 		parsed_uri->headers.len + 1;
266 266
 	if (new_uri.len > MAX_URI_SIZE) {
267
-	        LM_ERR("new ruri too long\n");
267
+		LM_ERR("new ruri too long\n");
268 268
 		return -1;
269 269
 	}
270 270
 
... ...
@@ -328,83 +328,83 @@ ok:
328 328
  */
329 329
 int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res)
330 330
 {
331
-    str uri, hostpart, tel_uri, sip_uri;
332
-    char *at;
333
-    int i, j, in_tel_parameters = 0;
334
-    pv_spec_t *res;
335
-    pv_value_t res_val;
336
-
337
-    /* get parameters */
338
-    if (get_str_fparam(&uri, _msg, (fparam_t*)_uri) < 0) {
339
-	LM_ERR("failed to get uri value\n");
340
-    }
341
-    if (get_str_fparam(&hostpart, _msg, (fparam_t*)_hostpart) < 0) {
342
-	LM_ERR("failed to get hostpart value\n");
343
-    }
344
-    res = (pv_spec_t *)_res;
345
-
346
-    /* check if anything needs to be done */
347
-    if (uri.len < 4) return 1;
348
-    if (strncasecmp(uri.s, "tel:", 4) != 0) return 1;
349
-    
350
-    /* reserve memory for clean tel uri */
351
-    tel_uri.s = pkg_malloc(uri.len+1);
352
-    if (tel_uri.s == 0) {
353
-	LM_ERR("no more pkg memory\n");
354
-	return -1;
355
-    }
356
-	
357
-    /* Remove visual separators before converting to SIP URI. Don't remove 
358
-       visual separators in TEL URI parameters (after the first ";") */
359
-    for (i=0, j=0; i < uri.len; i++) {
360
-	if (in_tel_parameters == 0) {
361
-	    if (uri.s[i] == ';')
362
-		in_tel_parameters = 1;
363
-	}
364
-	if (in_tel_parameters == 0) {
365
-	    if ((uri.s[i] != '-') && (uri.s[i] != '.') && 
366
-		(uri.s[i] != '(') && (uri.s[i] != ')'))
367
-		tel_uri.s[j++] = tolower(uri.s[i]);
368
-	} else {
369
-	    tel_uri.s[j++] = tolower(uri.s[i]);
331
+	str uri, hostpart, tel_uri, sip_uri;
332
+	char *at;
333
+	int i, j, in_tel_parameters = 0;
334
+	pv_spec_t *res;
335
+	pv_value_t res_val;
336
+
337
+	/* get parameters */
338
+	if (get_str_fparam(&uri, _msg, (fparam_t*)_uri) < 0) {
339
+		LM_ERR("failed to get uri value\n");
340
+	}
341
+	if (get_str_fparam(&hostpart, _msg, (fparam_t*)_hostpart) < 0) {
342
+		LM_ERR("failed to get hostpart value\n");
343
+	}
344
+	res = (pv_spec_t *)_res;
345
+
346
+	/* check if anything needs to be done */
347
+	if (uri.len < 4) return 1;
348
+	if (strncasecmp(uri.s, "tel:", 4) != 0) return 1;
349
+
350
+	/* reserve memory for clean tel uri */
351
+	tel_uri.s = pkg_malloc(uri.len+1);
352
+	if (tel_uri.s == 0) {
353
+		LM_ERR("no more pkg memory\n");
354
+		return -1;
355
+	}
356
+
357
+	/* Remove visual separators before converting to SIP URI. Don't remove 
358
+	   visual separators in TEL URI parameters (after the first ";") */
359
+	for (i=0, j=0; i < uri.len; i++) {
360
+		if (in_tel_parameters == 0) {
361
+			if (uri.s[i] == ';')
362
+				in_tel_parameters = 1;
363
+		}
364
+		if (in_tel_parameters == 0) {
365
+			if ((uri.s[i] != '-') && (uri.s[i] != '.') && 
366
+					(uri.s[i] != '(') && (uri.s[i] != ')'))
367
+				tel_uri.s[j++] = tolower(uri.s[i]);
368
+		} else {
369
+			tel_uri.s[j++] = tolower(uri.s[i]);
370
+		}
370 371
 	}
371
-    }
372
-    tel_uri.s[j] = '\0';
373
-    tel_uri.len = strlen(tel_uri.s);
372
+	tel_uri.s[j] = '\0';
373
+	tel_uri.len = strlen(tel_uri.s);
374 374
 
375
-    /* reserve memory for resulting sip uri */
376
-    sip_uri.len = 4 + tel_uri.len - 4 + 1 + hostpart.len + 1 + 10;
377
-    sip_uri.s = pkg_malloc(sip_uri.len);
378
-    if (sip_uri.s == 0) {
379
-	LM_ERR("no more pkg memory\n");
375
+	/* reserve memory for resulting sip uri */
376
+	sip_uri.len = 4 + tel_uri.len - 4 + 1 + hostpart.len + 1 + 10;
377
+	sip_uri.s = pkg_malloc(sip_uri.len);
378
+	if (sip_uri.s == 0) {
379
+		LM_ERR("no more pkg memory\n");
380
+		pkg_free(tel_uri.s);
381
+		return -1;
382
+	}
383
+
384
+	/* create resulting sip uri */
385
+	at = sip_uri.s;
386
+	append_str(at, "sip:", 4);
387
+	append_str(at, tel_uri.s + 4, tel_uri.len - 4);
388
+	append_chr(at, '@');
389
+	append_str(at, hostpart.s, hostpart.len);
390
+	append_chr(at, ';');
391
+	append_str(at, "user=phone", 10);
392
+
393
+	/* tel_uri is not needed anymore */
380 394
 	pkg_free(tel_uri.s);
381
-	return -1;
382
-    }
383
-
384
-    /* create resulting sip uri */
385
-    at = sip_uri.s;
386
-    append_str(at, "sip:", 4);
387
-    append_str(at, tel_uri.s + 4, tel_uri.len - 4);
388
-    append_chr(at, '@');
389
-    append_str(at, hostpart.s, hostpart.len);
390
-    append_chr(at, ';');
391
-    append_str(at, "user=phone", 10);
392
-
393
-    /* tel_uri is not needed anymore */
394
-    pkg_free(tel_uri.s);
395
-
396
-    /* set result pv value and write sip uri to result pv */
397
-    res_val.rs = sip_uri;
398
-    res_val.flags = PV_VAL_STR;
399
-    if (res->setf(_msg, &res->pvp, (int)EQ_T, &res_val) != 0) {
400
-	LM_ERR("failed to set result pvar\n");
401
-	pkg_free(sip_uri.s);
402
-	return -1;
403
-    }
404 395
 
405
-    /* free allocated pkg memory and return */
406
-    pkg_free(sip_uri.s);
407
-    return 1;
396
+	/* set result pv value and write sip uri to result pv */
397
+	res_val.rs = sip_uri;
398
+	res_val.flags = PV_VAL_STR;
399
+	if (res->setf(_msg, &res->pvp, (int)EQ_T, &res_val) != 0) {
400
+		LM_ERR("failed to set result pvar\n");
401
+		pkg_free(sip_uri.s);
402
+		return -1;
403
+	}
404
+
405
+	/* free allocated pkg memory and return */
406
+	pkg_free(sip_uri.s);
407
+	return 1;
408 408
 }
409 409
 
410 410
 
... ...
@@ -432,26 +432,26 @@ static inline int e164_check(str* _user)
432 432
  */
433 433
 int is_e164(struct sip_msg* _m, char* _sp, char* _s2)
434 434
 {
435
-    pv_spec_t *sp;
436
-    pv_value_t pv_val;
435
+	pv_spec_t *sp;
436
+	pv_value_t pv_val;
437 437
 
438
-    sp = (pv_spec_t *)_sp;
438
+	sp = (pv_spec_t *)_sp;
439 439
 
440
-    if (sp && (pv_get_spec_value(_m, sp, &pv_val) == 0)) {
441
-	if (pv_val.flags & PV_VAL_STR) {
442
-	    if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
443
-		LM_DBG("missing argument\n");
444
-		return -1;
445
-	    }
446
-	    return e164_check(&(pv_val.rs));
440
+	if (sp && (pv_get_spec_value(_m, sp, &pv_val) == 0)) {
441
+		if (pv_val.flags & PV_VAL_STR) {
442
+			if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
443
+				LM_DBG("missing argument\n");
444
+				return -1;
445
+			}
446
+			return e164_check(&(pv_val.rs));
447
+		} else {
448
+			LM_ERR("pseudo variable value is not string\n");
449
+			return -1;
450
+		}
447 451
 	} else {
448
-	    LM_ERR("pseudo variable value is not string\n");
449
-	    return -1;
452
+		LM_ERR("failed to get pseudo variable value\n");
453
+		return -1;
450 454
 	}
451
-    } else {
452
-	LM_ERR("failed to get pseudo variable value\n");
453
-	return -1;
454
-    }
455 455
 }
456 456
 
457 457
 
... ...
@@ -460,45 +460,45 @@ int is_e164(struct sip_msg* _m, char* _sp, char* _s2)
460 460
  */
461 461
 int w_is_uri_user_e164(struct sip_msg* _m, char* _sp, char* _s2)
462 462
 {
463
-    pv_spec_t *sp;
464
-    pv_value_t pv_val;
463
+	pv_spec_t *sp;
464
+	pv_value_t pv_val;
465 465
 
466
-    sp = (pv_spec_t *)_sp;
466
+	sp = (pv_spec_t *)_sp;
467 467
 
468
-    if (sp && (pv_get_spec_value(_m, sp, &pv_val) == 0)) {
469
-	if (pv_val.flags & PV_VAL_STR) {
470
-	    if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
471
-		LM_DBG("missing uri\n");
472
-		return -1;
473
-	    }
474
-	    return is_uri_user_e164(&pv_val.rs);
468
+	if (sp && (pv_get_spec_value(_m, sp, &pv_val) == 0)) {
469
+		if (pv_val.flags & PV_VAL_STR) {
470
+			if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
471
+				LM_DBG("missing uri\n");
472
+				return -1;
473
+			}
474
+			return is_uri_user_e164(&pv_val.rs);
475
+		} else {
476
+			LM_ERR("pseudo variable value is not string\n");
477
+			return -1;
478
+		}
475 479
 	} else {
476
-	    LM_ERR("pseudo variable value is not string\n");
477
-	    return -1;
480
+		LM_ERR("failed to get pseudo variable value\n");
481
+		return -1;
478 482
 	}
479
-    } else {
480
-	LM_ERR("failed to get pseudo variable value\n");
481
-	return -1;
482
-    }
483 483
 }
484 484
 
485 485
 
486 486
 int is_uri_user_e164(str *uri)
487 487
 {
488
-    char *chr;
489
-    str user;
488
+	char *chr;
489
+	str user;
490 490
 
491
-    chr = memchr(uri->s, ':', uri->len);
492
-    if (chr == NULL) {
493
-	LM_ERR("parsing URI failed\n");
494
-	return -1;
495
-    };
496
-    user.s = chr + 1;
497
-    chr = memchr(user.s, '@', uri->len - (user.s - uri->s));
498
-    if (chr == NULL) return -1;
499
-    user.len = chr - user.s;
491
+	chr = memchr(uri->s, ':', uri->len);
492
+	if (chr == NULL) {
493
+		LM_ERR("parsing URI failed\n");
494
+		return -1;
495
+	};
496
+	user.s = chr + 1;
497
+	chr = memchr(user.s, '@', uri->len - (user.s - uri->s));
498
+	if (chr == NULL) return -1;
499
+	user.len = chr - user.s;
500 500
 
501
-    return e164_check(&user);
501
+	return e164_check(&user);
502 502
 }
503 503
 
504 504
 /*
... ...
@@ -506,87 +506,87 @@ int is_uri_user_e164(str *uri)
506 506
  */
507 507
 int set_uri_user(struct sip_msg* _m, char* _uri, char* _value)
508 508
 {
509
-    pv_spec_t *uri_pv, *value_pv;
510
-    pv_value_t uri_val, value_val, res_val;
511
-    str uri, value;
512
-    char *at, *colon, *c;
513
-    char new_uri[MAX_URI_SIZE + 1];
514
-
515
-    uri_pv = (pv_spec_t *)_uri;
516
-    if (uri_pv && (pv_get_spec_value(_m, uri_pv, &uri_val) == 0)) {
517
-	if (uri_val.flags & PV_VAL_STR) {
518
-	    if (uri_val.rs.len == 0 || uri_val.rs.s == NULL) {
519
-		LM_ERR("missing uri value\n");
520
-		return -1;
521
-	    }
509
+	pv_spec_t *uri_pv, *value_pv;
510
+	pv_value_t uri_val, value_val, res_val;
511
+	str uri, value;
512
+	char *at, *colon, *c;
513
+	char new_uri[MAX_URI_SIZE + 1];
514
+
515
+	uri_pv = (pv_spec_t *)_uri;
516
+	if (uri_pv && (pv_get_spec_value(_m, uri_pv, &uri_val) == 0)) {
517
+		if (uri_val.flags & PV_VAL_STR) {
518
+			if (uri_val.rs.len == 0 || uri_val.rs.s == NULL) {
519
+				LM_ERR("missing uri value\n");
520
+				return -1;
521
+			}
522
+		} else {
523
+			LM_ERR("uri value is not string\n");
524
+			return -1;
525
+		}
522 526
 	} else {
523
-	    LM_ERR("uri value is not string\n");
524
-	    return -1;
525
-	}
526
-    } else {
527
-	LM_ERR("failed to get uri value\n");
528
-	return -1;
529
-    }
530
-    uri = uri_val.rs;
531
-
532
-    value_pv = (pv_spec_t *)_value;
533
-    if (value_pv && (pv_get_spec_value(_m, value_pv, &value_val) == 0)) {
534
-	if (value_val.flags & PV_VAL_STR) {
535
-	    if (value_val.rs.s == NULL) {
536
-		LM_ERR("missing uriuser value\n");
527
+		LM_ERR("failed to get uri value\n");
537 528
 		return -1;
538
-	    }
529
+	}
530
+	uri = uri_val.rs;
531
+
532
+	value_pv = (pv_spec_t *)_value;
533
+	if (value_pv && (pv_get_spec_value(_m, value_pv, &value_val) == 0)) {
534
+		if (value_val.flags & PV_VAL_STR) {
535
+			if (value_val.rs.s == NULL) {
536
+				LM_ERR("missing uriuser value\n");
537
+				return -1;
538
+			}
539
+		} else {
540
+			LM_ERR("uriuser value is not string\n");
541
+			return -1;
542
+		}
539 543
 	} else {
540
-	    LM_ERR("uriuser value is not string\n");
541
-	    return -1;
544
+		LM_ERR("failed to get uriuser value\n");
545
+		return -1;
542 546
 	}
543
-    } else {
544
-	LM_ERR("failed to get uriuser value\n");
545
-	return -1;
546
-    }
547
-    value = value_val.rs;
547
+	value = value_val.rs;
548 548
 
549
-    colon = strchr(uri.s, ':');
550
-    if (colon == NULL) {
551
-	LM_ERR("uri does not contain ':' character\n");
552
-	return -1;
553
-    }
554
-    at = strchr(uri.s, '@');
555
-    c = &(new_uri[0]);
556
-    if (at == NULL) {
557
-	if (value.len == 0) return 1;
558
-	if (uri.len + value.len > MAX_URI_SIZE) {
559
-	    LM_ERR("resulting uri would be too large\n");
560
-	    return -1;
549
+	colon = strchr(uri.s, ':');
550
+	if (colon == NULL) {
551
+		LM_ERR("uri does not contain ':' character\n");
552
+		return -1;
561 553
 	}
562
-	append_str(c, uri.s, colon - uri.s + 1);
563
-	append_str(c, value.s, value.len);
564
-	append_chr(c, '@');
565
-	append_str(c, colon + 1, uri.len - (colon - uri.s + 1));
566
-	res_val.rs.len = uri.len + value.len + 1;
567
-    } else {
568
-	if (value.len == 0) {
569
-	    append_str(c, uri.s, colon - uri.s + 1);
570
-	    append_str(c, at + 1, uri.len - (at - uri.s + 1));
571
-	    res_val.rs.len = uri.len - (at - colon);
554
+	at = strchr(uri.s, '@');
555
+	c = &(new_uri[0]);
556
+	if (at == NULL) {
557
+		if (value.len == 0) return 1;
558
+		if (uri.len + value.len > MAX_URI_SIZE) {
559
+			LM_ERR("resulting uri would be too large\n");
560
+			return -1;
561
+		}
562
+		append_str(c, uri.s, colon - uri.s + 1);
563
+		append_str(c, value.s, value.len);
564
+		append_chr(c, '@');
565
+		append_str(c, colon + 1, uri.len - (colon - uri.s + 1));
566
+		res_val.rs.len = uri.len + value.len + 1;
572 567
 	} else {
573
-	    if (uri.len + value.len - (at - colon - 1) > MAX_URI_SIZE) {
574
-		LM_ERR("resulting uri would be too large\n");
575
-		return -1;
576
-	    }
577
-	    append_str(c, uri.s, colon - uri.s + 1);
578
-	    append_str(c, value.s, value.len);
579
-	    append_str(c, at, uri.len - (at - uri.s));
580
-	    res_val.rs.len = uri.len + value.len - (at - colon - 1);
568
+		if (value.len == 0) {
569
+			append_str(c, uri.s, colon - uri.s + 1);
570
+			append_str(c, at + 1, uri.len - (at - uri.s + 1));
571
+			res_val.rs.len = uri.len - (at - colon);
572
+		} else {
573
+			if (uri.len + value.len - (at - colon - 1) > MAX_URI_SIZE) {
574
+				LM_ERR("resulting uri would be too large\n");
575
+				return -1;
576
+			}
577
+			append_str(c, uri.s, colon - uri.s + 1);
578
+			append_str(c, value.s, value.len);
579
+			append_str(c, at, uri.len - (at - uri.s));
580
+			res_val.rs.len = uri.len + value.len - (at - colon - 1);
581
+		}
581 582
 	}
582
-    }
583 583
 
584
-    res_val.rs.s = &(new_uri[0]);
585
-    LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s);
586
-    res_val.flags = PV_VAL_STR;
587
-    uri_pv->setf(_m, &uri_pv->pvp, (int)EQ_T, &res_val);
584
+	res_val.rs.s = &(new_uri[0]);
585
+	LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s);
586
+	res_val.flags = PV_VAL_STR;
587
+	uri_pv->setf(_m, &uri_pv->pvp, (int)EQ_T, &res_val);
588 588
 
589
-    return 1;
589
+	return 1;
590 590
 }
591 591
 
592 592
 /*
... ...
@@ -594,80 +594,80 @@ int set_uri_user(struct sip_msg* _m, char* _uri, char* _value)
594 594
  */
595 595
 int set_uri_host(struct sip_msg* _m, char* _uri, char* _value)
596 596
 {
597
-    pv_spec_t *uri_pv, *value_pv;
598
-    pv_value_t uri_val, value_val, res_val;
599
-    str uri, value;
600
-    char *at, *colon, *c, *next;
601
-    unsigned int host_len;
602
-    char new_uri[MAX_URI_SIZE + 1];
603
-
604
-    uri_pv = (pv_spec_t *)_uri;
605
-    if (uri_pv && (pv_get_spec_value(_m, uri_pv, &uri_val) == 0)) {
606
-	if (uri_val.flags & PV_VAL_STR) {
607
-	    if (uri_val.rs.len == 0 || uri_val.rs.s == NULL) {
608
-		LM_ERR("missing uri value\n");
597
+	pv_spec_t *uri_pv, *value_pv;
598
+	pv_value_t uri_val, value_val, res_val;
599
+	str uri, value;
600
+	char *at, *colon, *c, *next;
601
+	unsigned int host_len;
602
+	char new_uri[MAX_URI_SIZE + 1];
603
+
604
+	uri_pv = (pv_spec_t *)_uri;
605
+	if (uri_pv && (pv_get_spec_value(_m, uri_pv, &uri_val) == 0)) {
606
+		if (uri_val.flags & PV_VAL_STR) {
607
+			if (uri_val.rs.len == 0 || uri_val.rs.s == NULL) {
608
+				LM_ERR("missing uri value\n");
609
+				return -1;
610
+			}
611
+		} else {
612
+			LM_ERR("uri value is not string\n");
613
+			return -1;
614
+		}
615
+	} else {
616
+		LM_ERR("failed to get uri value\n");
609 617
 		return -1;
610
-	    }
618
+	}
619
+	uri = uri_val.rs;
620
+
621
+	value_pv = (pv_spec_t *)_value;
622
+	if (value_pv && (pv_get_spec_value(_m, value_pv, &value_val) == 0)) {
623
+		if (value_val.flags & PV_VAL_STR) {
624
+			if (value_val.rs.s == NULL) {
625
+				LM_ERR("missing uri value\n");
626
+				return -1;
627
+			}
628
+		} else {
629
+			LM_ERR("uri value is not string\n");
630
+			return -1;
631
+		}
611 632
 	} else {
612
-	    LM_ERR("uri value is not string\n");
613
-	    return -1;
633
+		LM_ERR("failed to get uri value\n");
634
+		return -1;
614 635
 	}
615
-    } else {
616
-	LM_ERR("failed to get uri value\n");
617
-	return -1;
618
-    }
619
-    uri = uri_val.rs;
620
-
621
-    value_pv = (pv_spec_t *)_value;
622
-    if (value_pv && (pv_get_spec_value(_m, value_pv, &value_val) == 0)) {
623
-	if (value_val.flags & PV_VAL_STR) {
624
-	    if (value_val.rs.s == NULL) {
625
-		LM_ERR("missing uri value\n");
636
+	value = value_val.rs;
637
+
638
+	if (value.len == 0) {
639
+		LM_ERR("hostpart of uri cannot be empty\n");
640
+		return -1;
641
+	}
642
+	if (uri.len + value.len > MAX_URI_SIZE) {
643
+		LM_ERR("resulting uri would be too large\n");
626 644
 		return -1;
627
-	    }
645
+	}
646
+
647
+	colon = strchr(uri.s, ':');
648
+	if (colon == NULL) {
649
+		LM_ERR("uri does not contain ':' character\n");
650
+		return -1;
651
+	}
652
+	c = &(new_uri[0]);
653
+	at = strchr(colon + 1, '@');
654
+	if (at == NULL) {
655
+		next = colon + 1;
628 656
 	} else {
629
-	    LM_ERR("uri value is not string\n");
630
-	    return -1;
657
+		next = at + 1;
631 658
 	}
632
-    } else {
633
-	LM_ERR("failed to get uri value\n");
634
-	return -1;
635
-    }
636
-    value = value_val.rs;
659
+	append_str(c, uri.s, next - uri.s);
660
+	host_len = strcspn(next, ":;?");
661
+	append_str(c, value.s, value.len);
662
+	strcpy(c, next + host_len);
663
+	res_val.rs.len = uri.len + value.len - host_len;
664
+	res_val.rs.s = &(new_uri[0]);
637 665
 
638
-    if (value.len == 0) {
639
-	LM_ERR("hostpart of uri cannot be empty\n");
640
-	return -1;
641
-    }
642
-    if (uri.len + value.len > MAX_URI_SIZE) {
643
-	LM_ERR("resulting uri would be too large\n");
644
-	return -1;
645
-    }
666
+	LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s);
667
+	res_val.flags = PV_VAL_STR;
668
+	uri_pv->setf(_m, &uri_pv->pvp, (int)EQ_T, &res_val);
646 669
 
647
-    colon = strchr(uri.s, ':');
648
-    if (colon == NULL) {
649
-	LM_ERR("uri does not contain ':' character\n");
650
-	return -1;
651
-    }
652
-    c = &(new_uri[0]);
653
-    at = strchr(colon + 1, '@');
654
-    if (at == NULL) {
655
-	next = colon + 1;
656
-    } else {
657
-	next = at + 1;
658
-    }
659
-    append_str(c, uri.s, next - uri.s);
660
-    host_len = strcspn(next, ":;?");
661
-    append_str(c, value.s, value.len);
662
-    strcpy(c, next + host_len);
663
-    res_val.rs.len = uri.len + value.len - host_len;
664
-    res_val.rs.s = &(new_uri[0]);
665
-
666
-    LM_DBG("resulting uri: %.*s\n", res_val.rs.len, res_val.rs.s);
667
-    res_val.flags = PV_VAL_STR;
668
-    uri_pv->setf(_m, &uri_pv->pvp, (int)EQ_T, &res_val);
669
-
670
-    return 1;
670
+	return 1;
671 671
 }
672 672
 
673 673
 /**
... ...
@@ -684,7 +684,7 @@ int get_uri_param(struct sip_msg* _msg, char* _param, char* _value)
684 684
 
685 685
 	param = (str*)_param;
686 686
 	dst = (pv_spec_t *) _value;
687
-  
687
+
688 688
 	if (parse_sip_msg_uri(_msg) < 0) {
689 689
 		LM_ERR("ruri parsing failed\n");
690 690
 		return -1;
... ...
@@ -710,7 +710,7 @@ int get_uri_param(struct sip_msg* _msg, char* _param, char* _value)
710 710
 			params = params->next;
711 711
 		}
712 712
 	}
713
-  
713
+
714 714
 	free_params(params);
715 715
 	return -1;
716 716
 
... ...
@@ -726,10 +726,10 @@ found:
726 726
  */
727 727
 int is_tel_number(sip_msg_t *msg, char *_sp, char* _s2)
728 728
 {
729
-    str tval = {0, 0};
730
-    int i;
729
+	str tval = {0, 0};
730
+	int i;
731 731
 
732
-    if(fixup_get_svalue(msg, (gparam_t*)_sp, &tval)!=0)
732
+	if(fixup_get_svalue(msg, (gparam_t*)_sp, &tval)!=0)
733 733
 	{
734 734
 		LM_ERR("cannot get parameter value\n");
735 735
 		return -1;
... ...
@@ -760,10 +760,10 @@ int is_tel_number(sip_msg_t *msg, char *_sp, char* _s2)
760 760
  */
761 761
 int is_numeric(sip_msg_t *msg, char *_sp, char* _s2)
762 762
 {
763
-    str tval = {0, 0};
764
-    int i;
763
+	str tval = {0, 0};
764
+	int i;
765 765
 
766
-    if(fixup_get_svalue(msg, (gparam_t*)_sp, &tval)!=0)
766
+	if(fixup_get_svalue(msg, (gparam_t*)_sp, &tval)!=0)
767 767
 	{
768 768
 		LM_ERR("cannot get parameter value\n");
769 769
 		return -1;