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

Linux/MacOSX: first dynamic mode implementation

This commit is contained in:
Mounir IDRASSI
2015-06-24 14:14:34 +02:00
parent f927ce9b58
commit 9913af3a8e
37 changed files with 680 additions and 105 deletions

View File

@@ -259,6 +259,30 @@ namespace VeraCrypt
if (ss.fail() || n == 0xffffFFFFU)
throw ParameterIncorrect (SRC_POS);
return n;
}
int32 StringConverter::ToInt32 (const string &str)
{
int32 n;
stringstream ss (str);
ss >> n;
if (ss.fail() || n == 0x7fffFFFF || n == -0x7fffFFFF)
throw ParameterIncorrect (SRC_POS);
return n;
}
int32 StringConverter::ToInt32 (const wstring &str)
{
int32 n;
wstringstream ss (str);
ss >> n;
if (ss.fail() || n == 0x7fffFFFF || n == -0x7fffFFFF)
throw ParameterIncorrect (SRC_POS);
return n;
}
@@ -283,6 +307,30 @@ namespace VeraCrypt
if (ss.fail() || n == 0xffffFFFFffffFFFFULL)
throw ParameterIncorrect (SRC_POS);
return n;
}
int64 StringConverter::ToInt64 (const string &str)
{
int64 n;
stringstream ss (str);
ss >> n;
if (ss.fail() || n == 0x7fffFFFFffffFFFFLL || n == -0x7fffFFFFffffFFFFLL)
throw ParameterIncorrect (SRC_POS);
return n;
}
int64 StringConverter::ToInt64 (const wstring &str)
{
int64 n;
wstringstream ss (str);
ss >> n;
if (ss.fail() || n == 0x7fffFFFFffffFFFFLL || n == -0x7fffFFFFffffFFFFLL)
throw ParameterIncorrect (SRC_POS);
return n;
}