MCPcopy Create free account
hub / github.com/DentonW/DevIL / iPreCache

Function iPreCache

DevIL/src-IL/src/il_files.cpp:541–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539
540
541ILboolean 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
579void iUnCache()

Callers 10

iReadNonRleSgiFunction · 0.85
ILAPIENTRY iGetcFileFunction · 0.85
ILAPIENTRY iReadFileFunction · 0.85
iUncompressDcxFunction · 0.85
ReadCompressedChannelFunction · 0.85
iUncompressTgaDataFunction · 0.85
iUncompressPcxFunction · 0.85
iUncompressSmallFunction · 0.85
ilReadUncompBmpFunction · 0.85
iLoadHdrInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected