@@ -24,9 +24,9 @@ static const double g_rgdblTens[] =
2424 1e20 , 1e21 , 1e22 , 1e23 , 1e24 , 1e25 , 1e26 , 1e27 , 1e28
2525};
2626
27- static inline wchar_t ToDigit (long wVal)
27+ static inline wchar16 ToDigit (long wVal)
2828{
29- // return reinterpret_cast<wchar_t >((wVal < 10) ? '0' + (ushort) wVal : 'a' - 10 + (ushort) wVal);
29+ // return reinterpret_cast<wchar16 >((wVal < 10) ? '0' + (ushort) wVal : 'a' - 10 + (ushort) wVal);
3030 return (ushort)((wVal < 10 ) ? ' 0' + (ushort) wVal : ' a' - 10 + (ushort) wVal);
3131}
3232
@@ -1256,7 +1256,7 @@ double Js::NumberUtilities::StrToDbl( const EncodedChar *psz, const EncodedChar
12561256 return dbl;
12571257}
12581258
1259- template double Js::NumberUtilities::StrToDbl<wchar_t >( const wchar_t * psz, const wchar_t **ppchLim, bool & likelyInt );
1259+ template double Js::NumberUtilities::StrToDbl<wchar16 >( const wchar16 * psz, const wchar16 **ppchLim, bool & likelyInt );
12601260template double Js::NumberUtilities::StrToDbl<utf8char_t >(const utf8char_t * psz, const utf8char_t **ppchLim, bool & likelyInt);
12611261
12621262/* **************************************************************************
@@ -1919,18 +1919,18 @@ static BOOL FormatDigits(_In_reads_(pbLim - pbSrc) byte *pbSrc, byte *pbLim, int
19191919 Assert (wExp10 < 1000 );
19201920 if (wExp10 >= 100 )
19211921 {
1922- *pchDst++ = (wchar_t )(' 0' + wExp10 / 100 );
1922+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 100 );
19231923 wExp10 %= 100 ;
1924- *pchDst++ = (wchar_t )(' 0' + wExp10 / 10 );
1924+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 10 );
19251925 wExp10 %= 10 ;
19261926 }
19271927 else if (wExp10 >= 10 )
19281928 {
1929- *pchDst++ = (wchar_t )(' 0' + wExp10 / 10 );
1929+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 10 );
19301930 wExp10 %= 10 ;
19311931 }
19321932#pragma prefast(suppress:26014, "We have calculate the check the buffer size above already")
1933- *pchDst++ = (wchar_t )(' 0' + wExp10);
1933+ *pchDst++ = (wchar16 )(' 0' + wExp10);
19341934 *pchDst = 0 ;
19351935 }
19361936 else if (wExp10 <= 0 )
@@ -1963,7 +1963,7 @@ static BOOL FormatDigits(_In_reads_(pbLim - pbSrc) byte *pbSrc, byte *pbLim, int
19631963
19641964__success (return <= nDstBufSize)
19651965#pragma prefast(suppress:6101, "when return value is > nDstBufSize, the pchDst is not initialized. Prefast doesn't seems to pick that up in the annotation")
1966- static int FormatDigitsFixed (byte *pbSrc, byte *pbLim, int wExp10, int nFractionDigits, __out_ecount_part(nDstBufSize, return ) wchar_t *pchDst, int nDstBufSize)
1966+ static int FormatDigitsFixed (byte *pbSrc, byte *pbLim, int wExp10, int nFractionDigits, __out_ecount_part(nDstBufSize, return ) wchar16 *pchDst, int nDstBufSize)
19671967{
19681968 AnalysisAssert (pbLim > pbSrc);
19691969 AssertArrMem (pbSrc, pbLim - pbSrc);
@@ -2054,7 +2054,7 @@ static int FormatDigitsExponential(
20542054 byte * pbLim,
20552055 int wExp10,
20562056 int nFractionDigits,
2057- __out_ecount_part (cchDst,return ) wchar_t * pchDst,
2057+ __out_ecount_part (cchDst,return ) wchar16 * pchDst,
20582058 int cchDst
20592059 )
20602060{
@@ -2105,7 +2105,7 @@ static int FormatDigitsExponential(
21052105 if (cchDst < n) return n;
21062106
21072107#if DBG // save pchDst to validate n
2108- wchar_t * pchDstStart = pchDst;
2108+ wchar16 * pchDstStart = pchDst;
21092109#endif
21102110
21112111 // First digit
@@ -2148,17 +2148,17 @@ static int FormatDigitsExponential(
21482148 // Exponent Digits
21492149 if (wExp10 >= 100 )
21502150 {
2151- *pchDst++ = (wchar_t )(' 0' + wExp10 / 100 );
2151+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 100 );
21522152 wExp10 %= 100 ;
2153- *pchDst++ = (wchar_t )(' 0' + wExp10 / 10 );
2153+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 10 );
21542154 wExp10 %= 10 ;
21552155 }
21562156 else if (wExp10 >= 10 )
21572157 {
2158- *pchDst++ = (wchar_t )(' 0' + wExp10 / 10 );
2158+ *pchDst++ = (wchar16 )(' 0' + wExp10 / 10 );
21592159 wExp10 %= 10 ;
21602160 }
2161- *pchDst++ = (wchar_t )(' 0' + wExp10);
2161+ *pchDst++ = (wchar16 )(' 0' + wExp10);
21622162
21632163 *pchDst = 0 ;
21642164 Assert (1 + pchDst - pchDstStart == n);
@@ -2241,7 +2241,7 @@ static int RoundTo(byte *pbSrc, byte *pbLim, int nDigits, __out_bcount(nDigits+1
22412241* Returns the number of chars. in the result. If 'nDstBufSize'
22422242* is less than this number, no data is written to the buffer 'pchDst'.
22432243*/
2244- int Js::NumberUtilities::FDblToStr (double dbl, Js::NumberUtilities::FormatType ft, int nDigits, __out_ecount(cchDst) wchar_t *pchDst, int cchDst)
2244+ int Js::NumberUtilities::FDblToStr (double dbl, Js::NumberUtilities::FormatType ft, int nDigits, __out_ecount(cchDst) wchar16 *pchDst, int cchDst)
22452245{
22462246 int n = 0 ; // the no. of chars in the result.
22472247 int wExp10;
@@ -2254,7 +2254,7 @@ int Js::NumberUtilities::FDblToStr(double dbl, Js::NumberUtilities::FormatType f
22542254 {
22552255 n = 4 ; // (int)wcslen(OLESTR("NaN")) + 1;
22562256 if ( cchDst >= n )
2257- wcscpy_s (pchDst, cchDst, L " NaN" );
2257+ wcscpy_s (pchDst, cchDst, CH_WSTR ( " NaN" ) );
22582258 }
22592259 else
22602260 {
@@ -2269,7 +2269,7 @@ int Js::NumberUtilities::FDblToStr(double dbl, Js::NumberUtilities::FormatType f
22692269 {
22702270 if (neg)
22712271 *pchDst++ = ' -' ;
2272- wcscpy_s (pchDst, cchDst - neg, L " Infinity" );
2272+ wcscpy_s (pchDst, cchDst - neg, CH_WSTR ( " Infinity" ) );
22732273 }
22742274 }
22752275 return n;
@@ -2362,12 +2362,12 @@ int Js::NumberUtilities::FDblToStr(double dbl, Js::NumberUtilities::FormatType f
23622362 return n;
23632363}
23642364
2365- BOOL Js::NumberUtilities::FDblToStr (double dbl, __out_ecount(cchDst) wchar_t *pchDst, int cchDst)
2365+ BOOL Js::NumberUtilities::FDblToStr (double dbl, __out_ecount(cchDst) wchar16 *pchDst, int cchDst)
23662366{
23672367 if (!Js::NumberUtilities::IsFinite (dbl))
23682368 {
23692369 if (Js::NumberUtilities::IsNan (dbl))
2370- return 0 == wcscpy_s (pchDst, cchDst, L " NaN" );
2370+ return 0 == wcscpy_s (pchDst, cchDst, CH_WSTR ( " NaN" ) );
23712371 else
23722372 {
23732373 if (dbl < 0 )
@@ -2377,7 +2377,7 @@ BOOL Js::NumberUtilities::FDblToStr(double dbl, __out_ecount(cchDst) wchar_t *pc
23772377 cchDst--;
23782378 }
23792379
2380- return 0 == wcscpy_s (pchDst, cchDst, L " Infinity" );
2380+ return 0 == wcscpy_s (pchDst, cchDst, CH_WSTR ( " Infinity" ) );
23812381 }
23822382 }
23832383
@@ -2412,15 +2412,15 @@ BOOL Js::NumberUtilities::FNonZeroFiniteDblToStr(double dbl, __out_ecount(cchDst
24122412
24132413#if DBG
24142414 double dblT;
2415- const wchar_t *pch;
2415+ const wchar16 *pch;
24162416
24172417 // In Debug, always call FDblToRgbPrecise and verify that it converts back.
24182418 if (FDblToRgbPrecise (dbl, rgb, &wExp10, &pbLim))
24192419 {
24202420 if (FormatDigits (rgb, pbLim, wExp10, pchDst, cchDst))
24212421 {
24222422 bool likelyInt = true ;
2423- dblT = StrToDbl<wchar_t >(pchDst, &pch,likelyInt);
2423+ dblT = StrToDbl<wchar16 >(pchDst, &pch,likelyInt);
24242424 Assert (0 == *pch);
24252425 Assert (dblT == dbl);
24262426 }
@@ -2446,7 +2446,7 @@ BOOL Js::NumberUtilities::FNonZeroFiniteDblToStr(double dbl, __out_ecount(cchDst
24462446
24472447#if DBG
24482448 bool likelyInt = true ;
2449- dblT = StrToDbl<wchar_t >(pchDst, &pch, likelyInt);
2449+ dblT = StrToDbl<wchar16 >(pchDst, &pch, likelyInt);
24502450 Assert (0 == *pch);
24512451 Assert (dblT == dbl);
24522452#endif // DBG
@@ -2484,7 +2484,7 @@ BOOL Js::NumberUtilities::FNonZeroFiniteDblToStr(double dbl, _In_range_(2, 36) i
24842484 int wExp2, wExp, wDig;
24852485 int maxOutDigits, cchSig, cch;
24862486 int len = nDstBufSize;
2487- wchar_t * ppsz = psz;
2487+ wchar16 * ppsz = psz;
24882488
24892489 if (0x80000000 & Js::NumberUtilities::LuHiDbl (dbl))
24902490 {
@@ -2611,16 +2611,16 @@ BOOL Js::NumberUtilities::FNonZeroFiniteDblToStr(double dbl, _In_range_(2, 36) i
26112611 {
26122612 if (wExp >= 1000 )
26132613 {
2614- *ppsz++ = (wchar_t )(' 0' + wExp / 1000 );
2614+ *ppsz++ = (wchar16 )(' 0' + wExp / 1000 );
26152615 wExp %= 1000 ;
26162616 }
2617- *ppsz++ = (wchar_t )(' 0' + wExp / 100 );
2617+ *ppsz++ = (wchar16 )(' 0' + wExp / 100 );
26182618 wExp %= 100 ;
26192619 }
2620- *ppsz++ = (wchar_t )(' 0' + wExp / 10 );
2620+ *ppsz++ = (wchar16 )(' 0' + wExp / 10 );
26212621 wExp %= 10 ;
26222622 }
2623- *ppsz++ = (wchar_t )(' 0' + wExp);
2623+ *ppsz++ = (wchar16 )(' 0' + wExp);
26242624 *ppsz++ = ' )' ;
26252625 *ppsz = 0 ;
26262626
@@ -2747,13 +2747,13 @@ double Js::NumberUtilities::DblFromDecimal(DECIMAL * pdecIn)
27472747 return dblRet;
27482748}
27492749
2750- void Js::NumberUtilities::CodePointAsSurrogatePair (codepoint_t codePointValue, __out wchar_t * first, __out wchar_t * second)
2750+ void Js::NumberUtilities::CodePointAsSurrogatePair (codepoint_t codePointValue, __out wchar16 * first, __out wchar16 * second)
27512751{
27522752 AssertMsg (first != nullptr && second != nullptr , " Null ptr's passed in for out." );
27532753 AssertMsg (IsInSupplementaryPlane (codePointValue), " Code point is not a surrogate pair." );
27542754 codePointValue -= 0x10000 ;
2755- *first = (wchar_t )(codePointValue >> 10 ) + 0xD800 ;
2756- *second = (wchar_t )(codePointValue & 0x3FF /* This is same as cpv % 0x400 */ ) + 0xDC00 ;
2755+ *first = (wchar16 )(codePointValue >> 10 ) + 0xD800 ;
2756+ *second = (wchar16 )(codePointValue & 0x3FF /* This is same as cpv % 0x400 */ ) + 0xDC00 ;
27572757}
27582758
27592759codepoint_t Js::NumberUtilities::SurrogatePairAsCodePoint (codepoint_t first, codepoint_t second)
0 commit comments