A few odds and ends

Optimized one loop, added a default catch
This commit is contained in:
Nicholas Baron 2019-03-25 23:08:25 -07:00
commit 615df85c75

View file

@ -429,7 +429,7 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
case BinBase:
intBase = 2;
break;
case DecBase:
case DecBase: // Unneeded as the default is already 10?
intBase = 10;
break;
}
@ -448,6 +448,10 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
{
// Do nothing
}
catch(...)
{
// Do nothing
}
return false;
}
@ -472,13 +476,13 @@ size_t CopyPasteManager::OperandLength(wstring operand, ViewMode mode, CategoryG
size_t CopyPasteManager::StandardScientificOperandLength(wstring operand)
{
// Loop until a decimal is found or if the end is reached
bool hasDecimal = false;
for (size_t i = 0; i < operand.length(); i++)
for (size_t i = 0; i < operand.length() && !hasDecimal; i++)
{
if (operand[i] == L'.')
{
hasDecimal = true;
break;
}
}