mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -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:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue