Add kerFileAccessDisabled error code

This can be thrown anywhere a file operation is not permitted because
exiv2 has been build with EXV_ENABLE_FILESYSTEM off.

(cherry picked from commit 5fb8c65ac2109e961af3ac1a7428655e15d60bee)
main
Jim Easterbrook 11 months ago committed by Miloš Komarčević
parent 069de70654
commit ee783c9db2

@ -224,6 +224,7 @@ enum class ErrorCode {
kerArithmeticOverflow,
kerMallocFailed,
kerInvalidIconvEncoding,
kerFileAccessDisabled,
kerErrorCount,
};

@ -90,6 +90,7 @@ constexpr std::array errList{
N_("Arithmetic operation overflow"), // kerArithmeticOverflow
N_("Memory allocation failed"), // kerMallocFailed
N_("Cannot convert text encoding from '%1' to '%2'"), // kerInvalidIconvEncoding
N_("%1: File access disabled in exiv2 build options"), // kerFileOpenFailed %1=path
};
static_assert(errList.size() == static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount),
"errList needs to contain a error msg for every ErrorCode defined in error.hpp");

@ -831,7 +831,7 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse
return std::make_unique<FileIo>(path);
#else
throw Error(ErrorCode::kerFileOpenFailed, path, "", "file access disabled");
throw Error(ErrorCode::kerFileAccessDisabled, path);
#endif
} // ImageFactory::createIo

Loading…
Cancel
Save