Fix compilation with vc++. Based on patch by Dmitriy Mazovka

* src/lib/Evil.h:
move typedef's

* src/lib/evil.c:
remove declaration and include

* src/lib/evil_stdlib.c:
simplify mkstmp implementation
fix getenv

* src/lib/evil_unistd.c:
include correct headers for readlink and symlink


SVN revision: 35983
This commit is contained in:
Vincent Torri 2008-09-14 07:07:39 +00:00
parent 146b4a86c6
commit 161ab7a975
5 changed files with 43 additions and 22 deletions

View File

@ -1,3 +1,20 @@
2008-09-14 Vincent Torri <doursse at users dot sf dot net>
Fix compilation with vc++. Based on patch by Dmitriy Mazovka
* src/lib/Evil.h:
move typedef's
* src/lib/evil.c:
remove declaration and include
* src/lib/evil_stdlib.c:
simplify mkstmp implementation
fix getenv
* src/lib/evil_unistd.c:
include correct headers for readlink and symlink
2008-09-13 Vincent Torri <doursse at users dot sf dot net>
* big rework of evil

View File

@ -68,12 +68,22 @@ extern "C" {
#include <fcntl.h>
#include <locale.h>
#ifdef PATH_MAX
# undef PATH_MAX
#endif /* PATH_MAX */
#define PATH_MAX MAX_PATH
#ifdef _MSC_VER
typedef SSIZE_T ssize_t;
typedef unsigned short mode_t;
#endif /* _MSC_VER */
#include "evil_stdlib.h"
#include "evil_unistd.h"
#include "evil_util.h"
@ -134,13 +144,6 @@ extern "C" {
# define F_UNLCK 2
# endif /* ! F_RDLCK */
#ifdef _MSC_VER
typedef long ssize_t;
typedef unsigned short mode_t;
#endif /* _MSC_VER */
/**
* @struct flock
* @brief A structure that control the lock of a file descriptor.

View File

@ -9,7 +9,6 @@
# include <errno.h>
# include <sys/locking.h>
# include <io.h>
# include <share.h>
# include <shlobj.h>
# include <objidl.h>
#else
@ -38,9 +37,6 @@
#include "Evil.h"
static struct passwd pw;
#ifndef __CEGCC__
int fcntl(int fd, int cmd, ...)

View File

@ -1,5 +1,8 @@
#include <stdio.h>
#ifndef __CEGCC__
# include <io.h>
#endif /* ! __CEGCC__ */
#ifndef __MINGW32CE__
#include <errno.h>
#endif /* ! __MINGW32CE__ */
@ -126,6 +129,7 @@ setenv(const char *name,
char *old_name;
char *str;
int length;
int res;
if (!name || !*name)
return -1;
@ -139,7 +143,7 @@ setenv(const char *name,
/* if name is already set and overwrite is 0, we exit with success */
old_name = getenv(name);
if (!overwrite && oldname)
if (!overwrite && old_name)
return 0;
length = strlen(name) + strlen(value) + 2;
@ -156,6 +160,8 @@ setenv(const char *name,
res = _putenv(str);
free(str);
return res;
#else /* __CEGCC__ || __MINGW32CE__ */
HKEY key;
@ -224,29 +230,22 @@ unsetenv(const char *name)
*
*/
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
#ifndef __CEGCC__
int
mkstemp(char *template)
{
int fd;
#ifdef __MINGW32__
if (!_mktemp(template))
return -1;
fd = _sopen(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _SH_DENYNO, _S_IREAD | _S_IWRITE);
#else
if (_mktemp_s(template, PATH_MAX) != 0)
return -1;
_sopen_s(&fd, template, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
#endif /* ! __MINGW32__ */
fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
return fd;
}
#endif /* ! ( __CEGCC__ || __MINGW32CE__ ) */
#endif /* ! __CEGCC__ */
char *

View File

@ -2,6 +2,12 @@
#include <winsock2.h>
#undef WIN32_LEAN_AND_MEAN
#ifdef _MSC_VER
# include <shobjidl.h>
# include <errno.h>
# include <shlguid.h>
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */