raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=786ab74d6daa18bc1c04e2c97f5ca5212d707b78

commit 786ab74d6daa18bc1c04e2c97f5ca5212d707b78
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Jul 7 15:41:44 2015 +0900

    ecore animator - use windows ifdefs/macros so it works there
---
 src/lib/ecore/ecore_anim.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index 027753d..46d4e91 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -11,6 +11,27 @@
 #include <sys/select.h>
 #include <fcntl.h>
 
+#ifdef _WIN32
+
+# include <winsock2.h>
+
+# define pipe_write(fd, buffer, size) send((fd), (char *)(buffer), size, 0)
+# define pipe_read(fd, buffer, size)  recv((fd), (char *)(buffer), size, 0)
+# define pipe_close(fd)               closesocket(fd)
+# define PIPE_FD_ERROR   SOCKET_ERROR
+
+#else
+
+# include <unistd.h>
+# include <fcntl.h>
+
+# define pipe_write(fd, buffer, size) write((fd), buffer, size)
+# define pipe_read(fd, buffer, size)  read((fd), buffer, size)
+# define pipe_close(fd)               close(fd)
+# define PIPE_FD_ERROR   -1
+
+#endif /* ! _WIN32 */
+
 #include <Eo.h>
 
 #include "Ecore.h"
@@ -68,7 +89,7 @@ static void
 _tick_send(char val)
 {
    DBG("_tick_send(%i)", val);
-   write(timer_fd_write, &val, 1);
+   pipe_write(timer_fd_write, &val, 1);
 }
 
 static void
@@ -118,7 +139,7 @@ _timer_tick_core(void *data EINA_UNUSED, Ecore_Thread 
*thread)
           }
         if ((ret == 1) && (FD_ISSET(timer_fd_read, &rfds)))
           {
-             read(timer_fd_read, &tick, sizeof(tick));
+             pipe_read(timer_fd_read, &tick, sizeof(tick));
              DBG("tick = %i", tick);
              if (tick == -1) goto done;
           }
@@ -128,9 +149,9 @@ _timer_tick_core(void *data EINA_UNUSED, Ecore_Thread 
*thread)
           }
      }
 done:
-   close(timer_fd_read);
+   pipe_close(timer_fd_read);
    timer_fd_read = -1;
-   close(timer_fd_write);
+   pipe_close(timer_fd_write);
    timer_fd_write = -1;
 }
 
@@ -157,12 +178,12 @@ _timer_tick_finished(void *data EINA_UNUSED, Ecore_Thread 
*thread EINA_UNUSED)
    timer_thread = NULL;
    if (timer_fd_read >= 0)
      {
-        close(timer_fd_read);
+        pipe_close(timer_fd_read);
         timer_fd_read = -1;
      }
    if (timer_fd_write >= 0)
      {
-        close(timer_fd_write);
+        pipe_close(timer_fd_write);
         timer_fd_write = -1;
      }
 }

-- 


Reply via email to