mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Replace DWORD -> uint32_t
This commit is contained in:
parent
3a85bbe244
commit
358b9a8599
9 changed files with 56 additions and 56 deletions
|
@ -100,7 +100,7 @@ namespace CalcEngine
|
|||
addrat(&lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -123,7 +123,7 @@ namespace CalcEngine
|
|||
subrat(&lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -146,7 +146,7 @@ namespace CalcEngine
|
|||
mulrat(&lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -169,7 +169,7 @@ namespace CalcEngine
|
|||
divrat(&lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -192,7 +192,7 @@ namespace CalcEngine
|
|||
modrat(&lhsRat, rhsRat);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -215,7 +215,7 @@ namespace CalcEngine
|
|||
lshrat(&lhsRat, rhsRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -238,7 +238,7 @@ namespace CalcEngine
|
|||
rshrat(&lhsRat, rhsRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -261,7 +261,7 @@ namespace CalcEngine
|
|||
andrat(&lhsRat, rhsRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -283,7 +283,7 @@ namespace CalcEngine
|
|||
orrat(&lhsRat, rhsRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -305,7 +305,7 @@ namespace CalcEngine
|
|||
xorrat(&lhsRat, rhsRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -388,7 +388,7 @@ namespace CalcEngine
|
|||
{
|
||||
result = rat_equ(lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -416,7 +416,7 @@ namespace CalcEngine
|
|||
{
|
||||
result = rat_lt(lhsRat, rhsRat, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(lhsRat);
|
||||
destroyrat(rhsRat);
|
||||
|
@ -453,7 +453,7 @@ namespace CalcEngine
|
|||
{
|
||||
result = RatToString(rat, fmt, radix, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(rat);
|
||||
throw(error);
|
||||
|
@ -472,7 +472,7 @@ namespace CalcEngine
|
|||
{
|
||||
result = rattoUlonglong(rat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(rat);
|
||||
throw(error);
|
||||
|
|
|
@ -14,7 +14,7 @@ Rational RationalMath::Frac(Rational const& rat)
|
|||
{
|
||||
fracrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -33,7 +33,7 @@ Rational RationalMath::Integer(Rational const& rat)
|
|||
{
|
||||
intrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -55,7 +55,7 @@ Rational RationalMath::Pow(Rational const& base, Rational const& pow)
|
|||
powrat(&baseRat, powRat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
destroyrat(powRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(baseRat);
|
||||
destroyrat(powRat);
|
||||
|
@ -81,7 +81,7 @@ Rational RationalMath::Fact(Rational const& rat)
|
|||
{
|
||||
factrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -101,7 +101,7 @@ Rational RationalMath::Exp(Rational const& rat)
|
|||
{
|
||||
exprat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -121,7 +121,7 @@ Rational RationalMath::Log(Rational const& rat)
|
|||
{
|
||||
lograt(&prat, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -156,7 +156,7 @@ Rational RationalMath::Sin(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
sinanglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -176,7 +176,7 @@ Rational RationalMath::Cos(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
cosanglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -196,7 +196,7 @@ Rational RationalMath::Tan(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
tananglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -216,7 +216,7 @@ Rational RationalMath::ASin(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
asinanglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -236,7 +236,7 @@ Rational RationalMath::ACos(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
acosanglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -256,7 +256,7 @@ Rational RationalMath::ATan(Rational const& rat, ANGLE_TYPE angletype)
|
|||
{
|
||||
atananglerat(&prat, angletype, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -276,7 +276,7 @@ Rational RationalMath::Sinh(Rational const& rat)
|
|||
{
|
||||
sinhrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -296,7 +296,7 @@ Rational RationalMath::Cosh(Rational const& rat)
|
|||
{
|
||||
coshrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -316,7 +316,7 @@ Rational RationalMath::Tanh(Rational const& rat)
|
|||
{
|
||||
tanhrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -336,7 +336,7 @@ Rational RationalMath::ASinh(Rational const& rat)
|
|||
{
|
||||
asinhrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -356,7 +356,7 @@ Rational RationalMath::ACosh(Rational const& rat)
|
|||
{
|
||||
acoshrat(&prat, RATIONAL_BASE, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
@ -376,7 +376,7 @@ Rational RationalMath::ATanh(Rational const& rat)
|
|||
{
|
||||
atanhrat(&prat, RATIONAL_PRECISION);
|
||||
}
|
||||
catch (DWORD error)
|
||||
catch (uint32_t error)
|
||||
{
|
||||
destroyrat(prat);
|
||||
throw(error);
|
||||
|
|
|
@ -326,7 +326,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
}
|
||||
}
|
||||
|
||||
m_currentVal = SciCalcFunctions(m_currentVal, (DWORD)wParam);
|
||||
m_currentVal = SciCalcFunctions(m_currentVal, (uint32_t)wParam);
|
||||
|
||||
if (m_bError)
|
||||
return;
|
||||
|
@ -366,7 +366,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
|
||||
CheckAndAddLastBinOpToHistory();
|
||||
|
||||
if (TryToggleBit(m_currentVal, (DWORD)wParam - IDC_BINEDITSTART))
|
||||
if (TryToggleBit(m_currentVal, (uint32_t)wParam - IDC_BINEDITSTART))
|
||||
{
|
||||
DisplayNum();
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ wstring CCalcEngine::GetStringForDisplay(Rational const& rat, uint32_t radix)
|
|||
|
||||
result = tempRat.ToString(radix, m_nFE, m_precision);
|
||||
}
|
||||
catch (DWORD)
|
||||
catch (uint32_t)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace CalcEngine;
|
|||
using namespace CalcEngine::RationalMath;
|
||||
|
||||
/* Routines for more complex mathematical functions/error checking. */
|
||||
CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& rat, DWORD op)
|
||||
CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& rat, uint32_t op)
|
||||
{
|
||||
Rational result{};
|
||||
try
|
||||
|
@ -205,7 +205,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
}
|
||||
} // end switch( op )
|
||||
}
|
||||
catch (DWORD nErrCode)
|
||||
catch (uint32_t nErrCode)
|
||||
{
|
||||
DisplayError(nErrCode);
|
||||
result = rat;
|
||||
|
@ -215,9 +215,9 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||
}
|
||||
|
||||
/* Routine to display error messages and set m_bError flag. Errors are */
|
||||
/* called with DisplayError (n), where n is a DWORD between 0 and 5. */
|
||||
/* called with DisplayError (n), where n is a uint32_t between 0 and 5. */
|
||||
|
||||
void CCalcEngine::DisplayError(DWORD nError)
|
||||
void CCalcEngine::DisplayError(uint32_t nError)
|
||||
{
|
||||
wstring errorString{ GetString(IDS_ERRORS_FIRST + SCODE_CODE(nError)) };
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||
break;
|
||||
}
|
||||
}
|
||||
catch (DWORD dwErrCode)
|
||||
catch (uint32_t dwErrCode)
|
||||
{
|
||||
DisplayError(dwErrCode);
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ uint32_t CCalcEngine::NRadixFromRadixType(RADIX_TYPE radixtype)
|
|||
}
|
||||
|
||||
// Toggles a given bit into the number representation. returns true if it changed it actually.
|
||||
bool CCalcEngine::TryToggleBit(CalcEngine::Rational& rat, DWORD wbitno)
|
||||
bool CCalcEngine::TryToggleBit(CalcEngine::Rational& rat, uint32_t wbitno)
|
||||
{
|
||||
DWORD wmax = DwWordBitWidthFromeNumWidth(m_numwidth);
|
||||
uint32_t wmax = DwWordBitWidthFromeNumWidth(m_numwidth);
|
||||
if (wbitno >= wmax)
|
||||
{
|
||||
return false; // ignore error cant happen
|
||||
|
|
|
@ -53,7 +53,7 @@ class CCalcEngine {
|
|||
public:
|
||||
CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay *pCalcDisplay, __in_opt std::shared_ptr<IHistoryDisplay> pHistoryDisplay);
|
||||
void ProcessCommand(WPARAM wID);
|
||||
void DisplayError (DWORD nError);
|
||||
void DisplayError (uint32_t nError);
|
||||
std::unique_ptr<CalcEngine::Rational> PersistedMemObject();
|
||||
void PersistedMemObject(CalcEngine::Rational const& memObject);
|
||||
bool FInErrorState() { return m_bError; }
|
||||
|
@ -136,13 +136,13 @@ private:
|
|||
void SetPrimaryDisplay(const std::wstring& szText, bool isError = false);
|
||||
void ClearTemporaryValues();
|
||||
CalcEngine::Rational TruncateNumForIntMath(CalcEngine::Rational const& rat);
|
||||
CalcEngine::Rational SciCalcFunctions(CalcEngine::Rational const& rat, DWORD op);
|
||||
CalcEngine::Rational SciCalcFunctions(CalcEngine::Rational const& rat, uint32_t op);
|
||||
CalcEngine::Rational DoOperation(int operation, CalcEngine::Rational const& lhs, CalcEngine::Rational const& rhs);
|
||||
void SetRadixTypeAndNumWidth(RADIX_TYPE radixtype, NUM_WIDTH numwidth);
|
||||
int32_t DwWordBitWidthFromeNumWidth(NUM_WIDTH numwidth);
|
||||
uint32_t NRadixFromRadixType( RADIX_TYPE radixtype);
|
||||
|
||||
bool TryToggleBit(CalcEngine::Rational& rat, DWORD wbitno);
|
||||
bool TryToggleBit(CalcEngine::Rational& rat, uint32_t wbitno);
|
||||
void CheckAndAddLastBinOpToHistory(bool addToHistory = true);
|
||||
int IdcSetAngleTypeDecMode(int idc);
|
||||
|
||||
|
|
|
@ -37,46 +37,46 @@
|
|||
// CALC_E_DIVIDEBYZERO
|
||||
//
|
||||
// The current operation would require a divide by zero to complete
|
||||
#define CALC_E_DIVIDEBYZERO ((DWORD)0x80000000)
|
||||
#define CALC_E_DIVIDEBYZERO ((uint32_t)0x80000000)
|
||||
|
||||
// CALC_E_DOMAIN
|
||||
//
|
||||
// The given input is not within the domain of this function
|
||||
#define CALC_E_DOMAIN ((DWORD)0x80000001)
|
||||
#define CALC_E_DOMAIN ((uint32_t)0x80000001)
|
||||
|
||||
// CALC_E_INDEFINITE
|
||||
//
|
||||
// The result of this function is undefined
|
||||
#define CALC_E_INDEFINITE ((DWORD)0x80000002)
|
||||
#define CALC_E_INDEFINITE ((uint32_t)0x80000002)
|
||||
|
||||
// CALC_E_POSINFINITY
|
||||
//
|
||||
// The result of this function is Positive Infinity.
|
||||
#define CALC_E_POSINFINITY ((DWORD)0x80000003)
|
||||
#define CALC_E_POSINFINITY ((uint32_t)0x80000003)
|
||||
|
||||
// CALC_E_NEGINFINITY
|
||||
//
|
||||
// The result of this function is Negative Infinity
|
||||
#define CALC_E_NEGINFINITY ((DWORD)0x80000004)
|
||||
#define CALC_E_NEGINFINITY ((uint32_t)0x80000004)
|
||||
|
||||
// CALC_E_INVALIDRANGE
|
||||
//
|
||||
// The given input is within the domain of the function but is beyond
|
||||
// the range for which calc can successfully compute the answer
|
||||
#define CALC_E_INVALIDRANGE ((DWORD)0x80000006)
|
||||
#define CALC_E_INVALIDRANGE ((uint32_t)0x80000006)
|
||||
|
||||
// CALC_E_OUTOFMEMORY
|
||||
//
|
||||
// There is not enough free memory to complete the requested function
|
||||
#define CALC_E_OUTOFMEMORY ((DWORD)0x80000007)
|
||||
#define CALC_E_OUTOFMEMORY ((uint32_t)0x80000007)
|
||||
|
||||
// CALC_E_OVERFLOW
|
||||
//
|
||||
// The result of this operation is an overflow
|
||||
#define CALC_E_OVERFLOW ((DWORD)0x80000008)
|
||||
#define CALC_E_OVERFLOW ((uint32_t)0x80000008)
|
||||
|
||||
// CALC_E_NORESULT
|
||||
//
|
||||
// The result of this operation is undefined
|
||||
#define CALC_E_NORESULT ((DWORD)0x80000009)
|
||||
#define CALC_E_NORESULT ((uint32_t)0x80000009)
|
||||
|
||||
|
|
|
@ -132,10 +132,10 @@ void _mulnumx( PNUMBER *pa, PNUMBER b )
|
|||
{
|
||||
|
||||
// update carry from addition(s) and multiply.
|
||||
cy += (TWO_MANTTYPE)ptrc[icdigit]+((DWORD)mcy&((DWORD)~BASEX));
|
||||
cy += (TWO_MANTTYPE)ptrc[icdigit]+((uint32_t)mcy&((uint32_t)~BASEX));
|
||||
|
||||
// update result digit from
|
||||
ptrc[icdigit++]=(MANTTYPE)((DWORD)cy&((DWORD)~BASEX));
|
||||
ptrc[icdigit++]=(MANTTYPE)((uint32_t)cy&((uint32_t)~BASEX));
|
||||
|
||||
// update carries from
|
||||
mcy >>= BASEXPWR;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue