Ticket #1257: closesocket.patch

File closesocket.patch, 6.4 KB (added by serge.levin.spb@…, 18 years ago)

bogus closesocket check. Also closesocket definition is wrapped with #ifndef HAVE_CLOSESOCKET

  • stream/http.c

     
    1111#include <string.h>
    1212#include <unistd.h>
    1313
    14 #ifndef HAVE_WINSOCK2_H
     14#ifndef HAVE_CLOSESOCKET
    1515#define closesocket close
    16 #else
     16#endif
     17
     18#ifdef HAVE_WINSOCK2_H
    1719#include <winsock2.h>
    1820#include <ws2tcpip.h>
    1921#endif
  • stream/udp.c

     
    3131#include <sys/time.h>
    3232#include <ctype.h>
    3333
     34#ifndef HAVE_CLOSESOCKET
     35#define closesocket close
     36#endif
    3437#ifndef HAVE_WINSOCK2_H
    3538#include <netdb.h>
    3639#include <netinet/in.h>
    3740#include <sys/socket.h>
    3841#include <arpa/inet.h>
    39 #define closesocket close
    4042#else
    4143#include <winsock2.h>
    4244#include <ws2tcpip.h>
  • stream/network.c

     
    1919#include "mp_msg.h"
    2020#include "help_mp.h"
    2121
    22 #ifndef HAVE_WINSOCK2_H
     22#ifndef HAVE_CLOSESOCKET
    2323#define closesocket close
    24 #else
     24#endif
     25
     26#ifdef HAVE_WINSOCK2_H
    2527#include <winsock2.h>
    2628#include <ws2tcpip.h>
    2729#endif
  • stream/pnm.c

     
    3535#include <stdlib.h>
    3636#include <sys/time.h>
    3737#include <inttypes.h>
     38#ifndef HAVE_CLOSESOCKET
     39#define closesocket close
     40#endif
    3841#ifndef HAVE_WINSOCK2_H
    39 #define closesocket close
    4042#include <sys/socket.h>
    4143//#include <netinet/in.h>
    4244//#include <netdb.h>
  • stream/stream_rtsp.c

     
    2828#include <sys/types.h>
    2929#include <ctype.h>
    3030#include "config.h"
     31#ifndef HAVE_CLOSESOCKET
     32#define closesocket close
     33#endif
    3134#ifndef HAVE_WINSOCK2_H
    3235#include <netinet/in.h>
    3336#include <sys/socket.h>
    3437#include <arpa/inet.h>
    35 #define closesocket close
    3638#else
    3739#include <winsock2.h>
    3840#include <ws2tcpip.h>
  • stream/rtp.c

     
    1313#include <sys/types.h>
    1414#include <ctype.h>
    1515#include "config.h"
     16#ifndef HAVE_CLOSESOCKET
     17#define closesocket close
     18#endif
    1619#ifndef HAVE_WINSOCK2_H
    1720#include <netinet/in.h>
    1821#include <sys/socket.h>
    1922#include <arpa/inet.h>
    20 #define closesocket close
    2123#else
    2224#include <winsock2.h>
    2325#include <ws2tcpip.h>
  • stream/tcp.c

     
    2020#include "mp_msg.h"
    2121#include "help_mp.h"
    2222
     23#ifndef HAVE_CLOSESOCKET
     24#define closesocket close
     25#endif
    2326#ifndef HAVE_WINSOCK2_H
    2427#include <netdb.h>
    2528#include <netinet/in.h>
    2629#include <sys/socket.h>
    2730#include <arpa/inet.h>
    28 #define closesocket close
    2931#else
    3032#include <winsock2.h>
    3133#include <ws2tcpip.h>
  • stream/librtsp/rtsp_session.c

     
    3030
    3131#include <sys/types.h>
    3232#include "config.h"
     33#ifndef HAVE_CLOSESOCKET
     34#define closesocket close
     35#endif
    3336#ifndef HAVE_WINSOCK2_H
    34 #define closesocket close
    3537#include <sys/socket.h>
    3638#include <netinet/in.h>
    3739#include <netdb.h>
  • stream/stream_netstream.c

     
    4242#include <inttypes.h>
    4343#include <errno.h>
    4444
     45#ifndef HAVE_CLOSESOCKET
     46#define closesocket close
     47#endif
    4548#ifndef HAVE_WINSOCK2_H
    46 #define closesocket close
    4749#include <sys/socket.h>
    4850#include <netinet/in.h>
    4951#include <arpa/inet.h>
  • stream/asf_mmst_streaming.c

     
    3939#include "mp_msg.h"
    4040#include "help_mp.h"
    4141
    42 #ifndef HAVE_WINSOCK2_H
     42#ifndef HAVE_CLOSESOCKET
    4343#define closesocket close
    44 #else
     44#endif
     45
     46#ifdef HAVE_WINSOCK2_H
    4547#include <winsock2.h>
    4648#endif
    4749
  • stream/stream.c

     
    1414
    1515#include "config.h"
    1616
    17 #ifndef HAVE_WINSOCK2_H
     17#ifndef HAVE_CLOSESOCKET
    1818#define closesocket close
    19 #else
     19#endif
     20
     21#ifdef HAVE_WINSOCK2_H
    2022#include <winsock2.h>
    2123#endif
    2224
  • stream/stream_ftp.c

     
    99#include <fcntl.h>
    1010#include <unistd.h>
    1111#include <errno.h>
     12#ifndef HAVE_CLOSESOCKET
     13#define closesocket close
     14#endif
    1215#ifndef HAVE_WINSOCK2_H
    1316#include <sys/socket.h>
    14 #define closesocket close
    1517#else
    1618#include <winsock2.h>
    1719#endif
  • stream/asf_streaming.c

     
    99#include "mp_msg.h"
    1010#include "help_mp.h"
    1111
    12 #ifndef HAVE_WINSOCK2_H
     12#ifndef HAVE_CLOSESOCKET
    1313#define closesocket close
    14 #else
     14#endif
     15
     16#ifdef HAVE_WINSOCK2_H
    1517#include <winsock2.h>
    1618#endif
    1719
  • libvo/vo_bl.c

     
    3434
    3535#include "config.h"
    3636
     37#ifndef HAVE_CLOSESOCKET
     38#define closesocket close
     39#endif
    3740#ifndef HAVE_WINSOCK2_H
    38 #define closesocket close
    3941#include <netdb.h>
    4042#include <sys/socket.h>
    4143#include <netinet/in.h>
  • configure

     
    28992899for header in "arpa/inet.h" "winsock2.h" ; do
    29002900  cat > $TMPC << EOF
    29012901#include <$header>
    2902 int main(void) { closesocket(); return 0; }
     2902int main(void) { closesocket( ~0 ); return 0; }
    29032903EOF
    2904   cc_check && _closesocket=yes && break
     2904  cc_check $_ld_sock && _closesocket=yes && break
    29052905done
    29062906if test "$_closesocket" = yes ; then
    29072907  _def_closesocket='#define HAVE_CLOSESOCKET 1'