1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Fix compiler warnings (#1030)

Fixing the following compiler warnings:

FuseService.cpp: In function ‘int VeraCrypt::fuse_service_read(const char*, char*, size_t, off_t, fuse_file_info*)’:
FuseService.cpp:233:12: warning: catching polymorphic type ‘struct VeraCrypt::MissingVolumeData’ by value [-Wcatch-value=]
  233 |     catch (MissingVolumeData)
      |            ^~~~~~~~~~~~~~~~~
FuseService.cpp: In static member function ‘static int VeraCrypt::FuseService::ExceptionToErrorCode()’:
FuseService.cpp:362:15: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
  362 |   catch (std::bad_alloc)
      |               ^~~~~~~~~

Apart from warnings, the current code creates unnecessary copies of the exception object in debug mode. (But not in -O3)
This commit is contained in:
David
2023-05-18 23:12:01 +02:00
committed by GitHub
parent 1043bff967
commit ecb5ea9671

View File

@@ -230,7 +230,7 @@ namespace VeraCrypt
FuseService::ReadVolumeSectors (BufferPtr ((byte *) buf, size), offset); FuseService::ReadVolumeSectors (BufferPtr ((byte *) buf, size), offset);
} }
} }
catch (MissingVolumeData) catch (MissingVolumeData&)
{ {
return 0; return 0;
} }
@@ -359,7 +359,7 @@ namespace VeraCrypt
{ {
throw; throw;
} }
catch (std::bad_alloc) catch (std::bad_alloc&)
{ {
return -ENOMEM; return -ENOMEM;
} }