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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user