msvcrt: Added _set_output_format implementation.

This commit is contained in:
Piotr Caban 2013-03-27 10:39:30 +01:00 committed by Alexandre Julliard
parent 57fb89200f
commit 9c4be83a78
9 changed files with 37 additions and 17 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;
}
/*********************************************************************

View file

@ -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)

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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