Mans Rullgard <[email protected]> writes:

> From: "Ronald S. Bultje" <[email protected]>
>
> ---
>  libavformat/network.h |    8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/libavformat/network.h b/libavformat/network.h
> index 72d01d2..5c70e2d 100644
> --- a/libavformat/network.h
> +++ b/libavformat/network.h
> @@ -31,10 +31,18 @@
>  #include <winsock2.h>
>  #include <ws2tcpip.h>
>
> +#ifndef EPROTONOSUPPORT
>  #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
> +#endif
> +#ifndef ETIMEDOUT
>  #define ETIMEDOUT       WSAETIMEDOUT
> +#endif
> +#ifndef ECONNREFUSED
>  #define ECONNREFUSED    WSAECONNREFUSED
> +#endif
> +#ifndef EINPROGRESS
>  #define EINPROGRESS     WSAEINPROGRESS
> +#endif
>
>  int ff_neterrno(void);
>  #else
> -- 

I fail to see the need for this.  Quoting
http://msdn.microsoft.com/en-us/library/ms737828

  For compatibility with Berkeley UNIX (BSD), early versions of Windows
  (Windows 95 with the Windows Socket 2 Update and Windows 98, for
  example) redefined regular Berkeley error constants typically found in
  errno.h on BSD as the equivalent Windows Sockets WSA errors. So for
  example, ECONNREFUSED was defined as WSAECONNREFUSED in the Winsock.h
  header file. In subsequent versions of Windows (Windows NT 3.1 and
  later) these defines were commented out to avoid conflicts with
  errno.h used with Microsoft C/C++ and Visual Studio.

  The Winsock2.h header file included with the Microsoft Windows
  Software Development Kit (SDK), Platform Software Development Kit
  (SDK), and Visual Studio still contains a commented out block of
  defines within an #ifdef 0 and #endif block that define the BSD socket
  error codes to be the same as the WSA error constants. These can be
  used to provide some compatibility with UNIX, BSD, and Linux socket
  programming. For compatibility with BSD, an application may choose to
  change the Winsock2.h and uncomment this block. However, application
  developers are strongly discouraged from uncommenting this block
  because of inevitable conflicts with errno.h in most
  applications. Also, the BSD socket errors are defined to very
  different values than are used in UNIX, BSD, and Linux
  programs. Application developers are very strongly encouraged to use
  the WSA error constants in socket applications.

Unless someone has tampered with their winsock headers, these names
should not be defined.  If the headers have been modified, that is
really not our problem.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to