~ubuntu-branches/debian/squeeze/vlc/squeeze

« back to all changes in this revision

Viewing changes to extras/contrib/src/Patches/live-win32.patch

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Mutricy
  • Date: 2009-09-20 01:08:41 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090920010841-vc6vme91a70r5w0t
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Copyright (C) 2009 Laurent Aimar.
2
 
Licensed under GNU General Public License version 2 or higher.
3
 
diff -ur live/BasicUsageEnvironment/BasicTaskScheduler.cpp live-fix/BasicUsageEnvironment/BasicTaskScheduler.cpp
4
 
--- live/BasicUsageEnvironment/BasicTaskScheduler.cpp   2009-04-07 04:18:59.000000000 +0200
5
 
+++ live-fix/BasicUsageEnvironment/BasicTaskScheduler.cpp       2009-04-16 00:33:19.000000000 +0200
6
 
@@ -80,7 +80,7 @@
7
 
       int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
8
 
       FD_SET((unsigned)dummySocketNum, &fReadSet);
9
 
     }
10
 
-    if (err != 0) {
11
 
+    if (err != EINTR) {
12
 
 #else
13
 
     if (errno != EINTR && errno != EAGAIN) {
14
 
 #endif
15
 
diff -ur live/BasicUsageEnvironment/BasicUsageEnvironment.cpp live-fix/BasicUsageEnvironment/BasicUsageEnvironment.cpp
16
 
--- live/BasicUsageEnvironment/BasicUsageEnvironment.cpp        2009-04-07 04:18:59.000000000 +0200
17
 
+++ live-fix/BasicUsageEnvironment/BasicUsageEnvironment.cpp    2009-04-16 00:30:33.000000000 +0200
18
 
@@ -61,6 +61,20 @@
19
 
 #endif
20
 
 }
21
 
 
22
 
+int BasicUsageEnvironment::getNetErrno() const {
23
 
+#if defined(__WIN32__) || defined(_WIN32)
24
 
+#ifndef _WIN32_WCE
25
 
+    errno = WSAGetLastError();
26
 
+#endif
27
 
+#endif
28
 
+#if defined(_WIN32_WCE)
29
 
+  return WSAGetLastError();
30
 
+#else
31
 
+  return errno;
32
 
+#endif
33
 
+}
34
 
+
35
 
+
36
 
 UsageEnvironment& BasicUsageEnvironment::operator<<(char const* str) {
37
 
        fprintf(stderr, "%s", str);
38
 
        return *this;
39
 
diff -ur live/BasicUsageEnvironment/include/BasicUsageEnvironment.hh live-fix/BasicUsageEnvironment/include/BasicUsageEnvironment.hh
40
 
--- live/BasicUsageEnvironment/include/BasicUsageEnvironment.hh 2009-04-07 04:18:59.000000000 +0200
41
 
+++ live-fix/BasicUsageEnvironment/include/BasicUsageEnvironment.hh     2009-04-16 00:30:33.000000000 +0200
42
 
@@ -30,6 +30,7 @@
43
 
 
44
 
   // redefined virtual functions:
45
 
   virtual int getErrno() const;
46
 
+  virtual int getNetErrno() const;
47
 
 
48
 
   virtual UsageEnvironment& operator<<(char const* str);
49
 
   virtual UsageEnvironment& operator<<(int i);
50
 
diff -ur live/groupsock/GroupsockHelper.cpp live-fix/groupsock/GroupsockHelper.cpp
51
 
--- live/groupsock/GroupsockHelper.cpp  2009-04-07 04:18:59.000000000 +0200
52
 
+++ live-fix/groupsock/GroupsockHelper.cpp      2009-04-16 00:30:33.000000000 +0200
53
 
@@ -230,10 +230,13 @@
54
 
     if (timeout != NULL && result == 0) {
55
 
       break; // this is OK - timeout occurred
56
 
     } else if (result <= 0) {
57
 
+      if (env.getNetErrno() == EINTR ||
58
 
 #if defined(__WIN32__) || defined(_WIN32)
59
 
+          env.getNetErrno() == EWOULDBLOCK
60
 
 #else
61
 
-      if (errno == EINTR || errno == EAGAIN) continue;
62
 
+          env.getNetErrno() == EAGAIN
63
 
 #endif
64
 
+         ) continue;
65
 
       socketErr(env, "select() error: ");
66
 
       break;
67
 
     }
68
 
@@ -271,7 +274,7 @@
69
 
                         &addressSize);
70
 
     if (bytesRead < 0) {
71
 
       //##### HACK to work around bugs in Linux and Windows:
72
 
-      int err = env.getErrno();
73
 
+      int err = env.getNetErrno();
74
 
       if (err == 111 /*ECONNREFUSED (Linux)*/
75
 
 #if defined(__WIN32__) || defined(_WIN32)
76
 
          // What a piece of crap Windows is.  Sometimes
77
 
@@ -432,7 +435,7 @@
78
 
   if (setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
79
 
                 (const char*)&imr, sizeof (struct ip_mreq)) < 0) {
80
 
 #if defined(__WIN32__) || defined(_WIN32)
81
 
-    if (env.getErrno() != 0) {
82
 
+    if (env.getNetErrno() != 0) {
83
 
       // That piece-of-shit toy operating system (Windows) sometimes lies
84
 
       // about setsockopt() failing!
85
 
 #endif
86
 
diff -ur live/groupsock/include/NetCommon.h live-fix/groupsock/include/NetCommon.h
87
 
--- live/groupsock/include/NetCommon.h  2009-04-07 04:18:59.000000000 +0200
88
 
+++ live-fix/groupsock/include/NetCommon.h      2009-04-16 00:30:33.000000000 +0200
89
 
@@ -36,6 +36,8 @@
90
 
 
91
 
 #define closeSocket closesocket
92
 
 #define EWOULDBLOCK WSAEWOULDBLOCK
93
 
+#define EINPROGRESS WSAEWOULDBLOCK
94
 
+#define EINTR WSAEINTR
95
 
 
96
 
 #if defined(_WIN32_WCE)
97
 
 #define NO_STRSTREAM 1
98
 
diff -ur live/liveMedia/HTTPSink.cpp live-fix/liveMedia/HTTPSink.cpp
99
 
--- live/liveMedia/HTTPSink.cpp 2009-04-07 04:19:00.000000000 +0200
100
 
+++ live-fix/liveMedia/HTTPSink.cpp     2009-04-16 00:30:33.000000000 +0200
101
 
@@ -107,7 +107,7 @@
102
 
     fClientSocket = accept(fSocket, (struct sockaddr*)&clientAddr,
103
 
                           &clientAddrLen);
104
 
     if (fClientSocket < 0) {
105
 
-      int err = envir().getErrno();
106
 
+      int err = envir().getNetErrno();
107
 
       if (err != EWOULDBLOCK) {
108
 
        envir().setResultErrMsg("accept() failed: ");
109
 
        return False;
110
 
@@ -158,7 +158,7 @@
111
 
     int sendResult
112
 
       = send(fClientSocket, (char*)(&fBuffer[0]), frameSize, 0);
113
 
     if (sendResult < 0) {
114
 
-      int err = envir().getErrno();
115
 
+      int err = envir().getNetErrno();
116
 
       if (err != EWOULDBLOCK) {
117
 
        // The client appears to have gone; close him down,
118
 
        // and consider ourselves done:
119
 
diff -ur live/liveMedia/RTSPClient.cpp live-fix/liveMedia/RTSPClient.cpp
120
 
--- live/liveMedia/RTSPClient.cpp       2009-04-16 00:31:40.000000000 +0200
121
 
+++ live-fix/liveMedia/RTSPClient.cpp   2009-04-16 00:30:33.000000000 +0200
122
 
@@ -1834,11 +1834,7 @@
123
 
         makeSocketNonBlocking(fInputSocketNum);
124
 
       }
125
 
       if (connect(fInputSocketNum, (struct sockaddr*) &remoteName, sizeof remoteName) != 0) {
126
 
-#if defined(__WIN32__) || defined(_WIN32)
127
 
-        if (errno != WSAEINPROGRESS && errno != WSAEWOULDBLOCK) {
128
 
-#else
129
 
-        if (errno != EINPROGRESS) {
130
 
-#endif
131
 
+        if (envir().getNetErrno() != EINPROGRESS && envir().getNetErrno() != EWOULDBLOCK) {
132
 
           envir().setResultErrMsg("connect() failed: ");
133
 
           break;
134
 
         }
135
 
diff -ur live/liveMedia/RTSPOverHTTPServer.cpp live-fix/liveMedia/RTSPOverHTTPServer.cpp
136
 
--- live/liveMedia/RTSPOverHTTPServer.cpp       2009-04-07 04:19:00.000000000 +0200
137
 
+++ live-fix/liveMedia/RTSPOverHTTPServer.cpp   2009-04-16 00:30:33.000000000 +0200
138
 
@@ -119,7 +119,7 @@
139
 
   int clientSocket = accept(fServerSocket, (struct sockaddr*)&clientAddr,
140
 
                             &clientAddrLen);
141
 
   if (clientSocket < 0) {
142
 
-    int err = envir().getErrno();
143
 
+    int err = envir().getNetErrno();
144
 
     if (err != EWOULDBLOCK) {
145
 
       envir().setResultErrMsg("accept() failed: ");
146
 
     }
147
 
diff -ur live/liveMedia/RTSPServer.cpp live-fix/liveMedia/RTSPServer.cpp
148
 
--- live/liveMedia/RTSPServer.cpp       2009-04-07 04:19:00.000000000 +0200
149
 
+++ live-fix/liveMedia/RTSPServer.cpp   2009-04-16 00:30:33.000000000 +0200
150
 
@@ -226,7 +226,7 @@
151
 
   int clientSocket = accept(fServerSocket, (struct sockaddr*)&clientAddr,
152
 
                            &clientAddrLen);
153
 
   if (clientSocket < 0) {
154
 
-    int err = envir().getErrno();
155
 
+    int err = envir().getNetErrno();
156
 
     if (err != EWOULDBLOCK) {
157
 
         envir().setResultErrMsg("accept() failed: ");
158
 
     }
159
 
diff -ur live/UsageEnvironment/include/UsageEnvironment.hh live-fix/UsageEnvironment/include/UsageEnvironment.hh
160
 
--- live/UsageEnvironment/include/UsageEnvironment.hh   2009-04-07 04:18:59.000000000 +0200
161
 
+++ live-fix/UsageEnvironment/include/UsageEnvironment.hh       2009-04-16 00:30:33.000000000 +0200
162
 
@@ -71,6 +71,7 @@
163
 
 
164
 
   // 'errno'
165
 
   virtual int getErrno() const = 0;
166
 
+  virtual int getNetErrno() const = 0;
167
 
 
168
 
   // 'console' output:
169
 
   virtual UsageEnvironment& operator<<(char const* str) = 0;
170