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

Function ilIsValidJpeg

DevIL/src-IL/src/il_jpeg.cpp:102–127  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

100
101//! Checks if the file specified in FileName is a valid .jpg file.
102ILboolean ilIsValidJpeg(ILconst_string FileName)
103{
104 ILHANDLE JpegFile;
105 ILboolean bJpeg = IL_FALSE;
106
107 if (!iCheckExtension(FileName, IL_TEXT("jpg")) &&
108 !iCheckExtension(FileName, IL_TEXT("jpe")) &&
109 !iCheckExtension(FileName, IL_TEXT("jpeg")) &&
110 !iCheckExtension(FileName, IL_TEXT("jif")) &&
111 !iCheckExtension(FileName, IL_TEXT("jfif")))
112 {
113 ilSetError(IL_INVALID_EXTENSION);
114 return bJpeg;
115 }
116
117 JpegFile = iopenr(FileName);
118 if (JpegFile == NULL) {
119 ilSetError(IL_COULD_NOT_OPEN_FILE);
120 return bJpeg;
121 }
122
123 bJpeg = ilIsValidJpegF(JpegFile);
124 icloser(JpegFile);
125
126 return bJpeg;
127}
128
129
130//! Checks if the ILHANDLE contains a valid .jpg file at the current position.

Callers 1

ILAPIENTRY ilIsValidFunction · 0.85

Calls 3

iCheckExtensionFunction · 0.85
ilSetErrorFunction · 0.85
ilIsValidJpegFFunction · 0.85

Tested by

no test coverage detected