Re: [Mingw-w64-public] [PATCH] include/stdio: Move macro push/pops outside any `#if...#endif` blocks
On Sun, 16 May 2021, Liu Hao wrote: LGTM // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] headers: Add missing interfaces in mfidl.idl.
From 12d026984d097182a49b950a1cbdd8f64d2ce659 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Sun, 16 May 2021 18:58:54 +0530 Subject: [PATCH] headers: Add missing interfaces in mfidl.idl. Signed-off-by: Biswapriyo Nath --- mingw-w64-headers/include/mfidl.idl | 174 +++- 1 file changed, 168 insertions(+), 6 deletions(-) diff --git a/mingw-w64-headers/include/mfidl.idl b/mingw-w64-headers/include/mfidl.idl index ed74c74..65a5b80 100644 --- a/mingw-w64-headers/include/mfidl.idl +++ b/mingw-w64-headers/include/mfidl.idl @@ -602,8 +602,9 @@ enum MF_RESOLUTION_WRITE = 0x0002 }; -/* FIXME: Properly declare followinf interfaces: */ -interface IMFMediaSink; +/* Forward declaration goes here. + * Just for ease, declare interfaces alphabatically. + */ interface IMFASFContentInfo; interface IMFASFIndexer; interface IMFASFMultiplexer; @@ -614,14 +615,175 @@ interface IMFPresentationClock; interface IMFNetProxyLocator; interface IMFRemoteDesktopPlugin; interface IMFTransform; -interface IMFSampleGrabberSinkCallback; interface IMFSequencerSource; +interface IMFStreamSink; interface IMFQualityManager; -interface IMFSourceResolver; -interface IMFPresentationTimeSource; -interface IMFTopoLoader; interface IMFTranscodeProfile; +[object, uuid(76b1bbdb-4ec8-4f36-b106-70a9316df593)] +interface IMFAudioStreamVolume : IUnknown +{ + HRESULT GetChannelCount([out] UINT32 *pdwCount); + HRESULT SetChannelVolume([in] UINT32 dwIndex, [in] const float fLevel); + HRESULT GetChannelVolume([in] UINT32 dwIndex, [out] float *pfLevel); + HRESULT SetAllVolumes([in] UINT32 dwCount, [in, size_is(dwCount)] const float *pfVolumes); + HRESULT GetAllVolumes([in] UINT32 dwCount, [out, size_is(dwCount)] float *pfVolumes); +} + +[object, uuid(6ef2a660-47c0-4666-b13d-cbb717f2fa2c)] +interface IMFMediaSink : IUnknown +{ + HRESULT GetCharacteristics([out] DWORD *pdwCharacteristics); + HRESULT AddStreamSink([in] DWORD dwStreamSinkIdentifier, [in] IMFMediaType *pMediaType, [out] IMFStreamSink **ppStreamSink); + HRESULT RemoveStreamSink([in] DWORD dwStreamSinkIdentifier); + HRESULT GetStreamSinkCount([out] DWORD *pcStreamSinkCount); + HRESULT GetStreamSinkByIndex([in] DWORD dwIndex, [out] IMFStreamSink **ppStreamSink); + HRESULT GetStreamSinkById([in] DWORD dwStreamSinkIdentifier, [out] IMFStreamSink **ppStreamSink); + HRESULT SetPresentationClock([in] IMFPresentationClock *pPresentationClock); + HRESULT GetPresentationClock([out] IMFPresentationClock **ppPresentationClock); + HRESULT Shutdown(void); +} + +[object, uuid(eaecb74a-9a50-42ce-9541-6a7f57aa4ad7), local] +interface IMFFinalizableMediaSink : IMFMediaSink +{ + HRESULT BeginFinalize([in] IMFAsyncCallback *pCallback, [in] IUnknown *punkState); + HRESULT EndFinalize([in] IMFAsyncResult *pResult); +} + +[object, uuid(5dfd4b2a-7674-4110-a4e6-8a68fd5f3688)] +interface IMFMediaSinkPreroll : IUnknown +{ + HRESULT NotifyPreroll([in] MFTIME hnsUpcomingStartTime); +} + +[object, uuid(d182108f-4ec6-443f-aa42-a71106ec825f)] +interface IMFMediaStream : IMFMediaEventGenerator +{ + HRESULT GetMediaSource([out] IMFMediaSource**ppMediaSource); + HRESULT GetStreamDescriptor([out] IMFStreamDescriptor **ppStreamDescriptor); + + [local] + HRESULT RequestSample([in] IUnknown *pToken); + + [call_as(RequestSample)] + HRESULT RemoteRequestSample(void); +} + +[object, uuid(f88cfb8c-ef16-4991-b450-cb8c69e51704)] +interface IMFMetadata : IUnknown +{ + HRESULT SetLanguage([in] LPCWSTR pwszRFC1766); + HRESULT GetLanguage([out] LPWSTR *ppwszRFC1766); + HRESULT GetAllLanguages([out] PROPVARIANT *ppvLanguages); + HRESULT SetProperty([in] LPCWSTR pwszName, [in] const PROPVARIANT *ppvValue); + HRESULT GetProperty([in] LPCWSTR pwszName, [out] PROPVARIANT *ppvValue); + HRESULT DeleteProperty([in] LPCWSTR pwszName); + HRESULT GetAllPropertyNames([out] PROPVARIANT *ppvNames); +} + +[object, uuid(56181d2d-e221-4adb-b1c8-3cee6a53f76f)] +interface IMFMetadataProvider : IUnknown +{ + HRESULT GetMFMetadata([in] IMFPresentationDescriptor *pPresentationDescriptor, [in] DWORD dwStreamIdentifier, [in] DWORD dwFlags, [out] IMFMetadata **ppMFMetadata); +} + +[object, uuid(7ff12cce-f76f-41c2-863b-1666c8e5e139)] +interface IMFPresentationTimeSource : IMFClock +{ + HRESULT GetUnderlyingClock([out] IMFClock **ppClock); +} + +[object, uuid(868ce85c-8ea9-4f55-ab82-b009a910a805)] +interface IMFPresentationClock : IMFClock +{ + HRESULT SetTimeSource([in] IMFPresentationTimeSource *pTimeSource); + HRESULT GetTimeSource([out] IMFPresentationTimeSource **ppTimeSource); + HRESULT GetTime([out] MFTIME *phnsClockTime); + HRESULT AddClockStateSink([in] IMFClockStateSink *pStateSink); + HRESULT RemoveClockStateSink([in] IMFClockStateSink* pStateSink); + HRESULT Start([in] LONGLONG llClockStartOffset); + HRESULT Stop(void); + HRESULT Pause(void); +} + +[object, uuid(88ddcd21-03c3-4275-91ed-55ee3929328f),
[Mingw-w64-public] [PATCH] include/stdio: Move macro push/pops outside any `#if...#endif` blocks
-- Best regards, Liu Hao From dbdc6232eb45a8a3f8830c3664b41efd49388d04 Mon Sep 17 00:00:00 2001 From: Liu Hao Date: Sun, 16 May 2021 20:25:06 +0800 Subject: [PATCH] include/stdio: Move macro push/pops outside any `#if...#endif` blocks Some projects have `#define snprintf _snprintf`, which causes errors for UCRT. This patch moves those macros so they have effects on both MSVCRT and UCRT. Signed-off-by: Liu Hao --- mingw-w64-headers/crt/stdio.h | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index cbc0ce3e..0769e1e5 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -10,6 +10,15 @@ #pragma pack(push,_CRT_PACKING) +#pragma push_macro("snprintf") +#undef snprintf +#pragma push_macro("vsnprintf") +#undef vsnprintf +#pragma push_macro("snwprintf") +#undef snwprintf +#pragma push_macro("vsnwprintf") +#undef vsnwprintf + #ifdef __cplusplus extern "C" { #endif @@ -824,10 +833,6 @@ char * tmpnam(char * __dst) #pragma GCC diagnostic ignored "-Wshadow" #endif -#pragma push_macro("snprintf") -#pragma push_macro("vsnprintf") -# undef snprintf -# undef vsnprintf __attribute__((__format__ (ms_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3) int __cdecl __ms_vsnprintf(char * __restrict__ d,size_t n,const char * __restrict__ format,va_list arg) __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_SEC_WARN; @@ -910,8 +915,6 @@ int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, #endif /* __MINGW_FORTIFY_LEVEL > 0 */ -#pragma pop_macro ("vsnprintf") -#pragma pop_macro ("snprintf") #ifdef __GNUC__ #pragma GCC diagnostic pop #endif @@ -1341,10 +1344,6 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ #if __USE_MINGW_ANSI_STDIO == 0 -#pragma push_macro("snwprintf") -#pragma push_macro("vsnwprintf") -# undef snwprintf -# undef vsnwprintf int __cdecl __ms_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); int __cdecl __ms_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list); __mingw_ovr @@ -1362,8 +1361,6 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti { return _vsnwprintf(s,n,format,arg); } -#pragma pop_macro ("vsnwprintf") -#pragma pop_macro ("snwprintf") #endif #endif /* ! __NO_ISOCEXT */ @@ -1551,6 +1548,11 @@ void __cdecl __mingw_str_free(void *ptr); } #endif +#pragma pop_macro("snprintf") +#pragma pop_macro("vsnprintf") +#pragma pop_macro("snwprintf") +#pragma pop_macro("vsnwprintf") + #pragma pack(pop) #include -- 2.31.1 OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] stdio.h: redefinition issues with UCRT
On Sun, May 16, 2021 at 11:58 AM Liu Hao wrote: > Who was it that added the `#define`? Users should have known that `_snprintf` > does not > null-terminate the output string if there is no enough room in the output > buffer, which is rather > dangerous. Some projects I've seen it in: gimp, silc-toolkit, libconfig, emacs I agree that it is wrong and we are patching things to not use _snprintf. On the one hand it exposes likely bugs on the other it is not behaving like with msvcrt. I'm not 100% sure what the right call here is. Here is the resulting error btw (which is somewhat confusing at first): In file included from D:/a/_temp/msys/msys64/ucrt64/include/libintl.h:314, from D:/a/_temp/msys/msys64/ucrt64/include/glib-2.0/glib/gi18n.h:23, from ../script-fu-intl.h:28, from scheme.c:49: D:/a/_temp/msys/msys64/ucrt64/x86_64-w64-mingw32/include/stdio.h:746:15: error: redefinition of '_snprintf' 746 | int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) | ^ scheme.c:35:18: note: previous definition of '_snprintf' was here 35 | #define snprintf _snprintf | ^ scheme.c: In function 'alloc_cellseg': ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
On 5/16/21 10:52 AM, Liu Hao wrote: 在 2021-05-16 18:49, JonY via Mingw-w64-public 写道: Updated. Thanks. LGTM. Thanks for the review, pushed to master. OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
在 2021-05-16 18:49, JonY via Mingw-w64-public 写道: Updated. Thanks. LGTM. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
On 5/16/21 9:36 AM, Liu Hao wrote: 在 2021-05-16 17:21, JonY via Mingw-w64-public 写道: diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 3754dc64..b9277bd0 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -143,8 +143,12 @@ extern "C" { #endif #ifndef _HUGE +#ifdef _UCRT + extern double const _HUGE; +#else Because of the check for `_HUGE`, is it necessary to keep it as such, by `#define _HUGE _HUGE`? In old MSVC CRT headers it was not a macro, which has already been an deviation. Updated. From 5a4f14f69909ff85eb661a18f098cf53100e98fe Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10wa...@gmail.com> Date: Sat, 15 May 2021 12:56:51 + Subject: [PATCH] crt: _HUGE for UCRT Signed-off-by: Jonathan Yong <10wa...@gmail.com> --- mingw-w64-crt/Makefile.am| 1 + mingw-w64-crt/math/_huge.c | 2 ++ mingw-w64-headers/crt/math.h | 5 + 3 files changed, 8 insertions(+) create mode 100644 mingw-w64-crt/math/_huge.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 1f48b72e..47db28bf 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -229,6 +229,7 @@ src_msvcrt=\ src_ucrtbase=\ crt/ucrtbase_compat.c \ + math/_huge.c \ stdio/ucrt_fprintf.c \ stdio/ucrt_fscanf.c \ stdio/ucrt_fwprintf.c \ diff --git a/mingw-w64-crt/math/_huge.c b/mingw-w64-crt/math/_huge.c new file mode 100644 index ..dd43f841 --- /dev/null +++ b/mingw-w64-crt/math/_huge.c @@ -0,0 +1,2 @@ +/* For UCRT, positive infinity */ +double const _HUGE = __builtin_huge_val(); diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 3754dc64..59560a35 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -143,8 +143,13 @@ extern "C" { #endif #ifndef _HUGE +#ifdef _UCRT + extern double const _HUGE; +#define _HUGE _HUGE +#else extern double * __MINGW_IMP_SYMBOL(_HUGE); #define _HUGE (* __MINGW_IMP_SYMBOL(_HUGE)) +#endif /* _UCRT */ #endif #ifdef __GNUC__ -- 2.31.1 OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Add more GUIDs in mfidl.idl.
在 2021-05-15 13:19, Biswapriyo Nath 写道: Subject: [PATCH] headers: Add more GUIDs in mfidl.idl. Signed-off-by: Biswapriyo Nath --- mingw-w64-headers/include/mfidl.idl | 55 + 1 file changed, 55 insertions(+) Thanks. This patch looks good to me. Pushed. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
在 2021-05-16 17:21, JonY via Mingw-w64-public 写道: diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 3754dc64..b9277bd0 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -143,8 +143,12 @@ extern "C" { #endif #ifndef _HUGE +#ifdef _UCRT + extern double const _HUGE; +#else Because of the check for `_HUGE`, is it necessary to keep it as such, by `#define _HUGE _HUGE`? In old MSVC CRT headers it was not a macro, which has already been an deviation. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] stdio.h: redefinition issues with UCRT
在 2021-05-15 15:01, Christoph Reiter 写道: Hey, while trying to get everything to build with UCRT in MSYS2 we noticed quite a few errors that come down to the following: // gcc -D__USE_MINGW_ANSI_STDIO=1 a.c #define snprintf _snprintf #include int main (){return 0;} i.e. snprintf is defined before stdio.h, messing it up Who was it that added the `#define`? Users should have known that `_snprintf` does not null-terminate the output string if there is no enough room in the output buffer, which is rather dangerous. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
On 5/16/21 8:25 AM, Liu Hao wrote: 在 2021-05-15 23:23, JonY via Mingw-w64-public 写道: The prototype declares it as a non-const, will it be a problem? In addition, it looks like UCRT doesn't declare it as an imported symbol any more. It's plain `extern double const _HUGE;` now. Patch updated. From 98dd88793f9f54a77c58c8bffbe673a09d9abf7c Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10wa...@gmail.com> Date: Sat, 15 May 2021 12:56:51 + Subject: [PATCH] crt: _HUGE for UCRT Signed-off-by: Jonathan Yong <10wa...@gmail.com> --- mingw-w64-crt/Makefile.am| 1 + mingw-w64-crt/math/_huge.c | 2 ++ mingw-w64-headers/crt/math.h | 4 3 files changed, 7 insertions(+) create mode 100644 mingw-w64-crt/math/_huge.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 1f48b72e..47db28bf 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -229,6 +229,7 @@ src_msvcrt=\ src_ucrtbase=\ crt/ucrtbase_compat.c \ + math/_huge.c \ stdio/ucrt_fprintf.c \ stdio/ucrt_fscanf.c \ stdio/ucrt_fwprintf.c \ diff --git a/mingw-w64-crt/math/_huge.c b/mingw-w64-crt/math/_huge.c new file mode 100644 index ..dd43f841 --- /dev/null +++ b/mingw-w64-crt/math/_huge.c @@ -0,0 +1,2 @@ +/* For UCRT, positive infinity */ +double const _HUGE = __builtin_huge_val(); diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 3754dc64..b9277bd0 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -143,8 +143,12 @@ extern "C" { #endif #ifndef _HUGE +#ifdef _UCRT + extern double const _HUGE; +#else extern double * __MINGW_IMP_SYMBOL(_HUGE); #define _HUGE (* __MINGW_IMP_SYMBOL(_HUGE)) +#endif /* _UCRT */ #endif #ifdef __GNUC__ -- 2.31.1 OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
在 2021-05-15 23:23, JonY via Mingw-w64-public 写道: The prototype declares it as a non-const, will it be a problem? Yes, I think it should be `const double` instead of plain `double`. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt
在 2021-05-15 23:23, JonY via Mingw-w64-public 写道: The prototype declares it as a non-const, will it be a problem? In addition, it looks like UCRT doesn't declare it as an imported symbol any more. It's plain `extern double const _HUGE;` now. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public