[vlc-commits] Lua: disable net.(poll|read|write) on Windows and document

Rémi Denis-Courmont git at videolan.org
Sun Jul 7 19:29:04 CEST 2013


vlc/vlc-2.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul  7 20:25:41 2013 +0300| [f2a48ba6ebd80a3f3dae9981b2914d47f8d86f20] | committer: Rémi Denis-Courmont

Lua: disable net.(poll|read|write) on Windows and document

These functions assume that sockets are file descriptors, never worked
properly on Windows. See also 3841c0859053d29058682650e87bf085632eea54.

(cherry picked from commit deb38e43ecf62699d62e2dc80fd4c4aea4ac0d32)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=f2a48ba6ebd80a3f3dae9981b2914d47f8d86f20
---

 modules/lua/libs/net.c |    4 ++++
 share/lua/README.txt   |    9 ++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/lua/libs/net.c b/modules/lua/libs/net.c
index 0f6b393..dd0719c 100644
--- a/modules/lua/libs/net.c
+++ b/modules/lua/libs/net.c
@@ -189,6 +189,7 @@ static int vlclua_net_recv( lua_State *L )
     return 1;
 }
 
+#ifndef _WIN32
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -277,6 +278,7 @@ static int vlclua_fd_read( lua_State *L )
         lua_pushnil( L );
     return 1;
 }
+#endif
 
 /*****************************************************************************
  *
@@ -366,9 +368,11 @@ static const luaL_Reg vlclua_net_reg[] = {
     { "close", vlclua_net_close },
     { "send", vlclua_net_send },
     { "recv", vlclua_net_recv },
+#ifndef _WIN32
     { "poll", vlclua_net_poll },
     { "read", vlclua_fd_read },
     { "write", vlclua_fd_write },
+#endif
     { "stat", vlclua_stat }, /* Not really "net" */
     { "opendir", vlclua_opendir }, /* Not really "net" */
     { NULL, NULL }
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 9c9c8ac..dc506af 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -185,10 +185,13 @@ net.send( fd, string, [length] ): Send data on fd.
 net.recv( fd, [max length] ): Receive data from fd.
 net.poll( { fd = events } ): Implement poll function.
   Returns the numbers of file descriptors with a non 0 revent. The function
-  modifies the input table to { fd = revents }. See "man poll".
+  modifies the input table to { fd = revents }. See "man poll". This function
+  is not available on Windows.
 net.POLLIN/POLLPRI/POLLOUT/POLLRDHUP/POLLERR/POLLHUP/POLLNVAL: poll event flags
-net.read( fd, [max length] ): Read data from fd.
-net.write( fd, string, [length] ): Write data to fd.
+net.read( fd, [max length] ): Read data from fd. This function is not
+  available on Windows.
+net.write( fd, string, [length] ): Write data to fd. This function is not
+  available on Windows.
 net.stat( path ): Stat a file. Returns a table with the following fields:
     .type
     .mode



More information about the vlc-commits mailing list