Browse code

shared/optparser.[ch]: properly handle large size values (bb#1583)

git-svn: trunk@5058

Tomasz Kojm authored on 2009/05/05 22:33:11
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue May  5 15:30:26 CEST 2009 (tk)
2
+----------------------------------
3
+ * shared/optparser.[ch]: properly handle large size values (bb#1583)
4
+
1 5
 Mon May  4 10:47:10 CEST 2009 (tk)
2 6
 ----------------------------------
3 7
  * freshclam/freshclam.c: handle --debug (bb#1590)
... ...
@@ -460,7 +460,7 @@ static void optprint(const struct optstruct *opts)
460 460
 }
461 461
 */
462 462
 
463
-static int optadd(struct optstruct **opts, struct optstruct **opts_last, const char *name, const char *cmd, const char *strarg, int numarg, int flags, int idx)
463
+static int optadd(struct optstruct **opts, struct optstruct **opts_last, const char *name, const char *cmd, const char *strarg, long long numarg, int flags, int idx)
464 464
 {
465 465
 	struct optstruct *newnode;
466 466
 
... ...
@@ -525,7 +525,7 @@ static int optadd(struct optstruct **opts, struct optstruct **opts_last, const c
525 525
     return 0;
526 526
 }
527 527
 
528
-static int optaddarg(struct optstruct *opts, const char *name, const char *strarg, int numarg)
528
+static int optaddarg(struct optstruct *opts, const char *name, const char *strarg, long long numarg)
529 529
 {
530 530
 	struct optstruct *pt, *h, *new;
531 531
 
... ...
@@ -631,13 +631,13 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
631 631
 	const struct clam_option *optentry;
632 632
 	char *pt;
633 633
 	const char *name = NULL, *arg;
634
-	int i, err = 0, lc = 0, sc = 0, opt_index, line = 0, ret, numarg;
634
+	int i, err = 0, lc = 0, sc = 0, opt_index, line = 0, ret;
635 635
 	struct optstruct *opts = NULL, *opts_last = NULL, *opt;
636 636
 	char buffer[512], *buff;
637 637
 	struct option longopts[MAXCMDOPTS];
638 638
 	char shortopts[MAXCMDOPTS];
639 639
 	regex_t regex;
640
-	unsigned long int lnumarg;
640
+	long long numarg, lnumarg;
641 641
 	int regflags = REG_EXTENDED | REG_NOSUB;
642 642
 
643 643
 
... ...
@@ -952,7 +952,7 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo
952 952
 		    lnumarg = UINT_MAX;
953 953
 		}
954 954
 
955
-		numarg = (unsigned int)lnumarg;
955
+		numarg = lnumarg;
956 956
 		break;
957 957
 
958 958
 	    case TYPE_BOOL:
... ...
@@ -41,7 +41,7 @@ struct optstruct {
41 41
     char *name;
42 42
     char *cmd;
43 43
     char *strarg;
44
-    int numarg;
44
+    long long numarg;
45 45
     int enabled;
46 46
     int active;
47 47
     int flags;
... ...
@@ -58,7 +58,7 @@ struct clam_option {
58 58
     char shortopt;
59 59
     int argtype;
60 60
     const char *regex;
61
-    int numarg;
61
+    long long numarg;
62 62
     const char *strarg;
63 63
     int flags;
64 64
     int owner;