Browse code

fix some compiler warnings

git-svn: trunk@2564

Tomasz Kojm authored on 2006/12/20 05:30:17
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Dec 19 21:28:09 CET 2006 (tk)
2
+---------------------------------
3
+  * libclamav/phishcheck.c, regex_list.c: fix some compiler warnings, patch
4
+					  from Edvin
5
+
1 6
 Tue Dec 19 21:13:23 CET 2006 (tk)
2 7
 ---------------------------------
3 8
   * libclamav/cab.c: extract stored files
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: phishcheck.c,v $
22
+ *  Revision 1.15  2006/12/19 20:30:17  tkojm
23
+ *  fix some compiler warnings
24
+ *
22 25
  *  Revision 1.14  2006/10/14 23:52:01  tkojm
23 26
  *  code cleanup
24 27
  *
... ...
@@ -496,7 +499,7 @@ int get_host(const struct phishcheck* s,struct string* dest,const char* URL,int
496 496
 	const char* end=NULL;
497 497
 	if(!URL) {
498 498
 		string_assign_null(dest);
499
-		return;
499
+		return 0;
500 500
 	}
501 501
 	start = strstr(URL,"://");
502 502
 	if(!start) {
... ...
@@ -563,8 +566,9 @@ int get_host(const struct phishcheck* s,struct string* dest,const char* URL,int
563 563
 			end  = start + strlen(start);
564 564
 	}
565 565
 
566
-	if(rc = string_assign_dup(dest,start,end))
566
+	if(( rc = string_assign_dup(dest,start,end) ))
567 567
 		return rc;
568
+	return 0;
568 569
 }
569 570
 
570 571
 int isCountryCode(const struct phishcheck* s,const char* str)
... ...
@@ -861,14 +865,14 @@ cleanupURL(struct string *URL, int isReal)
861 861
 	len = strlen(begin);
862 862
 	if(len == 0) {
863 863
 		string_assign_null(URL);
864
-		return;
864
+		return 0;
865 865
 	}
866 866
 
867 867
 	end = begin + len - 1;
868 868
 	/*cli_dbgmsg("%d %d\n", end-begin, len);*/
869 869
 	if(begin >= end) {
870 870
 		string_assign_null(URL);
871
-		return;
871
+		return 0;
872 872
 	}
873 873
 	while(isspace(*end))
874 874
 		end--;
... ...
@@ -895,10 +899,11 @@ cleanupURL(struct string *URL, int isReal)
895 895
 		/* convert %xx to real value */
896 896
 		str_hex_to_char(&begin,&end);
897 897
 		str_fixup_spaces(&begin,&end);
898
-		if (rc = string_assign_dup(URL,begin,end+1))
898
+		if (( rc = string_assign_dup(URL,begin,end+1) ))
899 899
 			return rc;
900 900
 		/*cli_dbgmsg("%p::%s\n",URL->data,URL->data);*/
901 901
 	}
902
+	return 0;
902 903
 }
903 904
 
904 905
 void get_redirected_URL(struct string* URL)
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: regex_list.c,v $
22
+ *  Revision 1.17  2006/12/19 20:30:17  tkojm
23
+ *  fix some compiler warnings
24
+ *
22 25
  *  Revision 1.16  2006/12/02 00:42:44  tkojm
23 26
  *  add functionality level support for .pdb/.wdb files
24 27
  *
... ...
@@ -527,7 +530,7 @@ static int add_regex_list_element(struct cli_matcher* root,const char* pattern,c
527 527
        return CL_SUCCESS;
528 528
 }
529 529
 
530
-int functionality_level_check(char* line)
530
+static int functionality_level_check(char* line)
531 531
 {
532 532
 	char* ptmin;
533 533
 	char* ptmax;
... ...
@@ -543,9 +546,9 @@ int functionality_level_check(char* line)
543 543
 	if(!ptmax) 
544 544
 		return CL_SUCCESS;/* there is no functionality level specified, so we're ok */
545 545
 	else {
546
-		int min, max;
546
+		size_t min, max;
547 547
 		ptmax++;
548
-		for(j=0;j<ptmax-ptmin-1;j++)
548
+		for(j=0;j+ptmin+1 < ptmax;j++)
549 549
 			if(!isdigit(ptmin[j])) 
550 550
 				return CL_SUCCESS;/* not numbers, not functionality level */
551 551
 		for(j=0;j<strlen(ptmax);j++)
... ...
@@ -557,8 +560,6 @@ int functionality_level_check(char* line)
557 557
  			max = INT_MAX; 		
558 558
 		else
559 559
 			max = atoi(ptmax);
560
-		if(min<0) min=0;
561
-		if(max<0) max=0;
562 560
 
563 561
 		if(min > cl_retflevel()) {
564 562
 			cli_dbgmsg("regex list line %s not loaded (required f-level: %d)\n",line,min);