diff mbox

[FFmpeg-devel] fix MSVC compilation errors

Message ID 20171208074652.2608-1-mateuszb@poczta.onet.pl
State New
Headers show

Commit Message

Mateusz Dec. 8, 2017, 7:46 a.m. UTC
After commit 3701d49 'error_resilience: remove avpriv_atomic usage'
we have included windows.h in much more files and we should
avoid conflicts with defines/function declarations.

Signed-off-by: Mateusz Brzostek <mateuszb@poczta.onet.pl>
---
 libavcodec/jpegls.h   | 2 ++
 libavcodec/mjpegdec.h | 2 ++
 libavcodec/mss2.c     | 6 +++---
 libavformat/mxfenc.c  | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Dec. 8, 2017, 6:42 p.m. UTC | #1
On Fri, Dec 08, 2017 at 08:46:52AM +0100, Mateusz wrote:
> After commit 3701d49 'error_resilience: remove avpriv_atomic usage'
> we have included windows.h in much more files and we should
> avoid conflicts with defines/function declarations.
> 
> Signed-off-by: Mateusz Brzostek <mateuszb@poczta.onet.pl>
> ---
>  libavcodec/jpegls.h   | 2 ++
>  libavcodec/mjpegdec.h | 2 ++
>  libavcodec/mss2.c     | 6 +++---
>  libavformat/mxfenc.c  | 2 +-
>  4 files changed, 8 insertions(+), 4 deletions(-)

tested on x86-32/64/arm/mips linux & x86-32/64 mingw

thx

[...]
Michael Niedermayer Dec. 10, 2017, 1:44 p.m. UTC | #2
On Fri, Dec 08, 2017 at 07:42:50PM +0100, Michael Niedermayer wrote:
> On Fri, Dec 08, 2017 at 08:46:52AM +0100, Mateusz wrote:
> > After commit 3701d49 'error_resilience: remove avpriv_atomic usage'
> > we have included windows.h in much more files and we should
> > avoid conflicts with defines/function declarations.
> > 
> > Signed-off-by: Mateusz Brzostek <mateuszb@poczta.onet.pl>
> > ---
> >  libavcodec/jpegls.h   | 2 ++
> >  libavcodec/mjpegdec.h | 2 ++
> >  libavcodec/mss2.c     | 6 +++---
> >  libavformat/mxfenc.c  | 2 +-
> >  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> tested on x86-32/64/arm/mips linux & x86-32/64 mingw

applied with the no longer needed hunk from mxfenc

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/jpegls.h b/libavcodec/jpegls.h
index c8997c7861..6b89b2afa3 100644
--- a/libavcodec/jpegls.h
+++ b/libavcodec/jpegls.h
@@ -32,6 +32,8 @@ 
 #include "avcodec.h"
 #include "internal.h"
 
+#undef near /* This file uses struct member 'near' which in windows.h is defined as empty. */
+
 typedef struct JpeglsContext {
     AVCodecContext *avctx;
 } JpeglsContext;
diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h
index c84a40aa6e..c36fba5f22 100644
--- a/libavcodec/mjpegdec.h
+++ b/libavcodec/mjpegdec.h
@@ -39,6 +39,8 @@ 
 #include "hpeldsp.h"
 #include "idctdsp.h"
 
+#undef near /* This file uses struct member 'near' which in windows.h is defined as empty. */
+
 #define MAX_COMPONENTS 4
 
 typedef struct MJpegDecodeContext {
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 9e7cc466de..3180af1d60 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -464,9 +464,9 @@  static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
     return 0;
 }
 
-typedef struct Rectangle {
+struct Rectangle {
     int coded, x, y, w, h;
-} Rectangle;
+};
 
 #define MAX_WMV9_RECTANGLES 20
 #define ARITH2_PADDING 2
@@ -485,7 +485,7 @@  static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     int keyframe, has_wmv9, has_mv, is_rle, is_555, ret;
 
-    Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
+    struct Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
     int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
 
     if ((ret = init_get_bits8(&gb, buf, buf_size)) < 0)
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index ed6ecbf541..407acdcaaa 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1444,7 +1444,7 @@  static int mxf_write_header_metadata_sets(AVFormatContext *s)
     AVStream *st = NULL;
     int i;
 
-    MXFPackage packages[2] = {};
+    MXFPackage packages[2] = {{NULL}};
     int package_count = 2;
     packages[0].type = MaterialPackage;
     packages[1].type = SourcePackage;