| 262 | |
| 263 | |
| 264 | ILint XpmGets(ILubyte *Buffer, ILint MaxLen) |
| 265 | { |
| 266 | ILint Size, i, j; |
| 267 | ILboolean NotComment = IL_FALSE, InsideComment = IL_FALSE; |
| 268 | |
| 269 | do { |
| 270 | Size = XpmGetsInternal(Buffer, MaxLen); |
| 271 | if (Size == IL_EOF) |
| 272 | return IL_EOF; |
| 273 | |
| 274 | //skip leading whitespace (sometimes there's whitespace |
| 275 | //before a comment or before the pixel data) |
| 276 | |
| 277 | for(i = 0; i < Size && isspace(Buffer[i]); ++i) ; |
| 278 | Size = Size - i; |
| 279 | for(j = 0; j < Size; ++j) |
| 280 | Buffer[j] = Buffer[j + i]; |
| 281 | |
| 282 | if (Size == 0) |
| 283 | continue; |
| 284 | |
| 285 | if (Buffer[0] == '/' && Buffer[1] == '*') { |
| 286 | for (i = 2; i < Size; i++) { |
| 287 | if (Buffer[i] == '*' && Buffer[i+1] == '/') { |
| 288 | break; |
| 289 | } |
| 290 | } |
| 291 | if (i >= Size) |
| 292 | InsideComment = IL_TRUE; |
| 293 | } |
| 294 | else if (InsideComment) { |
| 295 | for (i = 0; i < Size; i++) { |
| 296 | if (Buffer[i] == '*' && Buffer[i+1] == '/') { |
| 297 | break; |
| 298 | } |
| 299 | } |
| 300 | if (i < Size) |
| 301 | InsideComment = IL_FALSE; |
| 302 | } |
| 303 | else { |
| 304 | NotComment = IL_TRUE; |
| 305 | } |
| 306 | } while (!NotComment); |
| 307 | |
| 308 | return Size; |
| 309 | } |
| 310 | |
| 311 | |
| 312 | ILint XpmGetInt(ILubyte *Buffer, ILint Size, ILint *Position) |
no test coverage detected