Checks if the file specified in FileName is a valid .jpg file.
| 100 | |
| 101 | //! Checks if the file specified in FileName is a valid .jpg file. |
| 102 | ILboolean 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. |
no test coverage detected