| 130 | } |
| 131 | |
| 132 | bool checkFileExtension(std::string_view fileName, const char* extension) { |
| 133 | const size_t extLen = strlen(extension); |
| 134 | if (fileName.length() < extLen) { |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | const size_t offset = fileName.length() - extLen; |
| 139 | for (size_t i = 0; i < extLen; i++) { |
| 140 | if (tolower(static_cast<unsigned char>(fileName[offset + i])) != |
| 141 | tolower(static_cast<unsigned char>(extension[i]))) { |
| 142 | return false; |
| 143 | } |
| 144 | } |
| 145 | return true; |
| 146 | } |
| 147 | |
| 148 | bool hasJpgExtension(std::string_view fileName) { |
| 149 | return checkFileExtension(fileName, ".jpg") || checkFileExtension(fileName, ".jpeg"); |
no outgoing calls
no test coverage detected