Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/ntp/libntp/atolfp.c
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | atolfp( | ||||
if (*cp == '+') | if (*cp == '+') | ||||
cp++; | cp++; | ||||
if (*cp != '.' && !isdigit((unsigned char)*cp)) | if (*cp != '.' && !isdigit((unsigned char)*cp)) | ||||
return 0; | return 0; | ||||
while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) { | while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) { | ||||
dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */ | dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */ | ||||
dec_i += (ind - digits); | dec_i += (u_long)(ind - digits); | ||||
cp++; | cp++; | ||||
} | } | ||||
if (*cp != '\0' && !isspace((unsigned char)*cp)) { | if (*cp != '\0' && !isspace((unsigned char)*cp)) { | ||||
if (*cp++ != '.') | if (*cp++ != '.') | ||||
return 0; | return 0; | ||||
while (ndec < 9 && *cp != '\0' | while (ndec < 9 && *cp != '\0' | ||||
&& (ind = strchr(digits, *cp)) != NULL) { | && (ind = strchr(digits, *cp)) != NULL) { | ||||
ndec++; | ndec++; | ||||
dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */ | dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */ | ||||
dec_f += (ind - digits); | dec_f += (u_long)(ind - digits); | ||||
cp++; | cp++; | ||||
} | } | ||||
while (isdigit((unsigned char)*cp)) | while (isdigit((unsigned char)*cp)) | ||||
cp++; | cp++; | ||||
if (*cp != '\0' && !isspace((unsigned char)*cp)) | if (*cp != '\0' && !isspace((unsigned char)*cp)) | ||||
return 0; | return 0; | ||||
Show All 31 Lines |