Skip to content

Commit 693f9f5

Browse files
committed
[UCRT] Hack some template code, so that retarded compilers can handle it
1 parent f9dc185 commit 693f9f5

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ class output_adapter_data
10091009
__crt_cached_ptd_host& ptd,
10101010
va_list const arglist
10111011
) throw()
1012-
: common_data{ptd},
1012+
: common_data<Character>{ptd},
10131013
_output_adapter(output_adapter)
10141014
{
10151015
// We initialize several base class data members here, so that we can
@@ -1209,7 +1209,7 @@ class positional_parameter_base
12091209
#endif
12101210

12111211
typedef positional_parameter_base self_type;
1212-
typedef format_validation_base base_type;
1212+
typedef format_validation_base<Character, OutputAdapter> base_type;
12131213
typedef __crt_char_traits<Character> char_traits;
12141214

12151215
template <typename... Ts>
@@ -1296,7 +1296,7 @@ class positional_parameter_base
12961296
{
12971297
if (_format_mode == mode::nonpositional)
12981298
{
1299-
return base_type::extract_argument_from_va_list<RequestedParameterType>(result);
1299+
return base_type::template extract_argument_from_va_list<RequestedParameterType>(result);
13001300
}
13011301

13021302
_UCRT_VALIDATE_RETURN(_ptd, _type_index >= 0 && _type_index < _ARGMAX, EINVAL, false);
@@ -2274,7 +2274,7 @@ class output_processor
22742274
if (is_wide_character_specifier(_options, _format_char, _length))
22752275
{
22762276
wchar_t wide_character{};
2277-
if (!extract_argument_from_va_list<wchar_t>(wide_character))
2277+
if (!this->template extract_argument_from_va_list<wchar_t>(wide_character))
22782278
{
22792279
return false;
22802280
}
@@ -2286,7 +2286,7 @@ class output_processor
22862286

22872287
// Convert to multibyte. If the conversion fails, we suppress the
22882288
// output operation but we do not fail the entire operation:
2289-
errno_t const status{_wctomb_internal(&_string_length, _buffer.data<char>(), _buffer.count<char>(), wide_character, _ptd)};
2289+
errno_t const status{_wctomb_internal(&_string_length, _buffer.template data<char>(), _buffer.template count<char>(), wide_character, _ptd)};
22902290
if (status != 0)
22912291
{
22922292
_suppress_output = true;
@@ -2296,7 +2296,7 @@ class output_processor
22962296
// to the output, as-is.
22972297
else
22982298
{
2299-
if (!extract_argument_from_va_list<unsigned short>(_buffer.data<char>()[0]))
2299+
if (!this->template extract_argument_from_va_list<unsigned short>(_buffer.template data<char>()[0]))
23002300
{
23012301
return false;
23022302
}
@@ -2309,7 +2309,7 @@ class output_processor
23092309
_string_length = 1;
23102310
}
23112311

2312-
_narrow_string = _buffer.data<char>();
2312+
_narrow_string = _buffer.template data<char>();
23132313
return true;
23142314
}
23152315

@@ -2320,7 +2320,7 @@ class output_processor
23202320
_string_is_wide = true;
23212321

23222322
wchar_t wide_character{};
2323-
if (!extract_argument_from_va_list<wchar_t>(wide_character))
2323+
if (!this->template extract_argument_from_va_list<wchar_t>(wide_character))
23242324
return false;
23252325

23262326
if (!should_format())
@@ -2334,7 +2334,7 @@ class output_processor
23342334
// output operation.
23352335
char const local_buffer[2]{ static_cast<char>(wide_character & 0x00ff), '\0' };
23362336
int const mbc_length{_mbtowc_internal(
2337-
_buffer.data<wchar_t>(),
2337+
_buffer.template data<wchar_t>(),
23382338
local_buffer,
23392339
_ptd.get_locale()->locinfo->_public._locale_mb_cur_max,
23402340
_ptd
@@ -2346,10 +2346,10 @@ class output_processor
23462346
}
23472347
else
23482348
{
2349-
_buffer.data<wchar_t>()[0] = wide_character;
2349+
_buffer.template data<wchar_t>()[0] = wide_character;
23502350
}
23512351

2352-
_wide_string = _buffer.data<wchar_t>();
2352+
_wide_string = _buffer.template data<wchar_t>();
23532353
_string_length = 1;
23542354
return true;
23552355
}
@@ -2371,7 +2371,7 @@ class output_processor
23712371
};
23722372

23732373
ansi_string* string{};
2374-
if (!extract_argument_from_va_list<ansi_string*>(string))
2374+
if (!this->template extract_argument_from_va_list<ansi_string*>(string))
23752375
return false;
23762376

23772377
if (!should_format())
@@ -2406,7 +2406,7 @@ class output_processor
24062406
// of the length of the C string and the given precision. Note that the
24072407
// string needs not be null-terminated if a precision is given, so we
24082408
// cannot call strlen to compute the length of the string.
2409-
if (!extract_argument_from_va_list<char*>(_narrow_string))
2409+
if (!this->template extract_argument_from_va_list<char*>(_narrow_string))
24102410
return false;
24112411

24122412
if (!should_format())
@@ -2505,29 +2505,29 @@ class output_processor
25052505
_precision = 1; // Per C Standard Library specification.
25062506
}
25072507

2508-
if (!_buffer.ensure_buffer_is_big_enough<char>(_CVTBUFSIZE + _precision, _ptd))
2508+
if (!_buffer.template ensure_buffer_is_big_enough<char>(_CVTBUFSIZE + _precision, _ptd))
25092509
{
25102510
// If we fail to enlarge the buffer, cap precision so that the
25112511
// statically-sized buffer may be used for the formatting:
2512-
_precision = static_cast<int>(_buffer.count<char>() - _CVTBUFSIZE);
2512+
_precision = static_cast<int>(_buffer.template count<char>() - _CVTBUFSIZE);
25132513
}
25142514

2515-
_narrow_string = _buffer.data<char>();
2515+
_narrow_string = _buffer.template data<char>();
25162516

25172517
// Note that we separately handle the FORMAT_POSSCAN_PASS above.
25182518
_CRT_DOUBLE tmp{};
2519-
if (!extract_argument_from_va_list<_CRT_DOUBLE>(tmp))
2519+
if (!this->template extract_argument_from_va_list<_CRT_DOUBLE>(tmp))
25202520
{
25212521
return false;
25222522
}
25232523

25242524
// Format the number into the buffer:
25252525
__acrt_fp_format(
25262526
&tmp.x,
2527-
_buffer.data<char>(),
2528-
_buffer.count<char>(),
2529-
_buffer.scratch_data<char>(),
2530-
_buffer.scratch_count<char>(),
2527+
_buffer.template data<char>(),
2528+
_buffer.template count<char>(),
2529+
_buffer.template scratch_data<char>(),
2530+
_buffer.template scratch_count<char>(),
25312531
static_cast<char>(_format_char),
25322532
_precision,
25332533
_options,
@@ -2639,23 +2639,23 @@ class output_processor
26392639
{
26402640
case sizeof(int8_t):
26412641
extraction_result = has_flag(FL_SIGNED)
2642-
? extract_argument_from_va_list<int8_t >(original_number)
2643-
: extract_argument_from_va_list<uint8_t>(original_number);
2642+
? this->template extract_argument_from_va_list<int8_t >(original_number)
2643+
: this->template extract_argument_from_va_list<uint8_t>(original_number);
26442644
break;
26452645
case sizeof(int16_t):
26462646
extraction_result = has_flag(FL_SIGNED)
2647-
? extract_argument_from_va_list<int16_t >(original_number)
2648-
: extract_argument_from_va_list<uint16_t>(original_number);
2647+
? this->template extract_argument_from_va_list<int16_t >(original_number)
2648+
: this->template extract_argument_from_va_list<uint16_t>(original_number);
26492649
break;
26502650
case sizeof(int32_t):
26512651
extraction_result = has_flag(FL_SIGNED)
2652-
? extract_argument_from_va_list<int32_t >(original_number)
2653-
: extract_argument_from_va_list<uint32_t>(original_number);
2652+
? this->template extract_argument_from_va_list<int32_t >(original_number)
2653+
: this->template extract_argument_from_va_list<uint32_t>(original_number);
26542654
break;
26552655
case sizeof(int64_t):
26562656
extraction_result = has_flag(FL_SIGNED)
2657-
? extract_argument_from_va_list<int64_t >(original_number)
2658-
: extract_argument_from_va_list<uint64_t>(original_number);
2657+
? this->template extract_argument_from_va_list<int64_t >(original_number)
2658+
: this->template extract_argument_from_va_list<uint64_t>(original_number);
26592659
break;
26602660
default:
26612661
_UCRT_VALIDATE_RETURN(_ptd, ("Invalid integer length modifier", 0), EINVAL, false);
@@ -2695,7 +2695,7 @@ class output_processor
26952695
else
26962696
{
26972697
unset_flag(FL_LEADZERO);
2698-
_buffer.ensure_buffer_is_big_enough<Character>(_precision, _ptd);
2698+
_buffer.template ensure_buffer_is_big_enough<Character>(_precision, _ptd);
26992699
}
27002700

27012701
// If the number is zero, we do not want to print the hex prefix ("0x"),
@@ -2741,7 +2741,7 @@ class output_processor
27412741
// buffer at the end of the formatting buffer, which allows us to perform
27422742
// the formatting from least to greatest magnitude, which maps well to
27432743
// the math.
2744-
Character* const last_digit{_buffer.data<Character>() + _buffer.count<Character>() - 1};
2744+
Character* const last_digit{_buffer.template data<Character>() + _buffer.template count<Character>() - 1};
27452745

27462746
Character*& string_pointer = tchar_string();
27472747

@@ -2773,7 +2773,7 @@ class output_processor
27732773
bool type_case_n() throw()
27742774
{
27752775
void* p{nullptr};
2776-
if (!extract_argument_from_va_list<void*>(p))
2776+
if (!this->template extract_argument_from_va_list<void*>(p))
27772777
return false;
27782778

27792779
if (!should_format())

0 commit comments

Comments
 (0)