mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Prevented unneeded copies from being made.
Removed an unneeded catch
This commit is contained in:
parent
b8e5e22d11
commit
b6b4f41f53
1 changed files with 4 additions and 11 deletions
|
@ -20,7 +20,7 @@ String^ CopyPasteManager::supportedFormats[] =
|
||||||
StandardDataFormats::Text
|
StandardDataFormats::Text
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr wstring_view c_validCharacterSet{ L"0123456789()+-*/.abcdefABCDEF" };
|
static constexpr wstring_view c_validCharacterSet{ L"0123456789()+-*/.abcdefABCDEF" };
|
||||||
|
|
||||||
// The below values can not be "constexpr"-ed,
|
// The below values can not be "constexpr"-ed,
|
||||||
// as both wstring_view and wchar[] can not be concatenated
|
// as both wstring_view and wchar[] can not be concatenated
|
||||||
|
@ -269,10 +269,7 @@ bool CopyPasteManager::ExpressionRegExMatch(vector<wstring> operands, ViewMode m
|
||||||
bool expMatched = true;
|
bool expMatched = true;
|
||||||
vector<wregex> patterns{};
|
vector<wregex> patterns{};
|
||||||
|
|
||||||
// Could this be auto?
|
const auto [maxOperandLength, maxOperandValue] = GetMaxOperandLengthAndValue(mode, modeType, programmerNumberBase, bitLengthType);
|
||||||
pair<size_t, uint64_t> operandLimits = GetMaxOperandLengthAndValue(mode, modeType, programmerNumberBase, bitLengthType);
|
|
||||||
size_t maxOperandLength = operandLimits.first;
|
|
||||||
uint64_t maxOperandValue = operandLimits.second;
|
|
||||||
|
|
||||||
if (mode == ViewMode::Standard)
|
if (mode == ViewMode::Standard)
|
||||||
{
|
{
|
||||||
|
@ -442,15 +439,11 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
|
||||||
result = stoull(operand, &size, intBase);
|
result = stoull(operand, &size, intBase);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (invalid_argument)
|
catch (const invalid_argument&)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
catch (out_of_range)
|
catch (const out_of_range&)
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue