[PATCH 0/3] MR10130: Some updates to msvcrt headers.
Found when cross-compiling a PE library with Wine headers. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10130
From: Eric Pouech <epouech@codeweavers.com> Signed-off-by: Eric Pouech <epouech@codeweavers.com> --- include/msvcrt/corecrt_wstdio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/msvcrt/corecrt_wstdio.h b/include/msvcrt/corecrt_wstdio.h index bc5196686c1..7d4274783b2 100644 --- a/include/msvcrt/corecrt_wstdio.h +++ b/include/msvcrt/corecrt_wstdio.h @@ -405,7 +405,7 @@ static inline int __cdecl wscanf(FILE *file, const wchar_t *format, ...) va_list args; va_start(args, format); - ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, stdin, format, NULL, args); + ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, file, format, NULL, args); va_end(args); return ret; } @@ -416,7 +416,7 @@ static inline int __cdecl wscanf_s(FILE *file, const wchar_t *format, ...) va_list args; va_start(args, format); - ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, stdin, format, NULL, args); + ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, file, format, NULL, args); va_end(args); return ret; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10130
From: Eric Pouech <epouech@codeweavers.com> When stdint.h and intsafe.h are both #include:d, we should ensure that #define:s on both files are exactly the same in order not to have preprocessor errors. Signed-off-by: Eric Pouech <epouech@codeweavers.com> --- include/msvcrt/stdint.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/msvcrt/stdint.h b/include/msvcrt/stdint.h index 6efea0b73cf..8484c20acd4 100644 --- a/include/msvcrt/stdint.h +++ b/include/msvcrt/stdint.h @@ -70,19 +70,19 @@ typedef unsigned long long uintmax_t; defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L /* 7.18.2.1 Limits of exact-width integer types */ -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647 - 1) -#define INT64_MIN (-9223372036854775807LL - 1) - -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 -#define INT64_MAX 9223372036854775807LL - -#define UINT8_MAX 255 -#define UINT16_MAX 65535 -#define UINT32_MAX 0xffffffffU /* 4294967295U */ +#define INT8_MIN (-0x80) +#define INT16_MIN (-0x8000) +#define INT32_MIN (-0x7fffffff - 1) +#define INT64_MIN (-0x7fffffffffffffffLL - 1) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffff +#define INT64_MAX 0x7fffffffffffffffLL + +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffffu /* 4294967295U */ #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ /* 7.18.2.2 Limits of minimum-width integer types */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10130
From: Eric Pouech <epouech@codeweavers.com> Signed-off-by: Eric Pouech <epouech@codeweavers.com> --- include/msvcrt/time.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h index 6634795b10e..f62e6633b3e 100644 --- a/include/msvcrt/time.h +++ b/include/msvcrt/time.h @@ -111,6 +111,7 @@ static inline char* ctime(const time_t *t) { return _ctime64(t); } static inline errno_t ctime_s(char *res, size_t len, const __time64_t *t) { return _ctime64_s(res, len, t); } static inline double difftime(time_t t1, time_t t2) { return _difftime64(t1, t2); } static inline struct tm* gmtime(const time_t *t) { return _gmtime64(t); } +static inline int gmtime_s(struct tm* res, const time_t *t) { return _gmtime64_s(res, t); } static inline struct tm* localtime(const time_t *t) { return _localtime64(t); } static inline errno_t localtime_s(struct tm *res, const time_t *t) { return _localtime64_s(res, t); } static inline time_t mktime(struct tm *tm) { return _mktime64(tm); } @@ -120,6 +121,7 @@ static inline char* ctime(const time_t *t) { return _ctime32(t); } static inline errno_t ctime_s(char *res, size_t len, const __time32_t *t) { return _ctime32_s(res, len, t); } static inline double difftime(time_t t1, time_t t2) { return _difftime32(t1, t2); } static inline struct tm* gmtime(const time_t *t) { return _gmtime32(t); } +static inline int gmtime_s(struct tm* res, const time_t *t) { return _gmtime32_s(res, t); } static inline struct tm* localtime(const time_t *t) { return _localtime32(t); } static inline errno_t localtime_s(struct tm *res, const time_t *t) { return _localtime32_s(res, t); } static inline time_t mktime(struct tm *tm) { return _mktime32(tm); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10130
participants (2)
-
Eric Pouech -
eric pouech (@epo)