--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_This_Field(FIELD * field, | const void * argp) | | Description : Validate buffer content to be a valid numeric value | | Return Values : TRUE - field is valid | FALSE - field is i
| 178 | | FALSE - field is invalid |
| 179 | +--------------------------------------------------------------------------*/ |
| 180 | static bool |
| 181 | Check_This_Field(FIELD *field, const void *argp) |
| 182 | { |
| 183 | const thisARG *argn = (const thisARG *)argp; |
| 184 | double low = argn->low; |
| 185 | double high = argn->high; |
| 186 | int prec = argn->precision; |
| 187 | unsigned char *bp = (unsigned char *)field_buffer(field, 0); |
| 188 | char *s = (char *)bp; |
| 189 | double val = 0.0; |
| 190 | struct lconv *L = argn->L; |
| 191 | char buf[64]; |
| 192 | bool result = FALSE; |
| 193 | |
| 194 | while (*bp && *bp == ' ') |
| 195 | bp++; |
| 196 | if (*bp) |
| 197 | { |
| 198 | if (*bp == '-' || *bp == '+') |
| 199 | bp++; |
| 200 | #if USE_WIDEC_SUPPORT |
| 201 | if (*bp) |
| 202 | { |
| 203 | bool blank = FALSE; |
| 204 | int state = 0; |
| 205 | int len; |
| 206 | int n; |
| 207 | wchar_t *list = _nc_Widen_String((char *)bp, &len); |
| 208 | |
| 209 | if (list != 0) |
| 210 | { |
| 211 | result = TRUE; |
| 212 | for (n = 0; n < len; ++n) |
| 213 | { |
| 214 | if (blank) |
| 215 | { |
| 216 | if (list[n] != ' ') |
| 217 | { |
| 218 | result = FALSE; |
| 219 | break; |
| 220 | } |
| 221 | } |
| 222 | else if (list[n] == ' ') |
| 223 | { |
| 224 | blank = TRUE; |
| 225 | } |
| 226 | else if (isDecimalPoint(list[n])) |
| 227 | { |
| 228 | if (++state > 1) |
| 229 | { |
| 230 | result = FALSE; |
| 231 | break; |
| 232 | } |
| 233 | } |
| 234 | else if (!isDigit(list[n])) |
| 235 | { |
| 236 | result = FALSE; |
| 237 | break; |
nothing calls this directly
no test coverage detected