Browse code

- more warnings & signed/unsigned issues fixes (gcc 3.2/solaris)

Andrei Pelinescu-Onciul authored on 02/12/2004 21:16:02
Showing 1 changed files
... ...
@@ -108,7 +108,8 @@
108 108
 #define get_int(_p_,_end_,_res_,_n_,_err_s_,_err_) \
109 109
 	do { \
110 110
 		_res_ = 0;\
111
-		for( _n_=0 ; (_p_)<(_end_) && isdigit(*(_p_)) ; (_p_)++,(_n_)++)\
111
+		for( _n_=0 ; (_p_)<(_end_) && isdigit((int)(unsigned char)*(_p_)) ; \
112
+				(_p_)++,(_n_)++)\
112 113
 			(_res_)=(_res_)*10+(*(_p_)-'0');\
113 114
 		if ((_n_)==0) {\
114 115
 			double_log( _err_s_ );\
... ...
@@ -289,7 +290,8 @@ static inline int parse_db_value( str *s, db_val_t *val, str **ret_s)
289 290
 		val->type = DB_DATETIME;
290 291
 		val->val.time_val = mktime( &td );
291 292
 		/*DBG("DBG: <%.*s> is %s\n",s->len,s->s,ctime(&val->val.time_val));*/
292
-	} else if ( (*(p=s->s)=='+') || (*p=='-') || isdigit(*p) ) {
293
+	} else if ( (*(p=s->s)=='+') || (*p=='-') || 
294
+				isdigit((int)(unsigned char)*p) ) {
293 295
 		/* can be a DB_INT / DB_DOUBLE / DB_BITMAP value */
294 296
 		if (sgn_str2float( s, &nr, &nr_type)!=0) {
295 297
 			double_log("Bad int/float value format (expected [+/-]nr[.nr])");
... ...
@@ -360,7 +362,7 @@ static inline int get_avps( FILE *fifo , db_key_t *keys, db_op_t *ops,
360 362
 {
361 363
 	str  line;
362 364
 	str  key,op,val;
363
-	char *c;
365
+	unsigned char *c;
364 366
 	str  *p_val;
365 367
 	int  sp_found;
366 368
 
... ...
@@ -383,12 +385,12 @@ static inline int get_avps( FILE *fifo , db_key_t *keys, db_op_t *ops,
383 385
 			/* parse the line key|op|val */
384 386
 			c = line.s;
385 387
 			/* parse the key name */
386
-			for( key.s=c ; *c && (isalnum(*c)||*c=='_') ; c++ );
388
+			for( key.s=c ; *c && (isalnum((int)*c)||*c=='_') ; c++ );
387 389
 			if (!*c) goto parse_error;
388
-			key.len = c-key.s;
390
+			key.len = (char*)c-key.s;
389 391
 			if (key.len==0) goto parse_error;
390 392
 			/* possible spaces? */
391
-			for( sp_found=0 ; *c && isspace(*c) ; c++,sp_found=1 );
393
+			for( sp_found=0 ; *c && isspace((int)*c) ; c++,sp_found=1 );
392 394
 			if (!*c) goto parse_error;
393 395
 			/* parse the operator */
394 396
 			op.s = c;
... ...
@@ -404,19 +406,19 @@ static inline int get_avps( FILE *fifo , db_key_t *keys, db_op_t *ops,
404 406
 					/* at least one space must be before unknown ops */
405 407
 					if(!sp_found) goto parse_error;
406 408
 					/* eat everything to first space */
407
-					for( ; *c && !isspace(*c) ; c++ );
408
-					if (!*c || c==op.s) goto parse_error; /* 0 length */
409
+					for( ; *c && !isspace((int)*c) ; c++ );
410
+					if (!*c || (char*)c==op.s) goto parse_error; /* 0 length */
409 411
 					/* include into operator str. one space before and after*/
410 412
 					op.s--;
411 413
 					c++;
412 414
 			}
413
-			op.len = c - op.s;
415
+			op.len = (char*)c - op.s;
414 416
 			/* possible spaces? */
415
-			for( ; *c && isspace(*c) ; c++ );
417
+			for( ; *c && isspace((int)*c) ; c++ );
416 418
 			if (!*c) goto parse_error;
417 419
 			/* get value */
418 420
 			val.s = c;
419
-			val.len = line.len - (c-line.s);
421
+			val.len = line.len - ((char*)c-line.s);
420 422
 			if (val.len==0) goto parse_error;
421 423
 			if (parse_db_value( &val, &vals[*nr], &p_val)!=0)
422 424
 				goto error;
... ...
@@ -451,7 +453,7 @@ static inline int get_avps( FILE *fifo , db_key_t *keys, db_op_t *ops,
451 453
 	}
452 454
 parse_error:
453 455
 	LOG(L_ERR,"ERROR:get_avps: parse error in \"%.*s\" at char [%d][%c] "
454
-		"offset %d\n",line.len,line.s,*c,*c, (unsigned)(c-line.s));
456
+		"offset %d\n",line.len,line.s,*c,*c, (unsigned)((char*)c-line.s));
455 457
 	double_log("Broken AVP(attr|op|val) in DB command");
456 458
 error:
457 459
 	for(;*nr;(*nr)--)