Fixing typo in StandardCalculatorViewModel::UpdatecommandsInRecording… (#810)
* Fixing typo in StandardCalculatorViewModel::UpdatecommandsInRecordingMode Removing unnecessary copy of vector in StandardCalculatorViewModel::UpdateCommandsInRecordingMode Using range-for in StandardCalculatorViewModel::UpdateCommandsInRecordingMode * Using static_cast instead of safe_cast for unsigned char to Command
This commit is contained in:
		
				
					committed by
					
						
						Matt Cooley
					
				
			
			
				
	
			
			
			
						parent
						
							582e10faed
						
					
				
				
					commit
					00346cc5a3
				
			@@ -1709,9 +1709,8 @@ void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
 | 
					void StandardCalculatorViewModel::UpdateCommandsInRecordingMode()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    vector<unsigned char> savedCommands = m_standardCalculatorManager.GetSavedCommands();
 | 
					 | 
				
			||||||
    shared_ptr<vector<int>> commands = make_shared<vector<int>>();
 | 
					    shared_ptr<vector<int>> commands = make_shared<vector<int>>();
 | 
				
			||||||
    bool isDecimal = false;
 | 
					    bool isDecimal = false;
 | 
				
			||||||
    bool isNegative = false;
 | 
					    bool isNegative = false;
 | 
				
			||||||
@@ -1719,12 +1718,9 @@ void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
 | 
				
			|||||||
    bool ePlusMode = false;
 | 
					    bool ePlusMode = false;
 | 
				
			||||||
    bool eMinusMode = false;
 | 
					    bool eMinusMode = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int num = 0;
 | 
					    for (const auto savedCommand : m_standardCalculatorManager.GetSavedCommands())
 | 
				
			||||||
    Command val;
 | 
					 | 
				
			||||||
    for (unsigned int i = 0; i < savedCommands.size(); ++i)
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        val = safe_cast<Command>(savedCommands[i]);
 | 
					        const Command val = static_cast<Command>(savedCommand);
 | 
				
			||||||
        num = static_cast<int>(val);
 | 
					 | 
				
			||||||
        if (val == Command::CommandSIGN)
 | 
					        if (val == Command::CommandSIGN)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            isNegative = true;
 | 
					            isNegative = true;
 | 
				
			||||||
@@ -1762,7 +1758,7 @@ void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
 | 
				
			|||||||
            commands->clear();
 | 
					            commands->clear();
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        commands->push_back(num);
 | 
					        commands->push_back(static_cast<int>(val));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!commands->empty())
 | 
					    if (!commands->empty())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ namespace CalculatorApp
 | 
				
			|||||||
        public:
 | 
					        public:
 | 
				
			||||||
            StandardCalculatorViewModel();
 | 
					            StandardCalculatorViewModel();
 | 
				
			||||||
            void UpdateOperand(int pos, Platform::String ^ text);
 | 
					            void UpdateOperand(int pos, Platform::String ^ text);
 | 
				
			||||||
            void UpdatecommandsInRecordingMode();
 | 
					            void UpdateCommandsInRecordingMode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
 | 
					            OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
 | 
				
			||||||
            OBSERVABLE_PROPERTY_RW(Platform::String ^, DisplayValue);
 | 
					            OBSERVABLE_PROPERTY_RW(Platform::String ^, DisplayValue);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user