Reactos

[UCRT] Hack some template code, so that retarded compilers can handle it

+32 -32
+32 -32
sdk/lib/ucrt/inc/corecrt_internal_stdio_output.h
··· 1009 1009 __crt_cached_ptd_host& ptd, 1010 1010 va_list const arglist 1011 1011 ) throw() 1012 - : common_data{ptd}, 1012 + : common_data<Character>{ptd}, 1013 1013 _output_adapter(output_adapter) 1014 1014 { 1015 1015 // We initialize several base class data members here, so that we can ··· 1209 1209 #endif 1210 1210 1211 1211 typedef positional_parameter_base self_type; 1212 - typedef format_validation_base base_type; 1212 + typedef format_validation_base<Character, OutputAdapter> base_type; 1213 1213 typedef __crt_char_traits<Character> char_traits; 1214 1214 1215 1215 template <typename... Ts> ··· 1296 1296 { 1297 1297 if (_format_mode == mode::nonpositional) 1298 1298 { 1299 - return base_type::extract_argument_from_va_list<RequestedParameterType>(result); 1299 + return base_type::template extract_argument_from_va_list<RequestedParameterType>(result); 1300 1300 } 1301 1301 1302 1302 _UCRT_VALIDATE_RETURN(_ptd, _type_index >= 0 && _type_index < _ARGMAX, EINVAL, false); ··· 2274 2274 if (is_wide_character_specifier(_options, _format_char, _length)) 2275 2275 { 2276 2276 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)) 2278 2278 { 2279 2279 return false; 2280 2280 } ··· 2286 2286 2287 2287 // Convert to multibyte. If the conversion fails, we suppress the 2288 2288 // 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)}; 2290 2290 if (status != 0) 2291 2291 { 2292 2292 _suppress_output = true; ··· 2296 2296 // to the output, as-is. 2297 2297 else 2298 2298 { 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])) 2300 2300 { 2301 2301 return false; 2302 2302 } ··· 2309 2309 _string_length = 1; 2310 2310 } 2311 2311 2312 - _narrow_string = _buffer.data<char>(); 2312 + _narrow_string = _buffer.template data<char>(); 2313 2313 return true; 2314 2314 } 2315 2315 ··· 2320 2320 _string_is_wide = true; 2321 2321 2322 2322 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)) 2324 2324 return false; 2325 2325 2326 2326 if (!should_format()) ··· 2334 2334 // output operation. 2335 2335 char const local_buffer[2]{ static_cast<char>(wide_character & 0x00ff), '\0' }; 2336 2336 int const mbc_length{_mbtowc_internal( 2337 - _buffer.data<wchar_t>(), 2337 + _buffer.template data<wchar_t>(), 2338 2338 local_buffer, 2339 2339 _ptd.get_locale()->locinfo->_public._locale_mb_cur_max, 2340 2340 _ptd ··· 2346 2346 } 2347 2347 else 2348 2348 { 2349 - _buffer.data<wchar_t>()[0] = wide_character; 2349 + _buffer.template data<wchar_t>()[0] = wide_character; 2350 2350 } 2351 2351 2352 - _wide_string = _buffer.data<wchar_t>(); 2352 + _wide_string = _buffer.template data<wchar_t>(); 2353 2353 _string_length = 1; 2354 2354 return true; 2355 2355 } ··· 2371 2371 }; 2372 2372 2373 2373 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)) 2375 2375 return false; 2376 2376 2377 2377 if (!should_format()) ··· 2406 2406 // of the length of the C string and the given precision. Note that the 2407 2407 // string needs not be null-terminated if a precision is given, so we 2408 2408 // 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)) 2410 2410 return false; 2411 2411 2412 2412 if (!should_format()) ··· 2505 2505 _precision = 1; // Per C Standard Library specification. 2506 2506 } 2507 2507 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)) 2509 2509 { 2510 2510 // If we fail to enlarge the buffer, cap precision so that the 2511 2511 // 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); 2513 2513 } 2514 2514 2515 - _narrow_string = _buffer.data<char>(); 2515 + _narrow_string = _buffer.template data<char>(); 2516 2516 2517 2517 // Note that we separately handle the FORMAT_POSSCAN_PASS above. 2518 2518 _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)) 2520 2520 { 2521 2521 return false; 2522 2522 } ··· 2524 2524 // Format the number into the buffer: 2525 2525 __acrt_fp_format( 2526 2526 &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>(), 2531 2531 static_cast<char>(_format_char), 2532 2532 _precision, 2533 2533 _options, ··· 2639 2639 { 2640 2640 case sizeof(int8_t): 2641 2641 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); 2644 2644 break; 2645 2645 case sizeof(int16_t): 2646 2646 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); 2649 2649 break; 2650 2650 case sizeof(int32_t): 2651 2651 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); 2654 2654 break; 2655 2655 case sizeof(int64_t): 2656 2656 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); 2659 2659 break; 2660 2660 default: 2661 2661 _UCRT_VALIDATE_RETURN(_ptd, ("Invalid integer length modifier", 0), EINVAL, false); ··· 2695 2695 else 2696 2696 { 2697 2697 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); 2699 2699 } 2700 2700 2701 2701 // If the number is zero, we do not want to print the hex prefix ("0x"), ··· 2741 2741 // buffer at the end of the formatting buffer, which allows us to perform 2742 2742 // the formatting from least to greatest magnitude, which maps well to 2743 2743 // 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}; 2745 2745 2746 2746 Character*& string_pointer = tchar_string(); 2747 2747 ··· 2773 2773 bool type_case_n() throw() 2774 2774 { 2775 2775 void* p{nullptr}; 2776 - if (!extract_argument_from_va_list<void*>(p)) 2776 + if (!this->template extract_argument_from_va_list<void*>(p)) 2777 2777 return false; 2778 2778 2779 2779 if (!should_format())