Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/eet

Dir     : e17/libs/eet/src/lib


Modified Files:
        Eet.h Eet_private.h Makefile.am eet_data.c eet_image.c 
        eet_lib.c 


Log Message:

use evil on win32:

 * remove all the specific win32 code
 * replace EAPI by EAPI_DEF in front of definitions of funtions
 * no need to check windows.h, winsock2.h
 * sys/mmap.h will be detected automatically (thanks to evil on win32)
 * use AC_CHECK_HEADERS instead of AC_CHECK_HEADERS_ONCE as this macro is too 
recent (from autoconf 2.59c)


===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/Eet.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- Eet.h       1 Mar 2008 06:38:09 -0000       1.45
+++ Eet.h       2 Mar 2008 06:49:48 -0000       1.46
@@ -6,12 +6,13 @@
 #ifdef EAPI
 #undef EAPI
 #endif
-#ifdef _MSC_VER
-# ifdef BUILDING_DLL
+#ifdef _WIN32
+# ifdef DLL_EXPORT
 #  define EAPI __declspec(dllexport)
 # else
 #  define EAPI __declspec(dllimport)
 # endif
+# define EAPI_DEF
 #else
 # ifdef __GNUC__
 #  if __GNUC__ >= 4
@@ -22,6 +23,7 @@
 # else
 #  define EAPI
 # endif
+# define EAPI_DEF EAPI
 #endif
 
 #ifdef __cplusplus
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/Eet_private.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- Eet_private.h       1 Mar 2008 06:38:09 -0000       1.19
+++ Eet_private.h       2 Mar 2008 06:49:48 -0000       1.20
@@ -33,8 +33,9 @@
 #ifdef HAVE_NETINET_IN_H
 # include <netinet/in.h>
 #endif
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
+
+#ifdef HAVE_EVIL
+# include <Evil.h>
 #endif
 
 #include <zlib.h>
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- Makefile.am 1 Mar 2008 06:38:09 -0000       1.18
+++ Makefile.am 2 Mar 2008 06:49:48 -0000       1.19
@@ -6,7 +6,8 @@
 -I$(top_srcdir)/src/lib \
 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\"
+-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
[EMAIL PROTECTED]@
 
 lib_LTLIBRARIES      = libeet.la
 include_HEADERS      = Eet.h
@@ -19,6 +20,6 @@
 eet_utils.c \
 Eet_private.h
 
-libeet_la_LIBADD       = -lz -ljpeg @fnmatch_libs@ @winsock_libs@ -lm
+libeet_la_LIBADD       = @EVIL_LIBS@ -lz -ljpeg @fnmatch_libs@ @win32_libs@ -lm
 libeet_la_DEPENDENCIES = $(top_builddir)/config.h
 libeet_la_LDFLAGS      = @create_shared_lib@ -version-info @version_info@
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_data.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- eet_data.c  1 Mar 2008 06:38:09 -0000       1.63
+++ eet_data.c  2 Mar 2008 06:49:48 -0000       1.64
@@ -878,7 +878,7 @@
 
 /*---*/
 
-EAPI Eet_Data_Descriptor *
+EAPI_DEF Eet_Data_Descriptor *
 eet_data_descriptor_new(const char *name,
                        int size,
                        void *(*func_list_next) (void *l),
@@ -914,7 +914,7 @@
 }
 
 /* new replcement */
-EAPI Eet_Data_Descriptor *
+EAPI_DEF Eet_Data_Descriptor *
 eet_data_descriptor2_new(Eet_Data_Descriptor_Class *eddc)
 {
    Eet_Data_Descriptor *edd;
@@ -949,7 +949,7 @@
    return edd;
 }
 
-EAPI Eet_Data_Descriptor *
+EAPI_DEF Eet_Data_Descriptor *
 eet_data_descriptor3_new(Eet_Data_Descriptor_Class *eddc)
 {
    Eet_Data_Descriptor *edd;
@@ -988,7 +988,7 @@
    return edd;
 }
 
-EAPI void
+EAPI_DEF void
 eet_data_descriptor_free(Eet_Data_Descriptor *edd)
 {
    _eet_descriptor_hash_free(edd);
@@ -996,7 +996,7 @@
    free(edd);
 }
 
-EAPI void
+EAPI_DEF void
 eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, 
                                const char *name, int type,
                                int group_type,
@@ -1023,7 +1023,7 @@
    ede->subtype = subtype;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name)
 {
    const Eet_Dictionary *ed = NULL;
@@ -1049,7 +1049,7 @@
    return data_dec;
 }
 
-EAPI int
+EAPI_DEF int
 eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const 
void *data, int compress)
 {
    Eet_Dictionary       *ed;
@@ -2457,7 +2457,7 @@
    return NULL;
 }
 
-EAPI int
+EAPI_DEF int
 eet_data_text_dump(const void *data_in,
                   int size_in,
                   void (*dumpfunc) (void *data, const char *str),
@@ -2469,7 +2469,7 @@
    return 0;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_text_undump(const char *text,
                     int textlen,
                     int *size_ret)
@@ -2477,7 +2477,7 @@
    return _eet_data_dump_parse(NULL, size_ret, text, textlen);
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
                           const void *data_in,
                           int size_in)
@@ -2617,7 +2617,7 @@
    return cdata;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
                           const void *data_in,
                           int *size_ret)
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_image.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- eet_image.c 1 Mar 2008 06:38:09 -0000       1.15
+++ eet_image.c 2 Mar 2008 06:49:48 -0000       1.16
@@ -703,7 +703,7 @@
    return d;
 }
 
-EAPI int
+EAPI_DEF int
 eet_data_image_write(Eet_File *ef, const char *name,
                     const void *data, unsigned int w, unsigned int h, int 
alpha,
                     int compress, int quality, int lossy)
@@ -723,7 +723,7 @@
    return 0;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_image_read(Eet_File *ef, const char *name,
                    unsigned int *w, unsigned int *h, int *alpha,
                    int *compress, int *quality, int *lossy)
@@ -750,7 +750,7 @@
    return d;
 }
 
-EAPI int
+EAPI_DEF int
 eet_data_image_header_read(Eet_File *ef, const char *name,
                           unsigned int *w, unsigned int *h, int *alpha,
                           int *compress, int *quality, int *lossy)
@@ -775,7 +775,7 @@
    return d;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_image_encode(const void *data, int *size_ret, unsigned int w, 
unsigned int h, int alpha, int compress, int quality, int lossy)
 {
    void *d = NULL;
@@ -799,7 +799,7 @@
    return d;
 }
 
-EAPI int
+EAPI_DEF int
 eet_data_image_header_decode(const void *data, int size, unsigned int *w, 
unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
 {
    int header[8];
@@ -883,7 +883,7 @@
    return 0;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned 
int *h, int *alpha, int *compress, int *quality, int *lossy)
 {
    unsigned int *d = NULL;
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- eet_lib.c   2 Mar 2008 04:56:57 -0000       1.90
+++ eet_lib.c   2 Mar 2008 06:49:48 -0000       1.91
@@ -6,9 +6,7 @@
 #include "Eet_private.h"
 
 #include <sys/types.h>
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
+#include <sys/mman.h>
 
 #ifdef HAVE_REALPATH
 #undef HAVE_REALPATH
@@ -601,13 +599,13 @@
    return EET_ERROR_WRITE_ERROR;
 }
 
-EAPI int
+EAPI_DEF int
 eet_init(void)
 {
    return ++eet_initcount;
 }
 
-EAPI int
+EAPI_DEF int
 eet_shutdown(void)
 {
    if (--eet_initcount == 0)
@@ -619,7 +617,7 @@
    return eet_initcount;
 }
 
-EAPI void
+EAPI_DEF void
 eet_clearcache(void)
 {
    int num = 0;
@@ -1040,7 +1038,7 @@
    return NULL;
 }
 
-EAPI Eet_File *
+EAPI_DEF Eet_File *
 eet_memopen_read(const void *data, size_t size)
 {
    Eet_File    *ef;
@@ -1067,17 +1065,13 @@
    return eet_internal_read(ef);
 }
 
-EAPI Eet_File *
+EAPI_DEF Eet_File *
 eet_open(const char *file, Eet_File_Mode mode)
 {
    FILE         *fp;
    Eet_File    *ef;
    struct stat  file_stat;
 
-#ifdef _WIN32
-   HANDLE        h;
-#endif
-
    if (!file)
      return NULL;
 
@@ -1174,42 +1168,13 @@
    if (eet_test_close(!ef->fp, ef))
      return NULL;
 
-#ifndef _WIN32
    fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
-#else
-   /* FIXME: check if that code is needed / correct */
-   h = (HANDLE) _get_osfhandle(fileno(ef->fp));
-   if (h == INVALID_HANDLE_VALUE)
-     return NULL;
-   if (!SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0))
-     return NULL;
-#endif
    /* if we opened for read or read-write */
    if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
      {
-#ifdef _WIN32
-       HANDLE                  fm;
-#endif
-
-
        ef->data_size = file_stat.st_size;
-#ifndef _WIN32
        ef->data = mmap(NULL, ef->data_size, PROT_READ,
                        MAP_SHARED, fileno(ef->fp), 0);
-#else
-       fm = CreateFileMapping((HANDLE) _get_osfhandle (fileno(ef->fp)),
-                              NULL,
-                              PAGE_READONLY,
-                              0,
-                              0,
-                              NULL);
-       ef->data = MapViewOfFile(fm,
-                                FILE_MAP_READ,
-                                0,
-                                0,
-                                ef->data_size);
-       CloseHandle(fm);
-#endif
 
        ef = eet_internal_read(ef);
        if (!ef)
@@ -1265,7 +1230,7 @@
    return ef;
 }
 
-EAPI Eet_File_Mode
+EAPI_DEF Eet_File_Mode
 eet_mode_get(Eet_File *ef)
 {
    /* check to see its' an eet file pointer */
@@ -1275,7 +1240,7 @@
      return ef->mode;
 }
 
-EAPI Eet_Error
+EAPI_DEF Eet_Error
 eet_close(Eet_File *ef)
 {
    Eet_Error err;
@@ -1336,11 +1301,7 @@
 
    eet_dictionary_free(ef->ed);
 
-#ifndef _WIN32
    if (ef->data) munmap((void*)ef->data, ef->data_size);
-#else
-   if (ef->data) UnmapViewOfFile (ef->data);
-#endif
 
    if (ef->fp) fclose(ef->fp);
 
@@ -1352,7 +1313,7 @@
    return err;
 }
 
-EAPI void *
+EAPI_DEF void *
 eet_read(Eet_File *ef, const char *name, int *size_ret)
 {
    void                        *data = NULL;
@@ -1451,7 +1412,7 @@
    return data;
 }
 
-EAPI const void *
+EAPI_DEF const void *
 eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
 {
    const void  *data = NULL;
@@ -1496,7 +1457,7 @@
    return data;
 }
 
-EAPI int
+EAPI_DEF int
 eet_write(Eet_File *ef, const char *name, const void *data, int size, int 
compress)
 {
    Eet_File_Node       *efn;
@@ -1617,7 +1578,7 @@
    return data_size;
 }
 
-EAPI int
+EAPI_DEF int
 eet_delete(Eet_File *ef, const char *name)
 {
    Eet_File_Node       *efn;
@@ -1671,7 +1632,7 @@
    return exists_already;
 }
 
-EAPI Eet_Dictionary*
+EAPI_DEF Eet_Dictionary*
 eet_dictionary_get(Eet_File *ef)
 {
    if (eet_check_pointer(ef)) return NULL;
@@ -1680,7 +1641,7 @@
 }
 
 
-EAPI char **
+EAPI_DEF char **
 eet_list(Eet_File *ef, const char *glob, int *count_ret)
 {
    Eet_File_Node       *efn;
@@ -1748,7 +1709,7 @@
    return list_ret;
 }
 
-EAPI int
+EAPI_DEF int
 eet_num_entries(Eet_File *ef)
 {
    int i, num, ret = 0;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to