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

Function ilIsValidPnm

DevIL/src-IL/src/il_pnm.cpp:33–56  ·  view source on GitHub ↗

Checks if the file specified in FileName is a valid .pnm file.

Source from the content-addressed store, hash-verified

31
32//! Checks if the file specified in FileName is a valid .pnm file.
33ILboolean ilIsValidPnm(ILconst_string FileName)
34{
35 ILHANDLE PnmFile;
36 ILboolean bPnm = IL_FALSE;
37
38 if ( !iCheckExtension(FileName, IL_TEXT("pbm"))
39 && !iCheckExtension(FileName, IL_TEXT("pgm"))
40 && !iCheckExtension(FileName, IL_TEXT("ppm"))
41 && !iCheckExtension(FileName, IL_TEXT("pnm"))) {
42 ilSetError(IL_INVALID_EXTENSION);
43 return bPnm;
44 }
45
46 PnmFile = iopenr(FileName);
47 if (PnmFile == NULL) {
48 ilSetError(IL_COULD_NOT_OPEN_FILE);
49 return bPnm;
50 }
51
52 bPnm = ilIsValidPnmF(PnmFile);
53 icloser(PnmFile);
54
55 return bPnm;
56}
57
58
59//! Checks if the ILHANDLE contains a valid .pnm file at the current position.

Callers 1

ILAPIENTRY ilIsValidFunction · 0.85

Calls 3

iCheckExtensionFunction · 0.85
ilSetErrorFunction · 0.85
ilIsValidPnmFFunction · 0.85

Tested by

no test coverage detected