shithub: opusfile

Download patch

ref: 4a5c89adcf9fc199603cdfe99afedaeacd63bf74
parent: 9c097eeeeac3f38d28d10f7d8c2c778d7e41c554
author: Ralph Giles <giles@mozilla.com>
date: Tue Nov 27 04:40:18 EST 2012

Move win32 source files up a level.

--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@
 	src/internal.c src/internal.h \
 	src/opusfile.c src/stream.c
 if OS_WIN32
-libopusfile_la_SOURCES += src/win32/wsockwrapper.c
+libopusfile_la_SOURCES += src/wsockwrapper.c
 endif
 libopusfile_la_LIBADD = $(DEPS_LIBS)
 if OS_WIN32
--- a/src/win32/winerrno.h
+++ /dev/null
@@ -1,52 +1,0 @@
-#ifndef WINERRNO_H
-#define WINERRNO_H
-
-#include <errno.h>
-
-/* XXX: conflicts with MSVC errno definition */
-#ifdef ENAMETOOLONG
-#undef ENAMETOOLONG
-#endif
-#ifdef ENOTEMPTY
-#undef ENOTEMPTY
-#endif
-
-#define EWOULDBLOCK          35
-#define EINPROGRESS          36
-#define EALREADY             37
-#define ENOTSOCK             38
-#define EDESTADDRREQ         39
-#define EMSGSIZE             40
-#define EPROTOTYPE           41
-#define ENOPROTOOPT          42
-#define EPROTONOSUPPORT      43
-#define ESOCKTNOSUPPORT      44
-#define EOPNOTSUPP           45
-#define EPFNOSUPPORT         46
-#define EAFNOSUPPORT         47
-#define EADDRINUSE           48
-#define EADDRNOTAVAIL        49
-#define ENETDOWN             50
-#define ENETUNREACH          51
-#define ENETRESET            52
-#define ECONNABORTED         53
-#define ECONNRESET           54
-#define ENOBUFS              55
-#define EISCONN              56
-#define ENOTCONN             57
-#define ESHUTDOWN            58
-#define ETOOMANYREFS         59
-#define ETIMEDOUT            60
-#define ECONNREFUSED         61
-#define ELOOP                62
-#define ENAMETOOLONG         63
-#define EHOSTDOWN            64
-#define EHOSTUNREACH         65
-#define ENOTEMPTY            66
-#define EPROCLIM             67
-#define EUSERS               68
-#define EDQUOT               69
-#define ESTALE               70
-#define EREMOTE              71
-
-#endif
--- a/src/win32/wsockwrapper.c
+++ /dev/null
@@ -1,44 +1,0 @@
-#include <stdio.h>
-#include "wsockwrapper.h"
-
-int win32_poll(struct pollfd *fds, unsigned nfds, int timeout)
-{
-    fd_set ifds, ofds, efds;
-    struct timeval tv;
-    unsigned i;
-    int rc;
-
-    FD_ZERO(&ifds);
-    FD_ZERO(&ofds);
-    FD_ZERO(&efds);
-    for (i = 0; i < nfds; ++i) {
-	fds[i].revents = 0;
-	if (fds[i].events & POLLIN)
-	    FD_SET(fds[i].fd, &ifds);
-	if (fds[i].events & POLLOUT)
-	    FD_SET(fds[i].fd, &ofds);
-	FD_SET(fds[i].fd, &efds);
-    }
-    if (timeout >= 0) {
-	tv.tv_sec = timeout / 1000;
-	tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
-    }
-    rc = select(255, &ifds, &ofds, &efds, timeout < 0 ? 0 : &tv);
-    if (rc > 0) {
-	for (i = 0; i < nfds; ++i) {
-	    if (FD_ISSET(fds[i].fd, &ifds))
-		fds[i].revents |= POLLIN;
-	    if (FD_ISSET(fds[i].fd, &ofds))
-		fds[i].revents |= POLLOUT;
-	    if (FD_ISSET(fds[i].fd, &efds))
-		fds[i].revents |= POLLHUP;
-	}
-    }
-    return rc;
-}
-
-int win32_ftime(struct timeb *timer)
-{
-    ftime(timer);
-    return 0;
-}
--- a/src/win32/wsockwrapper.h
+++ /dev/null
@@ -1,25 +1,0 @@
-#ifndef WSOCKWRAPPER_H
-#define WSOCKWRAPPER_H
-
-#include <winsock2.h>
-#include <sys/timeb.h>
-
-#define POLLIN      0x0001    /* There is data to read */
-#define POLLPRI     0x0002    /* There is urgent data to read */
-#define POLLOUT     0x0004    /* Writing now will not block */
-#define POLLERR     0x0008    /* Error condition */
-#define POLLHUP     0x0010    /* Hung up */
-#define POLLNVAL    0x0020    /* Invalid request: fd not open */
-
-struct pollfd {
-    SOCKET fd;        /* file descriptor */
-    short events;     /* requested events */
-    short revents;    /* returned events */
-};
-
-#define poll(x, y, z) win32_poll(x, y, z)
-int win32_poll(struct pollfd *, unsigned int, int);
-
-int win32_ftime(struct timeb *timer);
-
-#endif
--- /dev/null
+++ b/src/winerrno.h
@@ -1,0 +1,52 @@
+#ifndef WINERRNO_H
+#define WINERRNO_H
+
+#include <errno.h>
+
+/* XXX: conflicts with MSVC errno definition */
+#ifdef ENAMETOOLONG
+#undef ENAMETOOLONG
+#endif
+#ifdef ENOTEMPTY
+#undef ENOTEMPTY
+#endif
+
+#define EWOULDBLOCK          35
+#define EINPROGRESS          36
+#define EALREADY             37
+#define ENOTSOCK             38
+#define EDESTADDRREQ         39
+#define EMSGSIZE             40
+#define EPROTOTYPE           41
+#define ENOPROTOOPT          42
+#define EPROTONOSUPPORT      43
+#define ESOCKTNOSUPPORT      44
+#define EOPNOTSUPP           45
+#define EPFNOSUPPORT         46
+#define EAFNOSUPPORT         47
+#define EADDRINUSE           48
+#define EADDRNOTAVAIL        49
+#define ENETDOWN             50
+#define ENETUNREACH          51
+#define ENETRESET            52
+#define ECONNABORTED         53
+#define ECONNRESET           54
+#define ENOBUFS              55
+#define EISCONN              56
+#define ENOTCONN             57
+#define ESHUTDOWN            58
+#define ETOOMANYREFS         59
+#define ETIMEDOUT            60
+#define ECONNREFUSED         61
+#define ELOOP                62
+#define ENAMETOOLONG         63
+#define EHOSTDOWN            64
+#define EHOSTUNREACH         65
+#define ENOTEMPTY            66
+#define EPROCLIM             67
+#define EUSERS               68
+#define EDQUOT               69
+#define ESTALE               70
+#define EREMOTE              71
+
+#endif
--- /dev/null
+++ b/src/wsockwrapper.c
@@ -1,0 +1,44 @@
+#include <stdio.h>
+#include "wsockwrapper.h"
+
+int win32_poll(struct pollfd *fds, unsigned nfds, int timeout)
+{
+    fd_set ifds, ofds, efds;
+    struct timeval tv;
+    unsigned i;
+    int rc;
+
+    FD_ZERO(&ifds);
+    FD_ZERO(&ofds);
+    FD_ZERO(&efds);
+    for (i = 0; i < nfds; ++i) {
+	fds[i].revents = 0;
+	if (fds[i].events & POLLIN)
+	    FD_SET(fds[i].fd, &ifds);
+	if (fds[i].events & POLLOUT)
+	    FD_SET(fds[i].fd, &ofds);
+	FD_SET(fds[i].fd, &efds);
+    }
+    if (timeout >= 0) {
+	tv.tv_sec = timeout / 1000;
+	tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
+    }
+    rc = select(255, &ifds, &ofds, &efds, timeout < 0 ? 0 : &tv);
+    if (rc > 0) {
+	for (i = 0; i < nfds; ++i) {
+	    if (FD_ISSET(fds[i].fd, &ifds))
+		fds[i].revents |= POLLIN;
+	    if (FD_ISSET(fds[i].fd, &ofds))
+		fds[i].revents |= POLLOUT;
+	    if (FD_ISSET(fds[i].fd, &efds))
+		fds[i].revents |= POLLHUP;
+	}
+    }
+    return rc;
+}
+
+int win32_ftime(struct timeb *timer)
+{
+    ftime(timer);
+    return 0;
+}
--- /dev/null
+++ b/src/wsockwrapper.h
@@ -1,0 +1,25 @@
+#ifndef WSOCKWRAPPER_H
+#define WSOCKWRAPPER_H
+
+#include <winsock2.h>
+#include <sys/timeb.h>
+
+#define POLLIN      0x0001    /* There is data to read */
+#define POLLPRI     0x0002    /* There is urgent data to read */
+#define POLLOUT     0x0004    /* Writing now will not block */
+#define POLLERR     0x0008    /* Error condition */
+#define POLLHUP     0x0010    /* Hung up */
+#define POLLNVAL    0x0020    /* Invalid request: fd not open */
+
+struct pollfd {
+    SOCKET fd;        /* file descriptor */
+    short events;     /* requested events */
+    short revents;    /* returned events */
+};
+
+#define poll(x, y, z) win32_poll(x, y, z)
+int win32_poll(struct pollfd *, unsigned int, int);
+
+int win32_ftime(struct timeb *timer);
+
+#endif