Build with /W4 (#197)
All projects are built with warning level 4 (/W4) and treat warnings as errors (/WX). Fixed build errors resulting from enabling these compiler flags.
This commit is contained in:
@@ -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;
|
||||
|
@@ -223,11 +223,11 @@ void CHistoryCollector::AddUnaryOpToHistory(int nOpCode, bool fInv, ANGLE_TYPE a
|
||||
{
|
||||
angleOpCode = CalculationManager::Command::CommandDEG;
|
||||
}
|
||||
if (angletype == ANGLE_RAD)
|
||||
else if (angletype == ANGLE_RAD)
|
||||
{
|
||||
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<COpndCommand> opndCommand = std::static_pointer_cast<COpndCommand>(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));
|
||||
}
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -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)
|
||||
|
@@ -155,6 +155,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -169,6 +171,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -183,6 +187,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -197,6 +203,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -212,6 +220,8 @@
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -226,6 +236,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -240,6 +252,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -254,6 +268,8 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@@ -136,9 +136,6 @@
|
||||
<ClInclude Include="Header Files\History.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Header Files\scimath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UnitConverter.h" />
|
||||
<ClInclude Include="CalculatorHistory.h" />
|
||||
<ClInclude Include="CalculatorManager.h" />
|
||||
|
@@ -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{};
|
||||
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
const std::wstring & GetToken(wchar_t decimalSymbol) override;
|
||||
CalculationManager::CommandType GetCommandType() const override;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||
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<CalculatorVector<int>> m_commands;
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user