[FFmpeg-devel] lavu/internal: Never use %t and %z on Windows

Submitted by Carl Eugen Hoyos on Dec. 20, 2016, 2:15 a.m.

Details

Message ID 201612200315.33782.cehoyos@ag.or.at
State New
Headers show

Commit Message

Carl Eugen Hoyos Dec. 20, 2016, 2:15 a.m.
Hi!

Attached patch is supposed to fix an issue reported by Blake Senftner 
on libav-user.

Please comment, Carl Eugen
From dbb730692ebb81377bc3db0df50b3c32ca0def16 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Tue, 20 Dec 2016 03:11:54 +0100
Subject: [PATCH] lavu/internal: Never use %t or %z format specifiers, not
 even with mingw.

Fixes using an av_log() callback with mingw libraries in Visual Studio.
---
 configure            |    2 ++
 libavutil/internal.h |    3 +++
 2 files changed, 5 insertions(+)

Comments

Hendrik Leppkes Dec. 20, 2016, 9:37 a.m.
On Tue, Dec 20, 2016 at 3:15 AM, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
> Hi!
>
> Attached patch is supposed to fix an issue reported by Blake Senftner
> on libav-user.
>

Sorry, but those guys are just using it wrong. Those format specifiers
are perfectly valid in a mingw build, and if you mix different
compilers its your responsibility to make sure it doesn't explode, not
something we need to fix for them.

-  Hendrik
Carl Eugen Hoyos Dec. 20, 2016, 11:18 a.m.
2016-12-20 10:37 GMT+01:00 Hendrik Leppkes <h.leppkes@gmail.com>:
> On Tue, Dec 20, 2016 at 3:15 AM, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
>> Hi!
>>
>> Attached patch is supposed to fix an issue reported by Blake Senftner
>> on libav-user.
>
> Sorry, but those guys are just using it wrong. Those format specifiers
> are perfectly valid in a mingw build, and if you mix different
> compilers its your responsibility to make sure it doesn't explode, not
> something we need to fix for them.

Don't we document (for a very long time) how to use mingw libraries
from Visual Studio?

More important though: Do you believe the patch may break something?
If not, why do you oppose?

Carl Eugen
Carl Eugen Hoyos Jan. 24, 2017, 11:48 p.m.
2016-12-20 12:18 GMT+01:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 2016-12-20 10:37 GMT+01:00 Hendrik Leppkes <h.leppkes@gmail.com>:
>> On Tue, Dec 20, 2016 at 3:15 AM, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
>>> Hi!
>>>
>>> Attached patch is supposed to fix an issue reported by Blake Senftner
>>> on libav-user.
>>
>> Sorry, but those guys are just using it wrong. Those format specifiers
>> are perfectly valid in a mingw build, and if you mix different
>> compilers its your responsibility to make sure it doesn't explode, not
>> something we need to fix for them.
>
> Don't we document (for a very long time) how to use mingw libraries
> from Visual Studio?
>
> More important though: Do you believe the patch may break something?
> If not, why do you oppose?

Ping.

Carl Eugen

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index 9dfd006..70993de 100755
--- a/configure
+++ b/configure
@@ -2052,6 +2052,8 @@  HAVE_LIST="
     dos_paths
     dxva2_lib
     dxva2api_cobj
+    libc_mingw32
+    libc_mingw64
     libc_msvcrt
     libdc1394_1
     libdc1394_2
diff --git a/libavutil/internal.h b/libavutil/internal.h
index e995af9..e994e8a 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -245,6 +245,9 @@  void avpriv_request_sample(void *avc,
 
 #define avpriv_open ff_open
 #define avpriv_tempfile ff_tempfile
+#endif
+
+#if HAVE_LIBC_MSVCRT || HAVE_LIBC_MINGW32 || HAVE_LIBC_MINGW64
 #define PTRDIFF_SPECIFIER "Id"
 #define SIZE_SPECIFIER "Iu"
 #else