--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_Enum_Field( | FIELD * field, | const void * argp) | | Description : Validate buffer content to be a valid enumeration value | | Return Values : TRUE - field is valid
| 159 | | FALSE - field is invalid |
| 160 | +--------------------------------------------------------------------------*/ |
| 161 | static bool Check_Enum_Field(FIELD * field, const void * argp) |
| 162 | { |
| 163 | char **kwds = ((const enumARG *)argp)->kwds; |
| 164 | bool ccase = ((const enumARG *)argp)->checkcase; |
| 165 | bool unique = ((const enumARG *)argp)->checkunique; |
| 166 | unsigned char *bp = (unsigned char *)field_buffer(field,0); |
| 167 | char *s, *t, *p; |
| 168 | int res; |
| 169 | |
| 170 | while( kwds && (s=(*kwds++)) ) |
| 171 | { |
| 172 | if ((res=Compare((unsigned char *)s,bp,ccase))!=NOMATCH) |
| 173 | { |
| 174 | p=t=s; /* t is at least a partial match */ |
| 175 | if ((unique && res!=EXACT)) |
| 176 | { |
| 177 | while( kwds && (p = *kwds++) ) |
| 178 | { |
| 179 | if ((res=Compare((unsigned char *)p,bp,ccase))!=NOMATCH) |
| 180 | { |
| 181 | if (res==EXACT) |
| 182 | { |
| 183 | t = p; |
| 184 | break; |
| 185 | } |
| 186 | else |
| 187 | t = (char *)0; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | if (t) |
| 192 | { |
| 193 | set_field_buffer(field,0,t); |
| 194 | return TRUE; |
| 195 | } |
| 196 | if (!p) |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | return FALSE; |
| 201 | } |
| 202 | |
| 203 | static const char *dummy[] = { (char *)0 }; |
| 204 |
nothing calls this directly
no test coverage detected
searching dependent graphs…