diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 5938d54f290..93bddbfc977 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1270,7 +1270,7 @@ @ cdecl _set_fmode(long) msvcrt._set_fmode @ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait -@ stub _set_output_format +@ cdecl _set_output_format(long) msvcrt._set_output_format @ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _seterrormode(long) msvcrt._seterrormode diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 81b3fc23948..7f6b0d99eb9 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1632,7 +1632,7 @@ @ cdecl _set_fmode(long) msvcrt._set_fmode @ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait -@ stub _set_output_format +@ cdecl _set_output_format(long) msvcrt._set_output_format @ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _seterrormode(long) msvcrt._seterrormode diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 6b7a318f52a..a2e292975e0 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -931,7 +931,7 @@ @ cdecl _set_fmode(long) msvcrt._set_fmode @ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait -@ stub _set_output_format +@ cdecl _set_output_format(long) msvcrt._set_output_format @ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 81a265d1772..998349f7b0f 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -924,7 +924,7 @@ @ cdecl _set_fmode(long) msvcrt._set_fmode @ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler @ stub _set_malloc_crt_max_wait -@ stub _set_output_format +@ cdecl _set_output_format(long) msvcrt._set_output_format @ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c index 2da242920f5..75e75e66712 100644 --- a/dlls/msvcrt/misc.c +++ b/dlls/msvcrt/misc.c @@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); +static unsigned int output_format; /********************************************************************* * _beep (MSVCRT.@) @@ -283,7 +284,21 @@ void CDECL MSVCRT_qsort_s(void *base, MSVCRT_size_t nmemb, MSVCRT_size_t size, */ unsigned int CDECL _get_output_format(void) { - return 0; + return output_format; +} + +/********************************************************************* + * _set_output_format (MSVCRT.@) + */ +unsigned int CDECL _set_output_format(unsigned int new_output_format) +{ + unsigned int ret = output_format; + + if(!MSVCRT_CHECK_PMT(new_output_format==0 || new_output_format==MSVCRT__TWO_DIGIT_EXPONENT)) + return ret; + + output_format = new_output_format; + return ret; } /********************************************************************* diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 3bbbe93628f..07e2984bb6f 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -982,6 +982,7 @@ int __cdecl MSVCRT__toupper_l(int,MSVCRT__locale_t); int __cdecl MSVCRT__tolower_l(int,MSVCRT__locale_t); int __cdecl MSVCRT__strnicoll_l(const char*, const char*, MSVCRT_size_t, MSVCRT__locale_t); int __cdecl MSVCRT_strncoll_l(const char*, const char*, MSVCRT_size_t, MSVCRT__locale_t); +unsigned int __cdecl _get_output_format(void); /* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd) * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0) diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index b6ae2610397..99072aaef85 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -894,7 +894,7 @@ @ cdecl _set_error_mode(long) # stub _set_fileinfo(long) @ cdecl _set_fmode(long) -# stub _set_output_format(long) +@ cdecl _set_output_format(long) @ cdecl _set_sbh_threshold(long) @ cdecl _seterrormode(long) @ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) MSVCRT__setjmp diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h index d02115e2d02..3ccb1c49eef 100644 --- a/dlls/msvcrt/printf.h +++ b/dlls/msvcrt/printf.h @@ -307,22 +307,25 @@ static inline void FUNC_NAME(pf_fixup_exponent)(char *buf) if(tmp[0] && (tmp[1]=='+' || tmp[1]=='-') && isdigit(tmp[2]) && isdigit(tmp[3])) { - char final; - - if (isdigit(tmp[4])) - return; /* Exponent already 3 digits */ + BOOL two_digit_exp = (_get_output_format() == MSVCRT__TWO_DIGIT_EXPONENT); tmp += 2; - final = tmp[2]; + if(isdigit(tmp[2])) { + if(two_digit_exp && tmp[0]=='0') { + tmp[0] = tmp[1]; + tmp[1] = tmp[2]; + tmp[2] = tmp[3]; + } + + return; /* Exponent already 3 digits */ + }else if(two_digit_exp) { + return; + } + + tmp[3] = tmp[2]; tmp[2] = tmp[1]; tmp[1] = tmp[0]; tmp[0] = '0'; - - if(final == '\0') { - tmp[3] = '\0'; - if(buf[0] == ' ') - memmove(buf, buf + 1, (tmp - buf) + 3); - } } } diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index f6bf3b56942..a01859ec261 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -182,6 +182,7 @@ int __cdecl vprintf_s(const char*,__ms_va_list); int __cdecl vsprintf(char*,const char*,__ms_va_list); int __cdecl vsprintf_s(char*,size_t,const char*,__ms_va_list); unsigned int __cdecl _get_output_format(void); +unsigned int __cdecl _set_output_format(void); #ifndef _WSTDIO_DEFINED #define _WSTDIO_DEFINED