Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
dfd0abda
Commit
dfd0abda
authored
Oct 01, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clay: Fix compilation under MSVC
parent
10063aeb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
tests-clay/clay_main.c
+9
-7
No files found.
tests-clay/clay_main.c
View file @
dfd0abda
...
...
@@ -16,7 +16,6 @@
# include <io.h>
# include <shellapi.h>
# include <direct.h>
# pragma comment(lib, "shell32")
# define _MAIN_CC __cdecl
...
...
@@ -27,9 +26,11 @@
# define strdup(str) _strdup(str)
# ifndef __MINGW32__
# pragma comment(lib, "shell32")
# define strncpy(to, from, to_size) strncpy_s(to, to_size, from, _TRUNCATE)
# define W_OK 02
# define S_ISDIR(x) ((x & _S_IFDIR) != 0)
# define mktemp_s(path, len) _mktemp_s(path, len)
# endif
typedef
struct
_stat
STAT_T
;
#else
...
...
@@ -368,15 +369,12 @@ is_valid_tmp_path(const char *path)
static
int
find_tmp_path
(
char
*
buffer
,
size_t
length
)
{
#ifndef _WIN32
static
const
size_t
var_count
=
4
;
static
const
char
*
env_vars
[]
=
{
"TMPDIR"
,
"TMP"
,
"TEMP"
,
"USERPROFILE"
};
#ifdef _WIN32
if
(
GetTempPath
((
DWORD
)
length
,
buffer
))
return
0
;
#else
size_t
i
;
for
(
i
=
0
;
i
<
var_count
;
++
i
)
{
...
...
@@ -395,6 +393,10 @@ find_tmp_path(char *buffer, size_t length)
strncpy
(
buffer
,
"/tmp"
,
length
);
return
0
;
}
#else
if
(
GetTempPath
((
DWORD
)
length
,
buffer
))
return
0
;
#endif
/* This system doesn't like us, try to use the current directory */
...
...
@@ -444,8 +446,8 @@ static int build_sandbox_path(void)
strncpy
(
_clay_path
+
len
,
path_tail
,
sizeof
(
_clay_path
)
-
len
);
#ifdef _
MSC_VER
if
(
_
mktemp_s
(
_clay_path
,
sizeof
(
_clay_path
))
!=
0
)
#ifdef _
WIN32
if
(
mktemp_s
(
_clay_path
,
sizeof
(
_clay_path
))
!=
0
)
return
-
1
;
if
(
mkdir
(
_clay_path
,
0700
)
!=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment