vfwcap: Unbreak building after c201069fa

Message ID 1428661574-34424-1-git-send-email-martin@martin.st
State Committed
Commit 4f373a5111f900af54301907132942f95276285c
Headers show

Commit Message

Martin Storsjö April 10, 2015, 10:26 a.m.
These headers can't be included in any arbitrary order.
---
Updated the comment about winsock2.h vs windows.h; on MSVC it is an error
to include them in the wrong order, while mingw only warns about it.
---
 libavdevice/vfwcap.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Derek Buitenhuis April 10, 2015, 9:11 p.m. | #1
On 4/10/2015 11:26 AM, Martin Storsjö wrote:
> These headers can't be included in any arbitrary order.
> ---
> Updated the comment about winsock2.h vs windows.h; on MSVC it is an error
> to include them in the wrong order, while mingw only warns about it.
> ---
>  libavdevice/vfwcap.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

OK.

- Derek

Patch

diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 4182642..5e2ba84 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -19,9 +19,6 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <vfw.h>
-#include <windows.h>
-
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
@@ -30,6 +27,12 @@ 
 #include "libavformat/avformat.h"
 #include "libavformat/internal.h"
 
+// windows.h must no be included before winsock2.h, and libavformat internal
+// headers may include winsock2.h
+#include <windows.h>
+// windows.h needs to be included before vfw.h
+#include <vfw.h>
+
 /* Some obsolete versions of MinGW32 before 4.0.0 lack this. */
 #ifndef HWND_MESSAGE
 #define HWND_MESSAGE ((HWND) -3)