forked from enlightenment/efl
* AUTHORS:
* src/lib/Evil.h: * src/lib/Makefile.am: * src/lib/evil_inet.c: * src/lib/evil_mman.c: * src/lib/evil_stdio.c: * src/lib/evil_stdio.h: * src/lib/evil_stdlib.c: * src/lib/evil_util.c: * src/lib/sys/mman.h: * src/lib/evil_printa.c (added): * src/lib/evil_pformatw.c (added): * src/lib/evil_pformat.h (added): * src/lib/evil_printw.c (added): * src/lib/evil_print.h (added): * src/lib/evil_macro.h (added): * src/lib/evil_pformata.c (added): Add POSIX printf family. Code taken from the MinGW-w64 project and modified to be integrated into Evil. * src/bin/Makefile.am: * src/bin/evil_suite.c: * src/bin/evil_test_util.h (added): * src/bin/evil_test_print.c (added): * src/bin/evil_test_print.h (added): * src/bin/evil_test_util.c (added): Add util and printf unit tests * src/lib/evil_errno.c: * src/lib/errno.h (deleted): * src/lib/mingw32ce (added): * src/lib/mingw32ce/errno.h (added): Move errno.h for Windows CE in its own directory to suppress conflicts with standard errno.h when compiling for Windows XP. * src/lib/dlfcn/dlfcn.c: * src/lib/evil_link_ce.c: * src/lib/evil_main.c: * src/lib/evil_unistd.c: Define WIN32_LEAN_AND_MEAN only if it's not defined. * src/lib/evil_fcntl.c: Remove debug. * src/bin/evil_test_dlfcn.c: * src/bin/evil_test_environment.c: * src/bin/evil_test_gettimeofday.c: * src/bin/evil_test_link.c: * src/bin/evil_test_mkstemp.c: * src/bin/evil_test_pipe.c: * src/bin/evil_test_realpath.c: Remove warnings. * src/lib/evil_link_xp.cpp: Formatting. SVN revision: 68084
This commit is contained in:
parent
30d73cffd7
commit
b9728980ab
|
@ -5,3 +5,4 @@ Main Authors:
|
|||
Vincent Richomme <vrichomme at smartmobili dot com>
|
||||
Paul Vixie (ISC) (inet_pton and inet_ntop functions)
|
||||
Daniel Stenberg (inet_pton and inet_ntop functions)
|
||||
The MinGW and MinGW-w64 teams (POSIX printf family functions)
|
||||
|
|
|
@ -1,3 +1,62 @@
|
|||
2012-02-17 Vincent Torri <doursse at users dot sf dot net>
|
||||
|
||||
* AUTHORS:
|
||||
* src/lib/Evil.h:
|
||||
* src/lib/Makefile.am:
|
||||
* src/lib/evil_inet.c:
|
||||
* src/lib/evil_mman.c:
|
||||
* src/lib/evil_stdio.c:
|
||||
* src/lib/evil_stdio.h:
|
||||
* src/lib/evil_stdlib.c:
|
||||
* src/lib/evil_util.c:
|
||||
* src/lib/sys/mman.h:
|
||||
* src/lib/evil_printa.c (added):
|
||||
* src/lib/evil_pformatw.c (added):
|
||||
* src/lib/evil_pformat.h (added):
|
||||
* src/lib/evil_printw.c (added):
|
||||
* src/lib/evil_print.h (added):
|
||||
* src/lib/evil_macro.h (added):
|
||||
* src/lib/evil_pformata.c (added):
|
||||
Add POSIX printf family. Code taken from the MinGW-w64
|
||||
project and modified to be integrated into Evil.
|
||||
|
||||
* src/bin/Makefile.am:
|
||||
* src/bin/evil_suite.c:
|
||||
* src/bin/evil_test_util.h (added):
|
||||
* src/bin/evil_test_print.c (added):
|
||||
* src/bin/evil_test_print.h (added):
|
||||
* src/bin/evil_test_util.c (added):
|
||||
Add util and printf unit tests
|
||||
|
||||
* src/lib/evil_errno.c:
|
||||
* src/lib/errno.h (deleted):
|
||||
* src/lib/mingw32ce (added):
|
||||
* src/lib/mingw32ce/errno.h (added):
|
||||
Move errno.h for Windows CE in its own directory to
|
||||
suppress conflicts with standard errno.h when compiling
|
||||
for Windows XP.
|
||||
|
||||
* src/lib/dlfcn/dlfcn.c:
|
||||
* src/lib/evil_link_ce.c:
|
||||
* src/lib/evil_main.c:
|
||||
* src/lib/evil_unistd.c:
|
||||
Define WIN32_LEAN_AND_MEAN only if it's not defined.
|
||||
|
||||
* src/lib/evil_fcntl.c:
|
||||
Remove debug.
|
||||
|
||||
* src/bin/evil_test_dlfcn.c:
|
||||
* src/bin/evil_test_environment.c:
|
||||
* src/bin/evil_test_gettimeofday.c:
|
||||
* src/bin/evil_test_link.c:
|
||||
* src/bin/evil_test_mkstemp.c:
|
||||
* src/bin/evil_test_pipe.c:
|
||||
* src/bin/evil_test_realpath.c:
|
||||
Remove warnings.
|
||||
|
||||
* src/lib/evil_link_xp.cpp:
|
||||
Formatting.
|
||||
|
||||
2012-01-20 Vincent Torri <doursse at users dot sf dot net>
|
||||
|
||||
* Makefile.am:
|
||||
|
|
|
@ -21,6 +21,7 @@ evil_test_link.c \
|
|||
evil_test_memcpy.c \
|
||||
evil_test_mkstemp.c \
|
||||
evil_test_pipe.c \
|
||||
evil_test_print.c \
|
||||
evil_test_realpath.c \
|
||||
evil_test_util.c \
|
||||
evil_suite.h \
|
||||
|
@ -31,6 +32,7 @@ evil_test_link.h \
|
|||
evil_test_memcpy.h \
|
||||
evil_test_mkstemp.h \
|
||||
evil_test_pipe.h \
|
||||
evil_test_print.h \
|
||||
evil_test_realpath.h \
|
||||
evil_test_util.h
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "evil_test_memcpy.h"
|
||||
#include "evil_test_mkstemp.h"
|
||||
#include "evil_test_pipe.h"
|
||||
#include "evil_test_print.h"
|
||||
#include "evil_test_realpath.h"
|
||||
#include "evil_test_util.h"
|
||||
|
||||
|
@ -185,6 +186,7 @@ main(void)
|
|||
{ "link ", test_link },
|
||||
{ "mkstemp ", test_mkstemp },
|
||||
{ "pipe ", test_pipe },
|
||||
{ "print ", test_print },
|
||||
{ "realpath ", test_realpath },
|
||||
{ "util ", test_util },
|
||||
/* { "memcpy ", test_memcpy }, */
|
||||
|
|
|
@ -62,7 +62,7 @@ test_dlfcn_test_dlsym(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_dlfcn_tests_run(suite *s)
|
||||
test_dlfcn_tests_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ test_env_test_unsetenv(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_env_tests_run(suite *s)
|
||||
test_env_tests_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ test_time_test_gettimeofday(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_time_tests_run(suite *s)
|
||||
test_time_tests_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ test_link_test_readlink(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_link_tests_run(suite *s)
|
||||
test_link_tests_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ test_mkstemp_test(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_mkstemp_run(suite *s)
|
||||
test_mkstemp_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -75,11 +75,9 @@ test_pipe_test(void)
|
|||
|
||||
if (ret < 0)
|
||||
goto free_d;
|
||||
|
||||
if (ret == 0)
|
||||
else if (ret == 0)
|
||||
goto close_h;
|
||||
|
||||
if (ret > 0)
|
||||
else /* ret > 0 */
|
||||
{
|
||||
void *buf[1];
|
||||
data *d2 = NULL;
|
||||
|
@ -102,7 +100,7 @@ test_pipe_test(void)
|
|||
CloseHandle(h);
|
||||
free(d);
|
||||
|
||||
return 1;
|
||||
return ret;
|
||||
|
||||
close_h:
|
||||
CloseHandle(h);
|
||||
|
@ -112,7 +110,7 @@ test_pipe_test(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_pipe_run(suite *s)
|
||||
test_pipe_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -124,6 +122,5 @@ test_pipe_run(suite *s)
|
|||
int
|
||||
test_pipe(suite *s)
|
||||
{
|
||||
|
||||
return test_pipe_run(s);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Evil.h>
|
||||
|
||||
#include "evil_suite.h"
|
||||
#include "evil_test_print.h"
|
||||
|
||||
static int
|
||||
test_print_test(void)
|
||||
{
|
||||
char buf[16];
|
||||
int i1 = 1;
|
||||
size_t i2 = 123456;
|
||||
int res;
|
||||
|
||||
res = printf("%02hhd\n", i1);
|
||||
if (res != 3)
|
||||
return 0;
|
||||
|
||||
res = snprintf(buf, sizeof(buf), "%zu", i2);
|
||||
if (res != 6)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
test_print_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = test_print_test();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
test_print(suite *s)
|
||||
{
|
||||
return test_print_run(s);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __EVIL_TEST_PRINT_H__
|
||||
#define __EVIL_TEST_PRINT_H__
|
||||
|
||||
|
||||
int test_print(suite *s);
|
||||
|
||||
|
||||
#endif /* __EVIL_TEST_PRINT_H__ */
|
|
@ -10,7 +10,8 @@
|
|||
#include "evil_test_realpath.h"
|
||||
|
||||
|
||||
int test_realpath_test(void)
|
||||
static int
|
||||
test_realpath_test(void)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char *filename;
|
||||
|
@ -27,7 +28,7 @@ int test_realpath_test(void)
|
|||
}
|
||||
|
||||
static int
|
||||
test_realpath_run(suite *s)
|
||||
test_realpath_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <Evil.h>
|
||||
|
||||
#include "evil_suite.h"
|
||||
#include "evil_test_util.h"
|
||||
|
||||
|
||||
static int test_path_absolute_test_1(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = NULL;
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_path_absolute_test_2(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = "1";
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_path_absolute_test_3(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = "1:\\";
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_path_absolute_test_4(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = "1/\\";
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_path_absolute_test_5(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = "F:/foo";
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result == 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int test_path_absolute_test_6(void)
|
||||
{
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
path = "C:\\foo";
|
||||
result = evil_path_is_absolute(path);
|
||||
if (result == 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
test_path_absolute_run(suite *s __UNUSED__)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = test_path_absolute_test_1();
|
||||
res &= test_path_absolute_test_2();
|
||||
res &= test_path_absolute_test_3();
|
||||
res &= test_path_absolute_test_4();
|
||||
res &= test_path_absolute_test_5();
|
||||
res &= test_path_absolute_test_6();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
test_util(suite *s)
|
||||
{
|
||||
return test_path_absolute_run(s);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __EVIL_TEST_UTIL_H__
|
||||
#define __EVIL_TEST_UTIL_H__
|
||||
|
||||
|
||||
int test_util(suite *s);
|
||||
|
||||
|
||||
#endif /* __EVIL_TEST_UTIL_H__ */
|
|
@ -1,23 +1,6 @@
|
|||
#ifndef __EVIL_H__
|
||||
#define __EVIL_H__
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif /* EAPI */
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_EVIL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_EVIL_BUILD */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
/**
|
||||
* @mainpage Evil
|
||||
* @image html e_big.png
|
||||
|
@ -87,7 +70,6 @@ extern "C" {
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -95,13 +77,6 @@ extern "C" {
|
|||
#include <math.h>
|
||||
|
||||
|
||||
#ifdef PATH_MAX
|
||||
# undef PATH_MAX
|
||||
#endif /* PATH_MAX */
|
||||
|
||||
#define PATH_MAX MAX_PATH
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
# include <io.h>
|
||||
|
@ -141,11 +116,13 @@ typedef unsigned long uid_t;
|
|||
typedef unsigned long gid_t;
|
||||
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_fcntl.h"
|
||||
#include "evil_inet.h"
|
||||
#include "evil_langinfo.h"
|
||||
#include "evil_libgen.h"
|
||||
#include "evil_main.h"
|
||||
#include "evil_print.h"
|
||||
#include "evil_stdlib.h"
|
||||
#include "evil_stdio.h"
|
||||
#include "evil_string.h"
|
||||
|
@ -153,6 +130,25 @@ typedef unsigned long gid_t;
|
|||
#include "evil_unistd.h"
|
||||
#include "evil_util.h"
|
||||
|
||||
#define fprintf _evil_fprintfa
|
||||
#define printf _evil_printfa
|
||||
#define snprintf _evil_snprintfa
|
||||
#define sprintf _evil_sprintfa
|
||||
#define vfprintf _evil_vfprintfa
|
||||
#define vprintf _evil_vprintfa
|
||||
#define vsnprintf _evil_vsnprintfa
|
||||
#define vsprintf _evil_vsprintfa
|
||||
|
||||
#define fscanf _evil_fscanf
|
||||
#define scanf _evil_scanf
|
||||
#define sscanf _evil_sscanf
|
||||
#define vfscanf _evil_vfscanf
|
||||
#define vscanf _evil_vscanf
|
||||
#define vsscanf _evil_vsscanf
|
||||
|
||||
#define asprintf _evil_asprintf
|
||||
#define vasprintf _evil_vasprintf
|
||||
|
||||
|
||||
#if (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__))
|
||||
# if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
|
|
|
@ -12,7 +12,9 @@ evil_fcntl.h \
|
|||
evil_inet.h \
|
||||
evil_langinfo.h \
|
||||
evil_libgen.h \
|
||||
evil_macro.h \
|
||||
evil_main.h \
|
||||
evil_print.h \
|
||||
evil_stdlib.h \
|
||||
evil_stdio.h \
|
||||
evil_string.h \
|
||||
|
@ -25,7 +27,7 @@ nobase_dist_stdheaders_DATA = pwd.h sys/mman.h fnmatch.h dirent.h
|
|||
|
||||
if EVIL_HAVE_WINCE
|
||||
|
||||
nobase_dist_stdheaders_DATA += errno.h
|
||||
nobase_dist_stdheaders_DATA += mingw32ce/errno.h
|
||||
|
||||
endif
|
||||
|
||||
|
@ -39,6 +41,10 @@ evil_langinfo.c \
|
|||
evil_libgen.c \
|
||||
evil_main.c \
|
||||
evil_mman.c \
|
||||
evil_pformata.c \
|
||||
evil_pformatw.c \
|
||||
evil_printa.c \
|
||||
evil_printw.c \
|
||||
evil_pwd.c \
|
||||
evil_stdlib.c \
|
||||
evil_stdio.c \
|
||||
|
@ -47,6 +53,7 @@ evil_time.c \
|
|||
evil_unistd.c \
|
||||
evil_util.c \
|
||||
evil_uuid.c \
|
||||
evil_pformat.h \
|
||||
evil_private.h \
|
||||
evil_fnmatch_private.h
|
||||
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
# include <limits.h>
|
||||
#endif /* __MINGW32CE__ || _MSC_VER */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# include <tlhelp32.h> /* CreateToolhelp32Snapshot */
|
||||
#else
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#endif
|
||||
|
||||
#include "Evil.h"
|
||||
#include "errno.h"
|
||||
#include "mingw32ce/errno.h"
|
||||
|
||||
|
||||
int errno = 0;
|
||||
|
|
|
@ -104,17 +104,14 @@ int fcntl(int fd, int cmd, ...)
|
|||
if (pos != -1L)
|
||||
res = 0;
|
||||
|
||||
printf ("Evil 1 %d %d %d\n", fl->l_type, F_RDLCK, F_WRLCK);
|
||||
if ((fl->l_type == F_RDLCK) || (fl->l_type == F_WRLCK))
|
||||
{
|
||||
printf ("Evil 2\n");
|
||||
if (cmd == F_SETLK)
|
||||
res = _locking(fd, _LK_NBLCK, fl->l_len); /* if cannot be locked, we return immediatly */
|
||||
else /* F_SETLKW */
|
||||
res = _locking(fd, _LK_LOCK, fl->l_len); /* otherwise, we try several times */
|
||||
}
|
||||
|
||||
printf ("Evil 3\n");
|
||||
if (fl->l_type == F_UNLCK)
|
||||
res = _locking(fd, _LK_UNLCK, fl->l_len);
|
||||
}
|
||||
|
|
|
@ -26,17 +26,24 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
#endif /* HAVE_ERRNO_H */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_inet.h"
|
||||
#include "evil_private.h"
|
||||
#define APICHAR char
|
||||
#include "evil_print.h"
|
||||
|
||||
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
#ifndef __EVIL_MACRO_H__
|
||||
#define __EVIL_MACRO_H__
|
||||
|
||||
|
||||
#ifndef __cdecl
|
||||
# ifdef __GNUC__
|
||||
# define __cdecl __attribute__((__cdecl__))
|
||||
# else
|
||||
# define __cdecl
|
||||
# endif
|
||||
#endif /* __cdecl */
|
||||
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif /* EAPI */
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_EVIL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_EVIL_BUILD */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
#ifndef __EVIL_GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __EVIL_GNUC_PREREQ( major, minor )\
|
||||
(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
||||
# else
|
||||
# define __EVIL_GNUC_PREREQ( major, minor )
|
||||
# endif
|
||||
#endif /* __EVIL_GNUC_PREREQ */
|
||||
|
||||
|
||||
#ifndef __EVIL_NOTHROW
|
||||
# if __EVIL_GNUC_PREREQ( 3, 3 )
|
||||
# define __EVIL_NOTHROW __attribute__((__nothrow__))
|
||||
# else
|
||||
# define __EVIL_NOTHROW
|
||||
# endif
|
||||
#endif /* __EVIL_NOTHROW */
|
||||
|
||||
|
||||
#ifndef __EVIL_PRINTF
|
||||
# if __EVIL_GNUC_PREREQ( 2, 4 )
|
||||
# define __EVIL_PRINTF(fmt, arg) __attribute__((__format__ (__gnu_printf__, fmt, arg)))
|
||||
# else
|
||||
# define __EVIL_PRINTF(fmt, arg)
|
||||
# endif
|
||||
#endif /* __EVIL_PRINTF */
|
||||
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX MAX_PATH
|
||||
#endif /* PATH_MAX */
|
||||
#ifdef fprintf
|
||||
# undef fprintf
|
||||
#endif
|
||||
|
||||
#ifdef printf
|
||||
# undef printf
|
||||
#endif
|
||||
|
||||
#ifdef sprintf
|
||||
# undef sprintf
|
||||
#endif
|
||||
|
||||
#ifdef snprintf
|
||||
# undef snprintf
|
||||
#endif
|
||||
|
||||
#ifdef vfprintf
|
||||
# undef vfprintf
|
||||
#endif
|
||||
|
||||
#ifdef vprintf
|
||||
# undef vprintf
|
||||
#endif
|
||||
|
||||
#ifdef vsprintf
|
||||
# undef vsprintf
|
||||
#endif
|
||||
|
||||
#ifdef vsnprintf
|
||||
# undef vsnprintf
|
||||
#endif
|
||||
|
||||
#ifdef fscanf
|
||||
# undef fscanf
|
||||
#endif
|
||||
|
||||
#ifdef scanf
|
||||
# undef scanf
|
||||
#endif
|
||||
|
||||
#ifdef sscanf
|
||||
# undef sscanf
|
||||
#endif
|
||||
|
||||
#ifdef vfscanf
|
||||
# undef vfscanf
|
||||
#endif
|
||||
|
||||
#ifdef vscanf
|
||||
# undef vscanf
|
||||
#endif
|
||||
|
||||
#ifdef vsscanf
|
||||
# undef vsscanf
|
||||
#endif
|
||||
|
||||
#ifdef asprintf
|
||||
# undef asprintf
|
||||
#endif
|
||||
|
||||
#ifdef vasprintf
|
||||
# undef vasprintf
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_INTTYPES_H_) && defined(PRId64)
|
||||
|
||||
#undef PRId64
|
||||
#undef PRIdLEAST64
|
||||
#undef PRIdFAST64
|
||||
#undef PRIdMAX
|
||||
#undef PRIi64
|
||||
#undef PRIiLEAST64
|
||||
#undef PRIiFAST64
|
||||
#undef PRIiMAX
|
||||
#undef PRIo64
|
||||
#undef PRIoLEAST64
|
||||
#undef PRIoFAST64
|
||||
#undef PRIoMAX
|
||||
#undef PRIu64
|
||||
#undef PRIuLEAST64
|
||||
#undef PRIuFAST64
|
||||
#undef PRIuMAX
|
||||
#undef PRIx64
|
||||
#undef PRIxLEAST64
|
||||
#undef PRIxFAST64
|
||||
#undef PRIxMAX
|
||||
#undef PRIX64
|
||||
#undef PRIXLEAST64
|
||||
#undef PRIXFAST64
|
||||
#undef PRIXMAX
|
||||
|
||||
#undef SCNd64
|
||||
#undef SCNdLEAST64
|
||||
#undef SCNdFAST64
|
||||
#undef SCNdMAX
|
||||
#undef SCNi64
|
||||
#undef SCNiLEAST64
|
||||
#undef SCNiFAST64
|
||||
#undef SCNiMAX
|
||||
#undef SCNo64
|
||||
#undef SCNoLEAST64
|
||||
#undef SCNoFAST64
|
||||
#undef SCNoMAX
|
||||
#undef SCNx64
|
||||
#undef SCNxLEAST64
|
||||
#undef SCNxFAST64
|
||||
#undef SCNxMAX
|
||||
#undef SCNu64
|
||||
#undef SCNuLEAST64
|
||||
#undef SCNuFAST64
|
||||
#undef SCNuMAX
|
||||
|
||||
#ifdef _WIN64
|
||||
#undef PRIdPTR
|
||||
#undef PRIiPTR
|
||||
#undef PRIoPTR
|
||||
#undef PRIuPTR
|
||||
#undef PRIxPTR
|
||||
#undef PRIXPTR
|
||||
|
||||
#undef SCNdPTR
|
||||
#undef SCNiPTR
|
||||
#undef SCNoPTR
|
||||
#undef SCNxPTR
|
||||
#undef SCNuPTR
|
||||
#endif /* _WIN64 */
|
||||
|
||||
#endif /* defined(_INTTYPES_H_) && defined(PRId64) */
|
||||
|
||||
#endif /* __EVIL_MACRO_H__ */
|
|
@ -2,7 +2,9 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -9,13 +10,20 @@
|
|||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
# include <io.h>
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "sys/mman.h"
|
||||
#include "evil_util.h"
|
||||
#include "evil_private.h"
|
||||
#define APICHAR char
|
||||
#include "evil_print.h"
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
# define _get_osfhandle(FILEDES) ((long)FILEDES)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef __EVIL_PRIVATE_H__
|
||||
#define __EVIL_PRIVATE_H__
|
||||
|
||||
|
||||
#include "evil_macro.h"
|
||||
|
||||
|
||||
#ifdef __BUILD_WIDEAPI
|
||||
#define APICHAR wchar_t
|
||||
#else
|
||||
#define APICHAR char
|
||||
#endif
|
||||
|
||||
/* The following are the declarations specific to the `pformat' API...
|
||||
*/
|
||||
#define PFORMAT_TO_FILE 0x1000
|
||||
#define PFORMAT_NOLIMIT 0x2000
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __BUILD_WIDEAPI
|
||||
# define __fputc(X,STR) fputwc((wchar_t) (X), (STR))
|
||||
# define _evil_pformat _evil_pformatw
|
||||
|
||||
# define _evil_fprintf _evil_fprintfw
|
||||
# define _evil_printf _evil_printfw
|
||||
# define _evil_snprintf _evil_snprintfw
|
||||
# define _evil_sprintf _evil_sprintfw
|
||||
|
||||
# define _evil_vfprintf _evil_vfprintfw
|
||||
# define _evil_vprintf _evil_vprintfw
|
||||
# define _evil_vsnprintf _evil_vsnprintfw
|
||||
# define _evil_vsprintf _evil_vsprintfw
|
||||
#else
|
||||
# define __fputc(X,STR) fputc((X), (STR))
|
||||
# define _evil_pformat _evil_pformata
|
||||
|
||||
# define _evil_fprintf _evil_fprintfa
|
||||
# define _evil_printf _evil_printfa
|
||||
# define _evil_snprintf _evil_snprintfa
|
||||
# define _evil_sprintf _evil_sprintfa
|
||||
|
||||
# define _evil_vfprintf _evil_vfprintfa
|
||||
# define _evil_vprintf _evil_vprintfa
|
||||
# define _evil_vsnprintf _evil_vsnprintfa
|
||||
# define _evil_vsprintf _evil_vsprintfa
|
||||
#endif
|
||||
|
||||
int __cdecl _evil_pformat(int, void *, int, const APICHAR *, va_list) __EVIL_NOTHROW;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __EVIL_PRIVATE_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#define __BUILD_WIDEAPI 1
|
||||
|
||||
#include "evil_pformata.c"
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
#ifndef __EVIL_PRINT_H__
|
||||
#define __EVIL_PRINT_H__
|
||||
|
||||
|
||||
#include "evil_macro.h"
|
||||
|
||||
|
||||
EAPI int __cdecl _evil_fprintfa(FILE *, const char *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_printfa(const char *, ...) __EVIL_PRINTF(1, 2) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_sprintfa(char *, const char *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_snprintfa(char *, size_t, const char *, ...) __EVIL_PRINTF(3, 4) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vfprintfa(FILE *, const char *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vprintfa(const char *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vsprintfa(char *, const char *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vsnprintfa(char *, size_t, const char *, va_list) __EVIL_NOTHROW;
|
||||
|
||||
EAPI int __cdecl _evil_fscanf (FILE *, const char *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_scanf (const char *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_sscanf (const char *, const char *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vfscanf(FILE *, const char *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vscanf (const char *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vsscanf(const char *, const char *, va_list) __EVIL_NOTHROW;
|
||||
|
||||
EAPI int __cdecl _evil_asprintf(char ** __restrict__, const char * __restrict__, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vasprintf(char ** __restrict__, const char * __restrict__, va_list) __EVIL_NOTHROW;
|
||||
|
||||
EAPI int __cdecl _evil_fprintfw(FILE *, const wchar_t *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_printfw(const wchar_t *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_sprintfw(wchar_t *, const wchar_t *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_snprintfw(wchar_t *, size_t, const wchar_t *, ...) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vfprintfw(FILE *, const wchar_t *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vprintfw(const wchar_t *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vsprintfw(wchar_t *, const wchar_t *, va_list) __EVIL_NOTHROW;
|
||||
EAPI int __cdecl _evil_vsnprintfw(wchar_t *, size_t, const wchar_t *, va_list) __EVIL_NOTHROW;
|
||||
|
||||
/* Redefine to GNU specific PRI... and SCN... macros. */
|
||||
/* #if defined(_INTTYPES_H_) && defined(PRId64) */
|
||||
|
||||
#define PRId64 "lld"
|
||||
#define PRIdLEAST64 "lld"
|
||||
#define PRIdFAST64 "lld"
|
||||
#define PRIdMAX "lld"
|
||||
#define PRIi64 "lli"
|
||||
#define PRIiLEAST64 "lli"
|
||||
#define PRIiFAST64 "lli"
|
||||
#define PRIiMAX "lli"
|
||||
#define PRIo64 "llo"
|
||||
#define PRIoLEAST64 "llo"
|
||||
#define PRIoFAST64 "llo"
|
||||
#define PRIoMAX "llo"
|
||||
#define PRIu64 "llu"
|
||||
#define PRIuLEAST64 "llu"
|
||||
#define PRIuFAST64 "llu"
|
||||
#define PRIuMAX "llu"
|
||||
#define PRIx64 "llx"
|
||||
#define PRIxLEAST64 "llx"
|
||||
#define PRIxFAST64 "llx"
|
||||
#define PRIxMAX "llx"
|
||||
#define PRIX64 "llX"
|
||||
#define PRIXLEAST64 "llX"
|
||||
#define PRIXFAST64 "llX"
|
||||
#define PRIXMAX "llX"
|
||||
|
||||
#define SCNd64 "lld"
|
||||
#define SCNdLEAST64 "lld"
|
||||
#define SCNdFAST64 "lld"
|
||||
#define SCNdMAX "lld"
|
||||
#define SCNi64 "lli"
|
||||
#define SCNiLEAST64 "lli"
|
||||
#define SCNiFAST64 "lli"
|
||||
#define SCNiMAX "lli"
|
||||
#define SCNo64 "llo"
|
||||
#define SCNoLEAST64 "llo"
|
||||
#define SCNoFAST64 "llo"
|
||||
#define SCNoMAX "llo"
|
||||
#define SCNx64 "llx"
|
||||
#define SCNxLEAST64 "llx"
|
||||
#define SCNxFAST64 "llx"
|
||||
#define SCNxMAX "llx"
|
||||
#define SCNu64 "llu"
|
||||
#define SCNuLEAST64 "llu"
|
||||
#define SCNuFAST64 "llu"
|
||||
#define SCNuMAX "llu"
|
||||
|
||||
#ifdef _WIN64
|
||||
#define PRIdPTR "lld"
|
||||
#define PRIiPTR "lli"
|
||||
#define PRIoPTR "llo"
|
||||
#define PRIuPTR "llu"
|
||||
#define PRIxPTR "llx"
|
||||
#define PRIXPTR "llX"
|
||||
|
||||
#define SCNdPTR "lld"
|
||||
#define SCNiPTR "lli"
|
||||
#define SCNoPTR "llo"
|
||||
#define SCNxPTR "llx"
|
||||
#define SCNuPTR "llu"
|
||||
#endif /* _WIN64 */
|
||||
|
||||
/* #endif /\* defined(_INTTYPES_H_) && defined(PRId64) *\/ */
|
||||
|
||||
|
||||
#endif /* __EVIL_PRINT_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
|
||||
#define __BUILD_WIDEAPI 1
|
||||
|
||||
#include "evil_printa.c"
|
|
@ -213,49 +213,3 @@ int evil_fclose_native(FILE *stream)
|
|||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
int
|
||||
vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
char buf[1024];
|
||||
char *res;
|
||||
int len;
|
||||
|
||||
len = _vsnprintf(buf, 1023, fmt, ap);
|
||||
if (len < 0) return -1;
|
||||
|
||||
res = (char *)malloc(len + 1);
|
||||
if (!res) return -1;
|
||||
|
||||
memcpy(res, buf, len);
|
||||
res[len] = '\0';
|
||||
|
||||
#else
|
||||
char *res;
|
||||
int len;
|
||||
|
||||
len = _vscprintf(fmt, ap) + 1;
|
||||
res = (char *)malloc(len);
|
||||
if (!res) return -1;
|
||||
|
||||
len = vsprintf(res, fmt, ap);
|
||||
if (len < 0) len = -1;
|
||||
#endif
|
||||
|
||||
*strp = res;
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
asprintf(char **strp, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int res;
|
||||
|
||||
va_start(ap, fmt);
|
||||
res = vasprintf(strp, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -187,51 +187,6 @@ EAPI int evil_fclose_native(FILE *stream);
|
|||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
/**
|
||||
* @brief Print allocated string using a va_list.
|
||||
*
|
||||
* @param strp The returned pointer of the allocated string.
|
||||
* @param fmt The format string.
|
||||
* @param ap The variable argument list.
|
||||
* @return -1 on failure, the length of the printed string.
|
||||
*
|
||||
* This function allocates a buffer large enough to hold the output
|
||||
* including the terminating null byte, and return a pointer to it
|
||||
* into @p strp. The format @p fmt is the same than the one used with
|
||||
* printf(). When not needed anymore, the pointer returned in @p strp
|
||||
* must be freed. On error (memory allocation failure or other error),
|
||||
* this function returns -1 and the content of @p strp is undefined,
|
||||
* otherwise it returns the length of the string (not including the
|
||||
* terminating null byte).
|
||||
*
|
||||
* Conformity: GNU extension.
|
||||
*
|
||||
* Supported OS: Windows XP, CE.
|
||||
*/
|
||||
EAPI int vasprintf(char **strp, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* @brief Print allocated string using a variable number of arguments.
|
||||
*
|
||||
* @param strp The returned pointer of the allocated string.
|
||||
* @param fmt The format string.
|
||||
* @return -1 on failure, the length of the printed string.
|
||||
*
|
||||
* This function allocates a buffer large enough to hold the output
|
||||
* including the terminating null byte, and return a pointer to it
|
||||
* into @p strp. The format @p fmt is the same than the one used with
|
||||
* printf(). When not needed anymore, the pointer returned in @p strp
|
||||
* must be freed. On error (memory allocation failure or other error),
|
||||
* this function returns -1 and the content of @p strp is undefined,
|
||||
* otherwise it returns the length of the string (not including the
|
||||
* terminating null byte).
|
||||
*
|
||||
* Conformity: GNU extension.
|
||||
*
|
||||
* Supported OS: Windows XP, CE.
|
||||
*/
|
||||
EAPI int asprintf(char **strp, const char *fmt, ...);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,19 +2,27 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
#endif /* HAVE_ERRNO_H */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_stdlib.h"
|
||||
#include "evil_private.h"
|
||||
#define APICHAR char
|
||||
#include "evil_print.h"
|
||||
|
||||
/*
|
||||
* Environment variable related functions
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include <errno.h>
|
||||
#endif /* HAVE_ERRNO_H */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
|
|
@ -2,18 +2,23 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_util.h"
|
||||
#include "evil_private.h"
|
||||
#define APICHAR char
|
||||
#include "evil_print.h"
|
||||
|
||||
|
||||
wchar_t *
|
||||
evil_char_to_wchar(const char *text)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __EVIL_SYS_MMAN_H__
|
||||
#define __EVIL_SYS_MMAN_H__
|
||||
|
||||
#include <Evil.h>
|
||||
#include <evil_macro.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue