Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9661d05b
Commit
9661d05b
authored
Oct 24, 2003
by
Pavel Roskin
Committed by
Alexandre Julliard
Oct 24, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MSVCRT_tmpnam(): complete rewrite. Use the same names as the native
version. Use the caller-supplied buffer if possible.
parent
8824c38e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
file.c
dlls/msvcrt/file.c
+37
-8
stdio.h
include/msvcrt/stdio.h
+2
-0
No files found.
dlls/msvcrt/file.c
View file @
9661d05b
...
...
@@ -262,6 +262,29 @@ static void msvcrt_alloc_buffer(MSVCRT_FILE* file)
file
->
_cnt
=
0
;
}
/* INTERNAL: Convert integer to base32 string (0-9a-v), 0 becomes "" */
static
void
msvcrt_int_to_base32
(
int
num
,
char
*
str
)
{
char
*
p
;
int
n
=
num
;
int
digits
=
0
;
while
(
n
!=
0
)
{
n
>>=
5
;
digits
++
;
}
p
=
str
+
digits
;
*
p
=
0
;
while
(
--
p
>=
str
)
{
*
p
=
(
num
&
31
)
+
'0'
;
if
(
*
p
>
'9'
)
*
p
+=
(
'a'
-
'0'
-
10
);
num
>>=
5
;
}
}
/*********************************************************************
* __p__iob(MSVCRT.@)
*/
...
...
@@ -2397,16 +2420,22 @@ void MSVCRT_setbuf(MSVCRT_FILE* file, char *buf)
*/
char
*
MSVCRT_tmpnam
(
char
*
s
)
{
char
tmpbuf
[
MAX_PATH
];
const
char
*
prefix
=
"TMP"
;
if
(
!
GetTempPathA
(
MAX_PATH
,
tmpbuf
)
||
!
GetTempFileNameA
(
tmpbuf
,
prefix
,
0
,
MSVCRT_tmpname
))
static
int
unique
;
char
tmpstr
[
16
];
char
*
p
;
int
count
;
if
(
s
==
0
)
s
=
MSVCRT_tmpname
;
msvcrt_int_to_base32
(
GetCurrentProcessId
(),
tmpstr
);
p
=
s
+
sprintf
(
s
,
"
\\
s%s."
,
tmpstr
);
for
(
count
=
0
;
count
<
MSVCRT_TMP_MAX
;
count
++
)
{
TRACE
(
":failed-last error (%ld)
\n
"
,
GetLastError
());
return
NULL
;
msvcrt_int_to_base32
(
unique
++
,
tmpstr
);
strcpy
(
p
,
tmpstr
);
if
(
GetFileAttributesA
(
s
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
break
;
}
TRACE
(
":got tmpnam %s
\n
"
,
MSVCRT_tmpname
);
s
=
MSVCRT_tmpname
;
return
s
;
}
...
...
include/msvcrt/stdio.h
View file @
9661d05b
...
...
@@ -65,6 +65,7 @@
#define EOF (-1)
#define FILENAME_MAX 260
#define TMP_MAX 0x7fff
#define FOPEN_MAX 20
#define L_tmpnam 260
...
...
@@ -84,6 +85,7 @@
#define MSVCRT__IOLBF 0x0040
#define MSVCRT_FILENAME_MAX 260
#define MSVCRT_TMP_MAX 0x7fff
#define MSVCRT_EOF (-1)
...
...
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