libcamera: file: Turn MapFlag and OpenModeFlag into enum class

Add type safety by turning the MapFlag and OpenModeFlag enum into enum
class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart
2021-08-03 10:55:33 +03:00
parent 91d06ae2fc
commit 6a8582dc20
6 changed files with 46 additions and 43 deletions
+3 -3
View File
@@ -275,7 +275,7 @@ IPAModule::~IPAModule()
int IPAModule::loadIPAModuleInfo()
{
File file{ libPath_ };
if (!file.open(File::ReadOnly)) {
if (!file.open(File::OpenModeFlag::ReadOnly)) {
LOG(IPAModule, Error) << "Failed to open IPA library: "
<< strerror(-file.error());
return file.error();
@@ -317,13 +317,13 @@ int IPAModule::loadIPAModuleInfo()
/* Load the signature. Failures are not fatal. */
File sign{ libPath_ + ".sign" };
if (!sign.open(File::ReadOnly)) {
if (!sign.open(File::OpenModeFlag::ReadOnly)) {
LOG(IPAModule, Debug)
<< "IPA module " << libPath_ << " is not signed";
return 0;
}
data = sign.map(0, -1, File::MapPrivate);
data = sign.map(0, -1, File::MapFlag::Private);
signature_.resize(data.size());
memcpy(signature_.data(), data.data(), data.size());