forked from enlightenment/efl
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) SVN revision: 33896
This commit is contained in:
parent
68a7734f67
commit
c0414ae96c
|
@ -30,23 +30,24 @@ AC_SUBST(version_info)
|
|||
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
|
||||
AC_CHECK_HEADER(jpeglib.h,, AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
|
||||
|
||||
AC_CHECK_HEADERS_ONCE(netinet/in.h sys/mman.h windows.h winsock2.h)
|
||||
|
||||
winsock_libs=""
|
||||
win32_libs=""
|
||||
create_shared_lib=""
|
||||
case "$host_os" in
|
||||
mingw|mingw32)
|
||||
winsock_libs="-lwsock32"
|
||||
PKG_CHECK_MODULES([EVIL], [evil])
|
||||
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
|
||||
win32_libs="-lws2_32"
|
||||
create_shared_lib="-no-undefined "
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(winsock_libs)
|
||||
AC_SUBST(win32_libs)
|
||||
AC_SUBST(create_shared_lib)
|
||||
|
||||
AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
|
||||
AC_CHECK_HEADER(jpeglib.h,, AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
|
||||
|
||||
AC_CHECK_HEADERS(netinet/in.h)
|
||||
|
||||
AC_CHECK_HEADER(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file. MinGW users: see the INSTALL file]))
|
||||
|
||||
fnmatch_libs=""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,8 +33,9 @@ void *alloca (size_t);
|
|||
#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>
|
||||
|
|
|
@ -6,7 +6,8 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/src/lib \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\"
|
||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||
@EVIL_CFLAGS@
|
||||
|
||||
lib_LTLIBRARIES = libeet.la
|
||||
include_HEADERS = Eet.h
|
||||
|
@ -19,6 +20,6 @@ eet_dictionary.c \
|
|||
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@
|
||||
|
|
|
@ -878,7 +878,7 @@ _eet_str_free(const char *str)
|
|||
|
||||
/*---*/
|
||||
|
||||
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 @@ eet_data_descriptor_new(const char *name,
|
|||
}
|
||||
|
||||
/* 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 @@ eet_data_descriptor2_new(Eet_Data_Descriptor_Class *eddc)
|
|||
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 @@ eet_data_descriptor3_new(Eet_Data_Descriptor_Class *eddc)
|
|||
return edd;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EAPI_DEF void
|
||||
eet_data_descriptor_free(Eet_Data_Descriptor *edd)
|
||||
{
|
||||
_eet_descriptor_hash_free(edd);
|
||||
|
@ -996,7 +996,7 @@ eet_data_descriptor_free(Eet_Data_Descriptor *edd)
|
|||
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 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
|
|||
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 @@ eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name)
|
|||
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 @@ error:
|
|||
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 @@ eet_data_text_dump(const void *data_in,
|
|||
return 0;
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
EAPI_DEF void *
|
||||
eet_data_text_undump(const char *text,
|
||||
int textlen,
|
||||
int *size_ret)
|
||||
|
@ -2477,7 +2477,7 @@ eet_data_text_undump(const char *text,
|
|||
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 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
|
|||
return cdata;
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
EAPI_DEF void *
|
||||
eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
|
||||
const void *data_in,
|
||||
int *size_ret)
|
||||
|
|
|
@ -703,7 +703,7 @@ eet_data_image_jpeg_alpha_convert(int *size, const void *data, unsigned int w, u
|
|||
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 @@ eet_data_image_write(Eet_File *ef, const char *name,
|
|||
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 @@ eet_data_image_read(Eet_File *ef, const char *name,
|
|||
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 @@ eet_data_image_header_read(Eet_File *ef, const char *name,
|
|||
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 @@ eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned
|
|||
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 @@ eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsign
|
|||
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;
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include "Eet_private.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REALPATH
|
||||
#undef HAVE_REALPATH
|
||||
|
@ -601,13 +599,13 @@ write_error:
|
|||
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 @@ eet_shutdown(void)
|
|||
return eet_initcount;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EAPI_DEF void
|
||||
eet_clearcache(void)
|
||||
{
|
||||
int num = 0;
|
||||
|
@ -1040,7 +1038,7 @@ eet_internal_read(Eet_File *ef)
|
|||
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 @@ eet_memopen_read(const void *data, size_t size)
|
|||
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 @@ eet_open(const char *file, Eet_File_Mode mode)
|
|||
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 @@ eet_open(const char *file, Eet_File_Mode mode)
|
|||
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 @@ eet_mode_get(Eet_File *ef)
|
|||
return ef->mode;
|
||||
}
|
||||
|
||||
EAPI Eet_Error
|
||||
EAPI_DEF Eet_Error
|
||||
eet_close(Eet_File *ef)
|
||||
{
|
||||
Eet_Error err;
|
||||
|
@ -1336,11 +1301,7 @@ eet_close(Eet_File *ef)
|
|||
|
||||
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 @@ eet_close(Eet_File *ef)
|
|||
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 @@ eet_read(Eet_File *ef, const char *name, int *size_ret)
|
|||
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 @@ eet_read_direct(Eet_File *ef, const char *name, int *size_ret)
|
|||
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 @@ eet_write(Eet_File *ef, const char *name, const void *data, int size, int compre
|
|||
return data_size;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
EAPI_DEF int
|
||||
eet_delete(Eet_File *ef, const char *name)
|
||||
{
|
||||
Eet_File_Node *efn;
|
||||
|
@ -1671,7 +1632,7 @@ eet_delete(Eet_File *ef, const char *name)
|
|||
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 @@ eet_dictionary_get(Eet_File *ef)
|
|||
}
|
||||
|
||||
|
||||
EAPI char **
|
||||
EAPI_DEF char **
|
||||
eet_list(Eet_File *ef, const char *glob, int *count_ret)
|
||||
{
|
||||
Eet_File_Node *efn;
|
||||
|
@ -1748,7 +1709,7 @@ eet_list(Eet_File *ef, const char *glob, int *count_ret)
|
|||
return list_ret;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
EAPI_DEF int
|
||||
eet_num_entries(Eet_File *ef)
|
||||
{
|
||||
int i, num, ret = 0;
|
||||
|
|
Loading…
Reference in New Issue