mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
A few odds and ends
Optimized one loop, added a default catch
This commit is contained in:
parent
934f5498c8
commit
615df85c75
1 changed files with 7 additions and 3 deletions
|
@ -429,7 +429,7 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
|
||||||
case BinBase:
|
case BinBase:
|
||||||
intBase = 2;
|
intBase = 2;
|
||||||
break;
|
break;
|
||||||
case DecBase:
|
case DecBase: // Unneeded as the default is already 10?
|
||||||
intBase = 10;
|
intBase = 10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -448,6 +448,10 @@ bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, u
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -472,13 +476,13 @@ size_t CopyPasteManager::OperandLength(wstring operand, ViewMode mode, CategoryG
|
||||||
|
|
||||||
size_t CopyPasteManager::StandardScientificOperandLength(wstring operand)
|
size_t CopyPasteManager::StandardScientificOperandLength(wstring operand)
|
||||||
{
|
{
|
||||||
|
// Loop until a decimal is found or if the end is reached
|
||||||
bool hasDecimal = false;
|
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'.')
|
if (operand[i] == L'.')
|
||||||
{
|
{
|
||||||
hasDecimal = true;
|
hasDecimal = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue