corecrt_wstdio.h: Add new file and use it instead of duplicating declarations in stdio.h and wchar.h.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-02-13 15:24:09 +01:00 committed by Alexandre Julliard
parent 40c3662fb3
commit ba07e25ccf
4 changed files with 126 additions and 200 deletions

View File

@ -423,6 +423,7 @@ SOURCES = \
msvcrt/assert.h \
msvcrt/conio.h \
msvcrt/corecrt.h \
msvcrt/corecrt_wstdio.h \
msvcrt/crtdbg.h \
msvcrt/crtdefs.h \
msvcrt/ctype.h \

View File

@ -0,0 +1,123 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the Wine project.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _WSTDIO_DEFINED
#define _WSTDIO_DEFINED
#include <corecrt.h>
#ifndef RC_INVOKED
#include <stdarg.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <pshpack8.h>
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
#include <pshpack8.h>
typedef struct _iobuf
{
char* _ptr;
int _cnt;
char* _base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char* _tmpfname;
} FILE;
#include <poppack.h>
#endif /* _FILE_DEFINED */
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
wint_t __cdecl _fgetwc_nolock(FILE*);
wint_t __cdecl _fgetwchar(void);
wint_t __cdecl _fputwc_nolock(wint_t,FILE*);
wint_t __cdecl _fputwchar(wint_t);
wint_t __cdecl _getwc_nolock(FILE*);
wchar_t* __cdecl _getws(wchar_t*);
wint_t __cdecl _putwc_nolock(wint_t,FILE*);
int __cdecl _putws(const wchar_t*);
int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
int WINAPIV _scwprintf(const wchar_t*,...);
wint_t __cdecl _ungetwc_nolock(wint_t,FILE*);
int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
FILE* __cdecl _wfdopen(int,const wchar_t*);
FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
void __cdecl _wperror(const wchar_t*);
FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
int __cdecl _wremove(const wchar_t*);
wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
wchar_t* __cdecl _wtmpnam(wchar_t*);
wint_t __cdecl fgetwc(FILE*);
wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
wint_t __cdecl fputwc(wint_t,FILE*);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwprintf(FILE*,const wchar_t*,...);
int WINAPIV fwprintf_s(FILE*,const wchar_t*,...);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwscanf(FILE*,const wchar_t*,...);
int WINAPIV fwscanf_s(FILE*,const wchar_t*,...);
wint_t __cdecl getwc(FILE*);
wint_t __cdecl getwchar(void);
wchar_t* __cdecl getws(wchar_t*);
wint_t __cdecl putwc(wint_t,FILE*);
wint_t __cdecl putwchar(wint_t);
int __cdecl putws(const wchar_t*);
int WINAPIV swprintf_s(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV swscanf(const wchar_t*,const wchar_t*,...);
int WINAPIV swscanf_s(const wchar_t*,const wchar_t*,...);
wint_t __cdecl ungetwc(wint_t,FILE*);
int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl vwprintf(const wchar_t*,__ms_va_list);
int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
int WINAPIV wprintf(const wchar_t*,...);
int WINAPIV wprintf_s(const wchar_t*,...);
int WINAPIV wscanf(const wchar_t*,...);
int WINAPIV wscanf_s(const wchar_t*,...);
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
#else /* _CRT_NON_CONFORMING_SWPRINTFS */
static inline int vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args) { return _vsnwprintf(buffer,size,format,args); }
static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
{
int ret;
__ms_va_list args;
__ms_va_start(args, format);
ret = _vsnwprintf(buffer, size, format, args);
__ms_va_end(args);
return ret;
}
#endif /* _CRT_NON_CONFORMING_SWPRINTFS */
#ifdef __cplusplus
}
#endif
#include <poppack.h>
#endif /* _WSTDIO_DEFINED */

View File

@ -8,13 +8,7 @@
#ifndef __WINE_STDIO_H
#define __WINE_STDIO_H
#include <corecrt.h>
#ifndef RC_INVOKED
#include <stdarg.h>
#endif
#include <pshpack8.h>
#include <corecrt_wstdio.h>
/* file._flag flags */
#define _IOREAD 0x0001
@ -56,21 +50,6 @@
#define SEEK_END 2
#endif
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
typedef struct _iobuf
{
char* _ptr;
int _cnt;
char* _base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char* _tmpfname;
} FILE;
#endif /* _FILE_DEFINED */
#ifndef _FPOS_T_DEFINED
typedef __int64 DECLSPEC_ALIGN(8) fpos_t;
#define _FPOS_T_DEFINED
@ -204,84 +183,6 @@ 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
wint_t __cdecl _fgetwc_nolock(FILE*);
wint_t __cdecl _fgetwchar(void);
wint_t __cdecl _fputwc_nolock(wint_t,FILE*);
wint_t __cdecl _fputwchar(wint_t);
wint_t __cdecl _getwc_nolock(FILE*);
wchar_t* __cdecl _getws(wchar_t*);
wint_t __cdecl _putwc_nolock(wint_t,FILE*);
int __cdecl _putws(const wchar_t*);
int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
int WINAPIV _scwprintf(const wchar_t*,...);
wint_t __cdecl _ungetwc_nolock(wint_t,FILE*);
int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
FILE* __cdecl _wfdopen(int,const wchar_t*);
FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
void __cdecl _wperror(const wchar_t*);
FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
int __cdecl _wremove(const wchar_t*);
wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
wchar_t* __cdecl _wtmpnam(wchar_t*);
wint_t __cdecl fgetwc(FILE*);
wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
wint_t __cdecl fputwc(wint_t,FILE*);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwprintf(FILE*,const wchar_t*,...);
int WINAPIV fwprintf_s(FILE*,const wchar_t*,...);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwscanf(FILE*,const wchar_t*,...);
int WINAPIV fwscanf_s(FILE*,const wchar_t*,...);
wint_t __cdecl getwc(FILE*);
wint_t __cdecl getwchar(void);
wchar_t* __cdecl getws(wchar_t*);
wint_t __cdecl putwc(wint_t,FILE*);
wint_t __cdecl putwchar(wint_t);
int __cdecl putws(const wchar_t*);
int WINAPIV swprintf_s(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV swscanf(const wchar_t*,const wchar_t*,...);
int WINAPIV swscanf_s(const wchar_t*,const wchar_t*,...);
wint_t __cdecl ungetwc(wint_t,FILE*);
int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl vwprintf(const wchar_t*,__ms_va_list);
int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
int WINAPIV wprintf(const wchar_t*,...);
int WINAPIV wprintf_s(const wchar_t*,...);
int WINAPIV wscanf(const wchar_t*,...);
int WINAPIV wscanf_s(const wchar_t*,...);
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
#else /* _CRT_NON_CONFORMING_SWPRINTFS */
static inline int vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args) { return _vsnwprintf(buffer,size,format,args); }
static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
{
int ret;
__ms_va_list args;
__ms_va_start(args, format);
ret = _vsnwprintf(buffer, size, format, args);
__ms_va_end(args);
return ret;
}
#endif /* _CRT_NON_CONFORMING_SWPRINTFS */
#endif /* _WSTDIO_DEFINED */
#endif /* _STDIO_DEFINED */
#ifdef __cplusplus
@ -309,6 +210,4 @@ static inline int getw(FILE* file) { return _getw(file); }
static inline int putw(int val, FILE* file) { return _putw(val, file); }
static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
#include <poppack.h>
#endif /* __WINE_STDIO_H */

View File

@ -8,8 +8,7 @@
#ifndef __WINE_WCHAR_H
#define __WINE_WCHAR_H
#include <corecrt.h>
#include <stdarg.h>
#include <corecrt_wstdio.h>
#include <string.h>
#include <pshpack8.h>
@ -43,10 +42,6 @@ extern "C" {
typedef int mbstate_t;
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#ifndef _FSIZE_T_DEFINED
typedef __msvcrt_ulong _fsize_t;
#define _FSIZE_T_DEFINED
@ -82,21 +77,6 @@ struct tm {
};
#endif /* _TM_DEFINED */
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
typedef struct _iobuf
{
char* _ptr;
int _cnt;
char* _base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char* _tmpfname;
} FILE;
#endif /* _FILE_DEFINED */
#ifndef _WFINDDATA_T_DEFINED
#define _WFINDDATA_T_DEFINED
@ -314,83 +294,6 @@ int __cdecl _wstati64(const wchar_t*,struct _stati64*);
int __cdecl _wstat64(const wchar_t*,struct _stat64*);
#endif /* _WSTAT_DEFINED */
#ifndef _WSTDIO_DEFINED
#define _WSTDIO_DEFINED
wint_t __cdecl _fgetwc_nolock(FILE*);
wint_t __cdecl _fgetwchar(void);
wint_t __cdecl _fputwc_nolock(wint_t,FILE*);
wint_t __cdecl _fputwchar(wint_t);
wint_t __cdecl _getwc_nolock(FILE*);
wchar_t* __cdecl _getws(wchar_t*);
wint_t __cdecl _putwc_nolock(wint_t,FILE*);
int __cdecl _putws(const wchar_t*);
int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
int WINAPIV _scwprintf(const wchar_t*,...);
wint_t __cdecl _ungetwc_nolock(wint_t,FILE*);
int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
FILE* __cdecl _wfdopen(int,const wchar_t*);
FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
void __cdecl _wperror(const wchar_t*);
FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
int __cdecl _wremove(const wchar_t*);
wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
wchar_t* __cdecl _wtmpnam(wchar_t*);
wint_t __cdecl fgetwc(FILE*);
wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
wint_t __cdecl fputwc(wint_t,FILE*);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwprintf(FILE*,const wchar_t*,...);
int WINAPIV fwprintf_s(FILE*,const wchar_t*,...);
int __cdecl fputws(const wchar_t*,FILE*);
int WINAPIV fwscanf(FILE*,const wchar_t*,...);
int WINAPIV fwscanf_s(FILE*,const wchar_t*,...);
wint_t __cdecl getwc(FILE*);
wint_t __cdecl getwchar(void);
wchar_t* __cdecl getws(wchar_t*);
wint_t __cdecl putwc(wint_t,FILE*);
wint_t __cdecl putwchar(wint_t);
int __cdecl putws(const wchar_t*);
int WINAPIV swprintf_s(wchar_t*,size_t,const wchar_t*,...);
int WINAPIV swscanf(const wchar_t*,const wchar_t*,...);
int WINAPIV swscanf_s(const wchar_t*,const wchar_t*,...);
wint_t __cdecl ungetwc(wint_t,FILE*);
int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
int __cdecl vwprintf(const wchar_t*,__ms_va_list);
int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
int WINAPIV wprintf(const wchar_t*,...);
int WINAPIV wprintf_s(const wchar_t*,...);
int WINAPIV wscanf(const wchar_t*,...);
int WINAPIV wscanf_s(const wchar_t*,...);
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
#else /* _CRT_NON_CONFORMING_SWPRINTFS */
static inline int vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args) { return _vsnwprintf(buffer,size,format,args); }
static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
{
int ret;
__ms_va_list args;
__ms_va_start(args, format);
ret = _vsnwprintf(buffer, size, format, args);
__ms_va_end(args);
return ret;
}
#endif /* _CRT_NON_CONFORMING_SWPRINTFS */
#endif /* _WSTDIO_DEFINED */
#ifndef _WSTDLIB_DEFINED
#define _WSTDLIB_DEFINED
wchar_t* __cdecl _itow(int,wchar_t*,int);