No need to invoke the compare method when we have an overloaded == operator. (#1091)

This commit is contained in:
pi1024e 2020-03-16 19:02:51 -04:00 committed by GitHub
parent d14423d0f1
commit 172bf08122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,9 +244,9 @@ Unit UnitConverter::StringToUnit(wstring_view w)
serializedUnit.name = Unquote(tokenList[1]); serializedUnit.name = Unquote(tokenList[1]);
serializedUnit.accessibleName = serializedUnit.name; serializedUnit.accessibleName = serializedUnit.name;
serializedUnit.abbreviation = Unquote(tokenList[2]); serializedUnit.abbreviation = Unquote(tokenList[2]);
serializedUnit.isConversionSource = (tokenList[3].compare(L"1") == 0); serializedUnit.isConversionSource = (tokenList[3] == L"1");
serializedUnit.isConversionTarget = (tokenList[4].compare(L"1") == 0); serializedUnit.isConversionTarget = (tokenList[4] == L"1");
serializedUnit.isWhimsical = (tokenList[5].compare(L"1") == 0); serializedUnit.isWhimsical = (tokenList[5] == L"1");
return serializedUnit; return serializedUnit;
} }
@ -256,7 +256,7 @@ Category UnitConverter::StringToCategory(wstring_view w)
assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT); assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT);
Category serializedCategory; Category serializedCategory;
serializedCategory.id = wcstol(Unquote(tokenList[0]).c_str(), nullptr, 10); serializedCategory.id = wcstol(Unquote(tokenList[0]).c_str(), nullptr, 10);
serializedCategory.supportsNegative = (tokenList[1].compare(L"1") == 0); serializedCategory.supportsNegative = (tokenList[1] == L"1");
serializedCategory.name = Unquote(tokenList[2]); serializedCategory.name = Unquote(tokenList[2]);
return serializedCategory; return serializedCategory;
} }
@ -896,7 +896,7 @@ void UnitConverter::Calculate()
else else
{ {
int currentNumberSignificantDigits = GetNumberDigits(m_currentDisplay); int currentNumberSignificantDigits = GetNumberDigits(m_currentDisplay);
int precision = 0; int precision;
if (abs(returnValue) < OPTIMALDECIMALALLOWED) if (abs(returnValue) < OPTIMALDECIMALALLOWED)
{ {
precision = MAXIMUMDIGITSALLOWED; precision = MAXIMUMDIGITSALLOWED;