[xiph-commits] r3087 - liboggplay/trunk/src/liboggplay
laser13 at svn.annodex.net
laser13 at svn.annodex.net
Tue Jun 26 22:56:20 PDT 2007
Author: laser13
Date: 2007-06-26 22:56:20 -0700 (Tue, 26 Jun 2007)
New Revision: 3087
Modified:
liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
Close on socket is closesocket in Winsock terms.
Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-27 05:40:24 UTC (rev 3086)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-27 05:56:20 UTC (rev 3087)
@@ -390,8 +390,8 @@
offset = pos - (char *)(me->buffer);
memmove(me->buffer, pos, nbytes - offset);
me->amount_in_memory = nbytes - offset;
- me->backing_store = tmpfile();
- fwrite(me->buffer, 1, me->amount_in_memory, me->backing_store);
+ me->backing_store = tmpfile();
+ fwrite(me->buffer, 1, me->amount_in_memory, me->backing_store);
me->current_position = 0;
me->stored_offset = me->amount_in_memory;
me->amount_in_memory = 0;
@@ -429,8 +429,8 @@
}
me->amount_in_memory += nbytes;
remaining -= nbytes;
- }
- fwrite(me->buffer, 1, me->amount_in_memory, me->backing_store);
+ }
+ fwrite(me->buffer, 1, me->amount_in_memory, me->backing_store);
me->stored_offset += me->amount_in_memory;
me->amount_in_memory = 0;
me->state = OTRS_INIT_COMPLETE;
@@ -478,13 +478,13 @@
int remaining;
int r;
-
+
if (me->socket == INVALID_SOCKET) return E_OGGPLAY_OK;
/*
* see if we can grab some more data
* if we're not blocking, make sure there's some available data
- */
+ */
if (!block) {
struct timeval tv;
fd_set reads;
@@ -494,25 +494,29 @@
tv.tv_usec = 0;
FD_ZERO(&reads);
FD_ZERO(&empty);
- FD_SET(me->socket, &reads);
- if (select(me->socket + 1, &reads, &empty, &empty, &tv) == 0) {
+ FD_SET(me->socket, &reads);
+ if (select(me->socket + 1, &reads, &empty, &empty, &tv) == 0) {
return E_OGGPLAY_OK;
- }
+ }
}
remaining = me->buffer_size;
-#ifdef WIN32
+#ifdef WIN32
r = recv(me->socket, (char*)(me->buffer + me->amount_in_memory),
- remaining, 0);
+ remaining, 0);
#else
r = read(me->socket, me->buffer + me->amount_in_memory, remaining);
#endif
if (!block && r <= 0) {
- close(me->socket);
+#ifdef WIN32
+ closesocket(me->socket);
+#else
+ close(me->socket);
+#endif
me->socket = INVALID_SOCKET;
}
-
+
fwrite(me->buffer, 1, r, me->backing_store);
me->stored_offset += r;
More information about the commits
mailing list