| 539 | |
| 540 | |
| 541 | ILboolean iPreCache(ILuint Size) |
| 542 | { |
| 543 | // Reading from a memory lump, so don't cache. |
| 544 | if (iread == iReadLump) { |
| 545 | //iUnCache(); // DW: Removed 06-10-2002. |
| 546 | return IL_TRUE; |
| 547 | } |
| 548 | |
| 549 | if (Cache) { |
| 550 | ifree(Cache); |
| 551 | } |
| 552 | |
| 553 | if (Size == 0) { |
| 554 | Size = 1; |
| 555 | } |
| 556 | |
| 557 | Cache = (ILubyte*)ialloc(Size); |
| 558 | if (Cache == NULL) { |
| 559 | return IL_FALSE; |
| 560 | } |
| 561 | |
| 562 | UseCache = IL_FALSE; |
| 563 | CacheStartPos = itell(); |
| 564 | CacheSize = iread(Cache, 1, Size); |
| 565 | if (CacheSize != Size) |
| 566 | ilGetError(); // Get rid of the IL_FILE_READ_ERROR. |
| 567 | |
| 568 | //2003-09-09: uncommented the following line to prevent |
| 569 | //an infinite loop in ilPreCache() |
| 570 | CacheSize = Size; |
| 571 | CachePos = 0; |
| 572 | UseCache = IL_TRUE; |
| 573 | CacheBytesRead = 0; |
| 574 | |
| 575 | return IL_TRUE; |
| 576 | } |
| 577 | |
| 578 | |
| 579 | void iUnCache() |
no outgoing calls
no test coverage detected