summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-09-14 07:07:39 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-09-14 07:07:39 +0000
commit161ab7a9754c1675f3de87fcd77815f952882a91 (patch)
tree835420eb085530e7ccd7617963bef5b56cbf45e6 /legacy
parent146b4a86c6a981c0010c5883f3c55d0ec78c07f5 (diff)
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
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evil/ChangeLog17
-rw-r--r--legacy/evil/src/lib/Evil.h17
-rw-r--r--legacy/evil/src/lib/evil.c4
-rw-r--r--legacy/evil/src/lib/evil_stdlib.c21
-rw-r--r--legacy/evil/src/lib/evil_unistd.c6
5 files changed, 43 insertions, 22 deletions
diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog
index 192ad13eec..52fba7995a 100644
--- a/legacy/evil/ChangeLog
+++ b/legacy/evil/ChangeLog
@@ -1,3 +1,20 @@
12008-09-14 Vincent Torri <doursse at users dot sf dot net>
2
3 Fix compilation with vc++. Based on patch by Dmitriy Mazovka
4
5 * src/lib/Evil.h:
6 move typedef's
7
8 * src/lib/evil.c:
9 remove declaration and include
10
11 * src/lib/evil_stdlib.c:
12 simplify mkstmp implementation
13 fix getenv
14
15 * src/lib/evil_unistd.c:
16 include correct headers for readlink and symlink
17
12008-09-13 Vincent Torri <doursse at users dot sf dot net> 182008-09-13 Vincent Torri <doursse at users dot sf dot net>
2 19
3 * big rework of evil 20 * big rework of evil
diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h
index afc2120ead..ffdae28154 100644
--- a/legacy/evil/src/lib/Evil.h
+++ b/legacy/evil/src/lib/Evil.h
@@ -68,12 +68,22 @@ extern "C" {
68#include <fcntl.h> 68#include <fcntl.h>
69#include <locale.h> 69#include <locale.h>
70 70
71
71#ifdef PATH_MAX 72#ifdef PATH_MAX
72# undef PATH_MAX 73# undef PATH_MAX
73#endif /* PATH_MAX */ 74#endif /* PATH_MAX */
74 75
75#define PATH_MAX MAX_PATH 76#define PATH_MAX MAX_PATH
76 77
78
79#ifdef _MSC_VER
80
81typedef SSIZE_T ssize_t;
82typedef unsigned short mode_t;
83
84#endif /* _MSC_VER */
85
86
77#include "evil_stdlib.h" 87#include "evil_stdlib.h"
78#include "evil_unistd.h" 88#include "evil_unistd.h"
79#include "evil_util.h" 89#include "evil_util.h"
@@ -134,13 +144,6 @@ extern "C" {
134# define F_UNLCK 2 144# define F_UNLCK 2
135# endif /* ! F_RDLCK */ 145# endif /* ! F_RDLCK */
136 146
137#ifdef _MSC_VER
138
139typedef long ssize_t;
140typedef unsigned short mode_t;
141
142#endif /* _MSC_VER */
143
144/** 147/**
145 * @struct flock 148 * @struct flock
146 * @brief A structure that control the lock of a file descriptor. 149 * @brief A structure that control the lock of a file descriptor.
diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c
index fb90e8ef5e..874e48d912 100644
--- a/legacy/evil/src/lib/evil.c
+++ b/legacy/evil/src/lib/evil.c
@@ -9,7 +9,6 @@
9# include <errno.h> 9# include <errno.h>
10# include <sys/locking.h> 10# include <sys/locking.h>
11# include <io.h> 11# include <io.h>
12# include <share.h>
13# include <shlobj.h> 12# include <shlobj.h>
14# include <objidl.h> 13# include <objidl.h>
15#else 14#else
@@ -38,9 +37,6 @@
38#include "Evil.h" 37#include "Evil.h"
39 38
40 39
41static struct passwd pw;
42
43
44#ifndef __CEGCC__ 40#ifndef __CEGCC__
45 41
46int fcntl(int fd, int cmd, ...) 42int fcntl(int fd, int cmd, ...)
diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c
index d314938ed8..4d1d136293 100644
--- a/legacy/evil/src/lib/evil_stdlib.c
+++ b/legacy/evil/src/lib/evil_stdlib.c
@@ -1,5 +1,8 @@
1 1
2#include <stdio.h> 2#include <stdio.h>
3#ifndef __CEGCC__
4# include <io.h>
5#endif /* ! __CEGCC__ */
3#ifndef __MINGW32CE__ 6#ifndef __MINGW32CE__
4#include <errno.h> 7#include <errno.h>
5#endif /* ! __MINGW32CE__ */ 8#endif /* ! __MINGW32CE__ */
@@ -126,6 +129,7 @@ setenv(const char *name,
126 char *old_name; 129 char *old_name;
127 char *str; 130 char *str;
128 int length; 131 int length;
132 int res;
129 133
130 if (!name || !*name) 134 if (!name || !*name)
131 return -1; 135 return -1;
@@ -139,7 +143,7 @@ setenv(const char *name,
139 143
140 /* if name is already set and overwrite is 0, we exit with success */ 144 /* if name is already set and overwrite is 0, we exit with success */
141 old_name = getenv(name); 145 old_name = getenv(name);
142 if (!overwrite && oldname) 146 if (!overwrite && old_name)
143 return 0; 147 return 0;
144 148
145 length = strlen(name) + strlen(value) + 2; 149 length = strlen(name) + strlen(value) + 2;
@@ -156,6 +160,8 @@ setenv(const char *name,
156 res = _putenv(str); 160 res = _putenv(str);
157 free(str); 161 free(str);
158 162
163 return res;
164
159#else /* __CEGCC__ || __MINGW32CE__ */ 165#else /* __CEGCC__ || __MINGW32CE__ */
160 166
161 HKEY key; 167 HKEY key;
@@ -224,29 +230,22 @@ unsetenv(const char *name)
224 * 230 *
225 */ 231 */
226 232
227#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) 233#ifndef __CEGCC__
228 234
229int 235int
230mkstemp(char *template) 236mkstemp(char *template)
231{ 237{
232 int fd; 238 int fd;
233 239
234#ifdef __MINGW32__
235 if (!_mktemp(template)) 240 if (!_mktemp(template))
236 return -1; 241 return -1;
237 242
238 fd = _sopen(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _SH_DENYNO, _S_IREAD | _S_IWRITE); 243 fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
239#else
240 if (_mktemp_s(template, PATH_MAX) != 0)
241 return -1;
242
243 _sopen_s(&fd, template, _O_RDWR | _O_BINARY | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE);
244#endif /* ! __MINGW32__ */
245 244
246 return fd; 245 return fd;
247} 246}
248 247
249#endif /* ! ( __CEGCC__ || __MINGW32CE__ ) */ 248#endif /* ! __CEGCC__ */
250 249
251 250
252char * 251char *
diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c
index 54a7999e77..866b15aa8e 100644
--- a/legacy/evil/src/lib/evil_unistd.c
+++ b/legacy/evil/src/lib/evil_unistd.c
@@ -2,6 +2,12 @@
2#include <winsock2.h> 2#include <winsock2.h>
3#undef WIN32_LEAN_AND_MEAN 3#undef WIN32_LEAN_AND_MEAN
4 4
5#ifdef _MSC_VER
6# include <shobjidl.h>
7# include <errno.h>
8# include <shlguid.h>
9#endif
10
5#ifdef HAVE_CONFIG_H 11#ifdef HAVE_CONFIG_H
6# include "config.h" 12# include "config.h"
7#endif /* HAVE_CONFIG_H */ 13#endif /* HAVE_CONFIG_H */