From 335d51033997771be04a1f6970dee7c4613661ce Mon Sep 17 00:00:00 2001 From: Brett Waldbaum Date: Thu, 7 Mar 2019 20:49:43 -0800 Subject: [PATCH] Build with /w4 --- src/CalcManager/CEngine/CalcInput.cpp | 2 +- src/CalcManager/CEngine/History.cpp | 4 +- src/CalcManager/CEngine/scidisp.cpp | 2 +- src/CalcManager/CalcException.h | 4 +- src/CalcManager/CalcManager.vcxproj | 16 +++++++ src/CalcManager/CalcManager.vcxproj.filters | 3 -- src/CalcManager/ExpressionCommand.cpp | 2 +- src/CalcManager/ExpressionCommand.h | 2 +- src/CalcManager/Header Files/CalcInput.h | 4 +- src/CalcManager/Ratpack/conv.cpp | 6 +-- src/CalcManager/Ratpack/rat.cpp | 2 +- src/CalcManager/Ratpack/ratpak.h | 2 +- src/CalcViewModel/CalcViewModel.vcxproj | 16 +++++++ src/CalcViewModel/Common/CopyPasteManager.cpp | 3 +- .../Common/KeyboardShortcutManager.cpp | 23 ++++----- .../Common/LocalizationSettings.h | 4 +- src/CalcViewModel/Common/TraceLogger.cpp | 6 +-- src/CalcViewModel/Common/TraceLogger.h | 6 +-- src/CalcViewModel/HistoryViewModel.cpp | 1 - .../StandardCalculatorViewModel.cpp | 48 +++++++++---------- src/Calculator/Calculator.vcxproj | 16 +++++++ 21 files changed, 104 insertions(+), 68 deletions(-) diff --git a/src/CalcManager/CEngine/CalcInput.cpp b/src/CalcManager/CEngine/CalcInput.cpp index f7037aa3..4994e025 100644 --- a/src/CalcManager/CEngine/CalcInput.cpp +++ b/src/CalcManager/CEngine/CalcInput.cpp @@ -261,7 +261,7 @@ void CalcInput::SetDecimalSymbol(wchar_t decSymbol) } } -wstring CalcInput::ToString(uint32_t radix, bool isIntegerMode) +wstring CalcInput::ToString(uint32_t radix) { // In theory both the base and exponent could be C_NUM_MAX_DIGITS long. wstringstream resStream; diff --git a/src/CalcManager/CEngine/History.cpp b/src/CalcManager/CEngine/History.cpp index fe14425d..c69dce9a 100644 --- a/src/CalcManager/CEngine/History.cpp +++ b/src/CalcManager/CEngine/History.cpp @@ -227,7 +227,7 @@ void CHistoryCollector::AddUnaryOpToHistory(int nOpCode, bool fInv, ANGLE_TYPE a { angleOpCode = CalculationManager::Command::CommandRAD; } - if (angletype == ANGLE_GRAD) + else // (angletype == ANGLE_GRAD) { angleOpCode = CalculationManager::Command::CommandGRAD; } @@ -428,7 +428,7 @@ void CHistoryCollector::UpdateHistoryExpression(uint32_t radix, int32_t precisio std::shared_ptr opndCommand = std::static_pointer_cast(expCommand); if (opndCommand != nullptr) { - token.first = opndCommand->GetString(radix, precision, m_decimalSymbol); + token.first = opndCommand->GetString(radix, precision); IFT(m_spTokens->SetAt(i, token)); opndCommand->SetCommands(GetOperandCommandsFromString(token.first)); } diff --git a/src/CalcManager/CEngine/scidisp.cpp b/src/CalcManager/CEngine/scidisp.cpp index 431a3990..e01cc239 100644 --- a/src/CalcManager/CEngine/scidisp.cpp +++ b/src/CalcManager/CEngine/scidisp.cpp @@ -104,7 +104,7 @@ void CCalcEngine::DisplayNum(void) if (m_bRecord) { // Display the string and return. - m_numberString = m_input.ToString(m_radix, m_fIntegerMode); + m_numberString = m_input.ToString(m_radix); } else { diff --git a/src/CalcManager/CalcException.h b/src/CalcManager/CalcException.h index 60d82bbb..e63b1837 100644 --- a/src/CalcManager/CalcException.h +++ b/src/CalcManager/CalcException.h @@ -1,7 +1,7 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -class CalcException : std::exception +class CalcException : public std::exception { public: CalcException(HRESULT hr) diff --git a/src/CalcManager/CalcManager.vcxproj b/src/CalcManager/CalcManager.vcxproj index 4455336c..4a098141 100644 --- a/src/CalcManager/CalcManager.vcxproj +++ b/src/CalcManager/CalcManager.vcxproj @@ -155,6 +155,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -169,6 +171,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -183,6 +187,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -197,6 +203,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -212,6 +220,8 @@ /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) _UNICODE;UNICODE;%(PreprocessorDefinitions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -226,6 +236,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -240,6 +252,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console @@ -254,6 +268,8 @@ true /Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions) $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true Console diff --git a/src/CalcManager/CalcManager.vcxproj.filters b/src/CalcManager/CalcManager.vcxproj.filters index 5ceff3e3..9be2a455 100644 --- a/src/CalcManager/CalcManager.vcxproj.filters +++ b/src/CalcManager/CalcManager.vcxproj.filters @@ -136,9 +136,6 @@ Header Files - - Header Files - diff --git a/src/CalcManager/ExpressionCommand.cpp b/src/CalcManager/ExpressionCommand.cpp index 393a4716..7227d808 100644 --- a/src/CalcManager/ExpressionCommand.cpp +++ b/src/CalcManager/ExpressionCommand.cpp @@ -287,7 +287,7 @@ const wstring & COpndCommand::GetToken(wchar_t decimalSymbol) return m_token; } -wstring COpndCommand::GetString(uint32_t radix, int32_t precision, wchar_t decimalSymbol) +wstring COpndCommand::GetString(uint32_t radix, int32_t precision) { wstring result{}; diff --git a/src/CalcManager/ExpressionCommand.h b/src/CalcManager/ExpressionCommand.h index 0953ab26..48c990c2 100644 --- a/src/CalcManager/ExpressionCommand.h +++ b/src/CalcManager/ExpressionCommand.h @@ -67,7 +67,7 @@ public: const std::wstring & GetToken(wchar_t decimalSymbol); CalculationManager::CommandType GetCommandType() const; void Accept(_In_ ISerializeCommandVisitor &commandVisitor); - std::wstring GetString(uint32_t radix, int32_t precision, wchar_t decimalSymbol); + std::wstring GetString(uint32_t radix, int32_t precision); private: std::shared_ptr> m_commands; diff --git a/src/CalcManager/Header Files/CalcInput.h b/src/CalcManager/Header Files/CalcInput.h index 0f86f4f5..4238e598 100644 --- a/src/CalcManager/Header Files/CalcInput.h +++ b/src/CalcManager/Header Files/CalcInput.h @@ -22,7 +22,7 @@ namespace CalcEngine bool IsEmpty() { return value.empty(); } bool IsNegative() { return m_isNegative; } - void IsNegative(bool value) { m_isNegative = value; } + void IsNegative(bool isNegative) { m_isNegative = isNegative; } std::wstring value; @@ -53,7 +53,7 @@ namespace CalcEngine bool TryBeginExponent(); void Backspace(); void SetDecimalSymbol(wchar_t decSymbol); - std::wstring ToString(uint32_t radix, bool isIntegerMode); + std::wstring ToString(uint32_t radix); Rational ToRational(uint32_t radix, int32_t precision); private: diff --git a/src/CalcManager/Ratpack/conv.cpp b/src/CalcManager/Ratpack/conv.cpp index f7112bb4..f0e51906 100644 --- a/src/CalcManager/Ratpack/conv.cpp +++ b/src/CalcManager/Ratpack/conv.cpp @@ -566,7 +566,7 @@ wchar_t NormalizeCharDigit(wchar_t c, uint32_t radix) // is in the range where this is not ambiguous. if (size_t{ radix } >= DIGITS.find(L'A') && size_t { radix } <= DIGITS.find(L'Z')) { - return toupper(c); + return towupper(c); } return c; @@ -1057,10 +1057,6 @@ wstring NumberToString(_Inout_ PNUMBER& pnum, int format, uint32_t radix, int32_ length = precision; } - // 2 for signs, 1 for 'e'(or leading zero), 1 for dp, 1 for null and - // 10 for maximum exponent size. - int cchNum = (precision + 16); - // If there is a chance a round has to occur, round. // - if number is zero no rounding // - if number of digits is less than the maximum output no rounding diff --git a/src/CalcManager/Ratpack/rat.cpp b/src/CalcManager/Ratpack/rat.cpp index 20751fe4..2d71dc24 100644 --- a/src/CalcManager/Ratpack/rat.cpp +++ b/src/CalcManager/Ratpack/rat.cpp @@ -38,7 +38,7 @@ using namespace std; // //----------------------------------------------------------------------------- -void gcdrat( PRAT *pa, uint32_t radix, int32_t precision) +void gcdrat( PRAT *pa, int32_t precision) { PNUMBER pgcd= nullptr; diff --git a/src/CalcManager/Ratpack/ratpak.h b/src/CalcManager/Ratpack/ratpak.h index f5a508ee..693380bc 100644 --- a/src/CalcManager/Ratpack/ratpak.h +++ b/src/CalcManager/Ratpack/ratpak.h @@ -424,7 +424,7 @@ extern void divrat( _Inout_ PRAT *pa, _In_ PRAT b, int32_t precision); extern void fracrat( _Inout_ PRAT *pa , uint32_t radix, int32_t precision); extern void factrat( _Inout_ PRAT *pa, uint32_t radix, int32_t precision); extern void modrat( _Inout_ PRAT *pa, _In_ PRAT b ); -extern void gcdrat( _Inout_ PRAT *pa, uint32_t radix, int32_t precision); +extern void gcdrat( _Inout_ PRAT *pa, int32_t precision); extern void intrat( _Inout_ PRAT *px, uint32_t radix, int32_t precision); extern void mulnum( _Inout_ PNUMBER *pa, _In_ PNUMBER b, uint32_t radix); extern void mulnumx( _Inout_ PNUMBER *pa, _In_ PNUMBER b ); diff --git a/src/CalcViewModel/CalcViewModel.vcxproj b/src/CalcViewModel/CalcViewModel.vcxproj index 33715487..e2e98ab9 100644 --- a/src/CalcViewModel/CalcViewModel.vcxproj +++ b/src/CalcViewModel/CalcViewModel.vcxproj @@ -154,6 +154,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -172,6 +174,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -190,6 +194,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -208,6 +214,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -226,6 +234,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -244,6 +254,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -262,6 +274,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console @@ -280,6 +294,8 @@ $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) 4453 /bigobj /await /std:c++17 %(AdditionalOptions) + Level4 + true Console diff --git a/src/CalcViewModel/Common/CopyPasteManager.cpp b/src/CalcViewModel/Common/CopyPasteManager.cpp index c8f9c5f0..d234cf44 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.cpp +++ b/src/CalcViewModel/Common/CopyPasteManager.cpp @@ -15,7 +15,6 @@ using namespace Windows::Foundation; using namespace Windows::System; using namespace Windows::ApplicationModel::DataTransfer; -size_t maxOperandLength; unsigned long long maxOperandNumber; String^ CopyPasteManager::supportedFormats[] = @@ -533,7 +532,7 @@ size_t CopyPasteManager::ProgrammerOperandLength(const wstring& operand, int num suffixes.insert(suffixes.end(), uintSuffixes.begin(), uintSuffixes.end()); wstring operandUpper = operand; - transform(operandUpper.begin(), operandUpper.end(), operandUpper.begin(), toupper); + transform(operandUpper.begin(), operandUpper.end(), operandUpper.begin(), towupper); // Detect if there is a suffix and subtract its length // Check suffixes first to allow e.g. "0b" to result in length 1 (value 0), rather than length 0 (no value). diff --git a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp index 248f65cc..977ca13d 100644 --- a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp +++ b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp @@ -43,7 +43,6 @@ static multimap> s_VirtualKeyControlS static multimap> s_VirtualKeyInverseChordsForButtons; static multimap> s_VirtualKeyControlInverseChordsForButtons; -static const TimeSpan c_lightUpTime = { 500000 }; // Quarter of a second static multimap s_ShiftKeyPressed; static multimap s_ControlKeyPressed; static multimap s_ShiftButtonChecked; @@ -83,11 +82,13 @@ namespace CalculatorApp // The button will go into the visual Pressed state with this call VisualStateManager::GoToState(button, "Pressed", true); - // This timer will fire after c_lightUpTime and make the button + // This timer will fire after lightUpTime and make the button // go back to the normal state. // This timer will only fire once after which it will be destroyed auto timer = ref new DispatcherTimer(); - timer->Interval = c_lightUpTime; + TimeSpan lightUpTime{}; + lightUpTime.Duration = 500000L; // Half second (in 100-ns units) + timer->Interval = lightUpTime; WeakReference timerWeakReference(timer); WeakReference buttonWeakReference(button); @@ -579,9 +580,9 @@ void KeyboardShortcutManager::OnKeyDownHandler(CoreWindow^ sender, KeyEventArgs^ // Writer lock for the static maps reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock); - auto currentControlKeyPressed = s_ControlKeyPressed.find(viewId); + auto currControlKeyPressed = s_ControlKeyPressed.find(viewId); - if (currentControlKeyPressed != s_ControlKeyPressed.end()) + if (currControlKeyPressed != s_ControlKeyPressed.end()) { s_ControlKeyPressed.erase(viewId); s_ControlKeyPressed.insert(std::make_pair(viewId, true)); @@ -593,9 +594,9 @@ void KeyboardShortcutManager::OnKeyDownHandler(CoreWindow^ sender, KeyEventArgs^ // Writer lock for the static maps reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock); - auto currentShiftKeyPressed = s_ShiftKeyPressed.find(viewId); + auto currShiftKeyPressed = s_ShiftKeyPressed.find(viewId); - if (currentShiftKeyPressed != s_ShiftKeyPressed.end()) + if (currShiftKeyPressed != s_ShiftKeyPressed.end()) { s_ShiftKeyPressed.erase(viewId); s_ShiftKeyPressed.insert(std::make_pair(viewId, true)); @@ -636,7 +637,7 @@ void KeyboardShortcutManager::OnKeyUpHandler(CoreWindow^ sender, KeyEventArgs^ a int viewId = Utils::GetWindowId(); auto key = args->VirtualKey; - if (args->VirtualKey == VirtualKey::Shift) + if (key == VirtualKey::Shift) { // Writer lock for the static maps reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock); @@ -649,14 +650,14 @@ void KeyboardShortcutManager::OnKeyUpHandler(CoreWindow^ sender, KeyEventArgs^ a s_ShiftKeyPressed.insert(std::make_pair(viewId, false)); } } - else if (args->VirtualKey == VirtualKey::Control) + else if (key == VirtualKey::Control) { // Writer lock for the static maps reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock); - auto currentControlKeyPressed = s_ControlKeyPressed.find(viewId); + auto currControlKeyPressed = s_ControlKeyPressed.find(viewId); - if (currentControlKeyPressed != s_ControlKeyPressed.end()) + if (currControlKeyPressed != s_ControlKeyPressed.end()) { s_ControlKeyPressed.erase(viewId); s_ControlKeyPressed.insert(std::make_pair(viewId, false)); diff --git a/src/CalcViewModel/Common/LocalizationSettings.h b/src/CalcViewModel/Common/LocalizationSettings.h index fe49a529..896a3157 100644 --- a/src/CalcViewModel/Common/LocalizationSettings.h +++ b/src/CalcViewModel/Common/LocalizationSettings.h @@ -177,11 +177,11 @@ namespace CalculatorApp Platform::String^ GetEnglishValueFromLocalizedDigits(const std::wstring& localizedString) const { - if (m_resolvedName == L"en-US") + if (!wcscmp(m_resolvedName, L"en-US")) { return ref new Platform::String(localizedString.c_str()); } - + size_t i = 0; size_t length = localizedString.size(); std::unique_ptr englishString(new wchar_t[length + 1]); // +1 for the null termination diff --git a/src/CalcViewModel/Common/TraceLogger.cpp b/src/CalcViewModel/Common/TraceLogger.cpp index 4be72abb..33e85437 100644 --- a/src/CalcViewModel/Common/TraceLogger.cpp +++ b/src/CalcViewModel/Common/TraceLogger.cpp @@ -156,7 +156,7 @@ namespace CalculatorApp } #pragma endregion - void TraceLogger::InsertIntoMemoryMap(int windowId, bool isStandard, bool isScientific, bool isProgrammer) + void TraceLogger::InsertIntoMemoryMap(int windowId, bool isScientific, bool isProgrammer) { // Writer lock for the static resources reader_writer_lock::scoped_lock lock(s_traceLoggerLock); @@ -182,7 +182,7 @@ namespace CalculatorApp } } - void TraceLogger::UpdateMemoryMap(int windowId, int memoryPosition, bool isStandard, bool isScientific, bool isProgrammer) + void TraceLogger::UpdateMemoryMap(int windowId, int memoryPosition, bool isScientific, bool isProgrammer) { // Writer lock for the static resources reader_writer_lock::scoped_lock lock(s_traceLoggerLock); @@ -867,7 +867,7 @@ namespace CalculatorApp } } - void TraceLogger::LogDateDifferenceModeUsed(int windowId) + void TraceLogger::LogDateDifferenceModeUsed() { if (!m_dateDiffUsageLoggedInSession) { diff --git a/src/CalcViewModel/Common/TraceLogger.h b/src/CalcViewModel/Common/TraceLogger.h index b0213b2c..e9ad412f 100644 --- a/src/CalcViewModel/Common/TraceLogger.h +++ b/src/CalcViewModel/Common/TraceLogger.h @@ -53,8 +53,8 @@ namespace CalculatorApp void LogModeChangeBegin(CalculatorApp::Common::ViewMode, CalculatorApp::Common::ViewMode, int); void LogModeChangeEnd(CalculatorApp::Common::ViewMode, int) const; void LogClearHistory() const; - void InsertIntoMemoryMap(int, bool, bool, bool); - void UpdateMemoryMap(int, int, bool, bool, bool); + void InsertIntoMemoryMap(int, bool, bool); + void UpdateMemoryMap(int, int, bool, bool); void DeleteFromMemoryMap(int, int); void LogMemoryUsed(int, unsigned int, bool, bool, bool, unsigned int) const; void LogMultipleMemoryUsed(unsigned int, unsigned int) const; @@ -91,7 +91,7 @@ namespace CalculatorApp void LogCoreWindowWasNull() const; // Trace methods for Date Calculator usage - void LogDateDifferenceModeUsed(int windowId); + void LogDateDifferenceModeUsed(); void LogDateAddSubtractModeUsed(int windowId, bool isAddMode); void LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today, winrt::Windows::Foundation::DateTime const& clippedTime) const; diff --git a/src/CalcViewModel/HistoryViewModel.cpp b/src/CalcViewModel/HistoryViewModel.cpp index 822aab03..169c7dfd 100644 --- a/src/CalcViewModel/HistoryViewModel.cpp +++ b/src/CalcViewModel/HistoryViewModel.cpp @@ -291,7 +291,6 @@ void HistoryViewModel::SaveHistory() // this serializes a history item into a base64 encoded string Platform::String^ HistoryViewModel::SerializeHistoryItem(_In_ std::shared_ptr const &item) { - HRESULT hr = S_OK; DataWriter^ writer = ref new DataWriter(); auto expr = item->historyItemVector.expression; auto result = item->historyItemVector.result; diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index c8b87071..617d7cea 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -178,7 +178,6 @@ String^ StandardCalculatorViewModel::CalculateNarratorDisplayValue(_In_ wstring String^ StandardCalculatorViewModel::GetNarratorStringReadRawNumbers(_In_ String^ localizedDisplayValue) { wstringstream wss; - RADIX_TYPE radix = static_cast(CurrentRadixType); auto& locSettings = LocalizationSettings::GetInstance(); // Insert a space after each digit in the string, to force Narrator to read them as separate numbers. @@ -426,50 +425,50 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) displayExpressionToken->CommandIndex = 0; } - wchar_t ch; + wchar_t ch = 0; if ((cmdenum >= Command::Command0) && (cmdenum <= Command::Command9)) { switch (cmdenum) { case Command::Command0: - ch = '0'; + ch = L'0'; break; case Command::Command1: - ch = '1'; + ch = L'1'; break; case Command::Command2: - ch = '2'; + ch = L'2'; break; case Command::Command3: - ch = '3'; + ch = L'3'; break; case Command::Command4: - ch = '4'; + ch = L'4'; break; case Command::Command5: - ch = '5'; + ch = L'5'; break; case Command::Command6: - ch = '6'; + ch = L'6'; break; case Command::Command7: - ch = '7'; + ch = L'7'; break; case Command::Command8: - ch = '8'; + ch = L'8'; break; case Command::Command9: - ch = '9'; + ch = L'9'; break; } } else if (cmdenum == Command::CommandPNT) { - ch = '.'; + ch = L'.'; } else if (cmdenum == Command::CommandBACK) { - ch = 'x'; + ch = L'x'; } else { @@ -486,7 +485,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) { //Clear older text; m_selectedExpressionLastData = L""; - if (ch == 'x') + if (ch == L'x') { temp = L'\0'; commandIndex = 0; @@ -501,7 +500,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) } else { - if (ch == 'x') + if (ch == L'x') { if (commandIndex == 0) { @@ -518,7 +517,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) } temp[i++] = data[j]; } - temp[i] = '\0'; + temp[i] = L'\0'; commandIndex -= 1; } else @@ -537,7 +536,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) } temp[i] = data[j++]; } - temp[i] = '\0'; + temp[i] = L'\0'; commandIndex += 1; } } @@ -567,7 +566,6 @@ void StandardCalculatorViewModel::OnButtonPressed(Object^ parameter) m_feedbackForButtonPress = CalculatorButtonPressedEventArgs::GetAuditoryFeedbackFromCommandParameter(parameter); NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter); Command cmdenum = ConvertToOperatorsEnum(numOpEnum); - bool isOperator = IsOperator(cmdenum); TraceLogger::GetInstance().UpdateFunctionUsage((int)numOpEnum); @@ -748,7 +746,6 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode) bool isFirstLegalChar = true; m_standardCalculatorManager.SendCommand(Command::CommandCENTR); bool sendNegate = false; - bool processedExp = false; bool processedDigit = false; bool sentEquals = false; bool isPreviousOperator = false; @@ -1016,7 +1013,7 @@ void StandardCalculatorViewModel::OnMemoryButtonPressed() m_standardCalculatorManager.MemorizeNumber(); int windowId = Utils::GetWindowId(); - TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); + TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsScientific, IsProgrammer); String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( CalculatorResourceKeys::MemorySave, @@ -1069,11 +1066,11 @@ void StandardCalculatorViewModel::OnMemoryAdd(Object^ memoryItemPosition) if (MemorizedNumbers->Size > 0) { TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); - TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer); + TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsScientific, IsProgrammer); } else { - TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); + TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsScientific, IsProgrammer); } m_standardCalculatorManager.MemorizedNumberAdd(boxedPosition->Value); } @@ -1090,11 +1087,11 @@ void StandardCalculatorViewModel::OnMemorySubtract(Object^ memoryItemPosition) if (MemorizedNumbers->Size > 0) { TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size); - TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer); + TraceLogger::GetInstance().UpdateMemoryMap(windowId, boxedPosition->Value, IsScientific, IsProgrammer); } else { - TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); + TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsScientific, IsProgrammer); } m_standardCalculatorManager.MemorizedNumberSubtract(boxedPosition->Value); } @@ -1371,7 +1368,6 @@ ANGLE_TYPE GetAngleTypeFromCommand(Command command) void StandardCalculatorViewModel::SaveEditedCommand(_In_ unsigned int tokenPosition, _In_ Command command) { pair token; - bool fNegative = false; bool handleOperand = false; int nOpCode = static_cast(command); wstring updatedToken = L""; diff --git a/src/Calculator/Calculator.vcxproj b/src/Calculator/Calculator.vcxproj index 60aef8f3..f29fd3d4 100644 --- a/src/Calculator/Calculator.vcxproj +++ b/src/Calculator/Calculator.vcxproj @@ -141,6 +141,8 @@ /bigobj /await /std:c++17 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true @@ -148,6 +150,8 @@ /bigobj /await /std:c++17 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true @@ -155,6 +159,8 @@ /bigobj /await /std:c++17 %(AdditionalOptions) 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true WindowsApp.lib;$(VC_ReferencesPath_VC_ARM)\pgort.lib;%(AdditionalDependencies) @@ -165,6 +171,8 @@ /bigobj /await /std:c++17 %(AdditionalOptions) 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true WindowsApp.lib;$(VC_ReferencesPath_VC_ARM)\pgort.lib;%(AdditionalDependencies) @@ -175,6 +183,8 @@ /bigobj /await /std:c++17 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true @@ -182,6 +192,8 @@ /bigobj /await /std:c++17 %(AdditionalOptions) 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true WindowsApp.lib;$(VC_ReferencesPath_VC_x86)\pgort.lib;%(AdditionalDependencies) @@ -192,6 +204,8 @@ /bigobj /await /std:c++17 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true @@ -199,6 +213,8 @@ /bigobj /await /std:c++17 %(AdditionalOptions) 4453;28204 $(SolutionDir)..\src\;%(AdditionalIncludeDirectories) + Level4 + true WindowsApp.lib;$(VC_ReferencesPath_VC_x64)\pgort.lib;%(AdditionalDependencies)