mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-23 19:43:27 +01:00
Fix warnings and throwing an exception instead of ignoring the error (#1229)
* EMVCard.cpp: ArrayToHexWideString: prohibit conversion of a string constant
../Common/EMVCard.cpp: In function 'std::wstring VeraCrypt::ArrayToHexWideString(con
st unsigned char*, size_t)':
../Common/EMVCard.cpp:28:43: warning: ISO C++ forbids converting a string constant
to 'wchar_t*' [-Wwrite-strings]
28 | static wchar_t* hexChar = L"0123456789ABCDEF";
| ^~~~~~~~~~~~~~~~~~~
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
* EMVCard.cpp: ArrayToHexWideString: fix of the comparison of different types
../Common/EMVCard.cpp: In function 'std::wstring VeraCrypt::ArrayToHexWideString(con
st unsigned char*, size_t)':
../Common/EMVCard.cpp:32:43: warning: comparison of integer expressions of different
signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int i = 0; i < cbData; i++)
| ~~^~~~~~~~
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
* SecurityTokenKeyfilesDialog.cpp: removed initialization of an unused variable
Forms/SecurityTokenKeyfilesDialog.cpp:58:24: warning: unused variable 'i' [-Wunused-
variable]
58 | size_t i = 0;
| ^
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
* Core/Unix: throwing an exception instead of ignoring the error
Fixes: 5a6b445f
("fix warnings and UB (#1164)")
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---------
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Co-authored-by: Vasiliy Kovalev <kovalev@altlinux.org>
This commit is contained in:
parent
c91e5792ef
commit
847abb23f0
@ -25,11 +25,11 @@ namespace VeraCrypt
|
|||||||
#ifndef TC_WINDOWS
|
#ifndef TC_WINDOWS
|
||||||
wstring ArrayToHexWideString(const unsigned char * pbData, size_t cbData)
|
wstring ArrayToHexWideString(const unsigned char * pbData, size_t cbData)
|
||||||
{
|
{
|
||||||
static wchar_t* hexChar = L"0123456789ABCDEF";
|
static const wchar_t* hexChar = L"0123456789ABCDEF";
|
||||||
wstring result;
|
wstring result;
|
||||||
if (pbData)
|
if (pbData)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < cbData; i++)
|
for (size_t i = 0; i < cbData; i++)
|
||||||
{
|
{
|
||||||
result += hexChar[pbData[i] >> 4];
|
result += hexChar[pbData[i] >> 4];
|
||||||
result += hexChar[pbData[i] & 0x0F];
|
result += hexChar[pbData[i] & 0x0F];
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
#include "Driver/Fuse/FuseService.h"
|
#include "Driver/Fuse/FuseService.h"
|
||||||
#include "Volume/VolumePasswordCache.h"
|
#include "Volume/VolumePasswordCache.h"
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline void ignore_result(const T & /* unused result */) {}
|
|
||||||
|
|
||||||
namespace VeraCrypt
|
namespace VeraCrypt
|
||||||
{
|
{
|
||||||
#ifdef TC_LINUX
|
#ifdef TC_LINUX
|
||||||
@ -694,7 +691,7 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ignore_result(chown (mountPoint.c_str(), GetRealUserId(), GetRealGroupId()));
|
throw_sys_sub_if (chown (mountPoint.c_str(), GetRealUserId(), GetRealGroupId()) == -1, mountPoint);
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ namespace VeraCrypt
|
|||||||
SecurityTokenKeyfileListCtrl->DeleteAllItems();
|
SecurityTokenKeyfileListCtrl->DeleteAllItems();
|
||||||
SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().EMVSupportEnabled);
|
SecurityTokenKeyfileList = Token::GetAvailableKeyfiles(Gui->GetPreferences().EMVSupportEnabled);
|
||||||
|
|
||||||
size_t i = 0;
|
|
||||||
foreach (const shared_ptr<TokenKeyfile> key, SecurityTokenKeyfileList)
|
foreach (const shared_ptr<TokenKeyfile> key, SecurityTokenKeyfileList)
|
||||||
{
|
{
|
||||||
vector <wstring> fields (SecurityTokenKeyfileListCtrl->GetColumnCount());
|
vector <wstring> fields (SecurityTokenKeyfileListCtrl->GetColumnCount());
|
||||||
|
Loading…
Reference in New Issue
Block a user