Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
86baccc9
Commit
86baccc9
authored
Jun 03, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Get rid of msvcrt_fdtoh helper.
parent
9278190d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
21 deletions
+8
-21
file.c
dlls/msvcrt/file.c
+3
-21
file.c
dlls/msvcrt/tests/file.c
+5
-0
No files found.
dlls/msvcrt/file.c
View file @
86baccc9
...
...
@@ -309,26 +309,6 @@ static inline BOOL msvcrt_is_valid_fd(int fd)
return
fd
>=
0
&&
fd
<
MSVCRT_fdend
&&
(
get_ioinfo_nolock
(
fd
)
->
wxflag
&
WX_OPEN
);
}
/* INTERNAL: Get the HANDLE for a fd
* This doesn't lock the table, because a failure will result in
* INVALID_HANDLE_VALUE being returned, which should be handled correctly. If
* it returns a valid handle which is about to be closed, a subsequent call
* will fail, most likely in a sane way.
*/
static
HANDLE
msvcrt_fdtoh
(
int
fd
)
{
if
(
!
msvcrt_is_valid_fd
(
fd
))
{
WARN
(
":fd (%d) - no handle!
\n
"
,
fd
);
*
MSVCRT___doserrno
()
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_EBADF
;
return
INVALID_HANDLE_VALUE
;
}
if
(
get_ioinfo_nolock
(
fd
)
->
handle
==
INVALID_HANDLE_VALUE
)
WARN
(
"returning INVALID_HANDLE_VALUE for %d
\n
"
,
fd
);
return
get_ioinfo_nolock
(
fd
)
->
handle
;
}
/* INTERNAL: free a file entry fd */
static
void
msvcrt_free_fd
(
int
fd
)
{
...
...
@@ -1848,9 +1828,11 @@ int CDECL _futime(int fd, struct MSVCRT___utimbuf32 *t)
*/
MSVCRT_intptr_t
CDECL
MSVCRT__get_osfhandle
(
int
fd
)
{
HANDLE
hand
=
msvcrt_fdtoh
(
fd
)
;
HANDLE
hand
=
get_ioinfo_nolock
(
fd
)
->
handle
;
TRACE
(
":fd (%d) handle (%p)
\n
"
,
fd
,
hand
);
if
(
hand
==
INVALID_HANDLE_VALUE
)
*
MSVCRT__errno
()
=
MSVCRT_EBADF
;
return
(
MSVCRT_intptr_t
)
hand
;
}
...
...
dlls/msvcrt/tests/file.c
View file @
86baccc9
...
...
@@ -1850,6 +1850,11 @@ static void test_get_osfhandle(void)
_close
(
fd
);
_unlink
(
fname
);
errno
=
0xdeadbeef
;
handle
=
(
HANDLE
)
_get_osfhandle
(
fd
);
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"_get_osfhandle returned %p
\n
"
,
handle
);
ok
(
errno
==
EBADF
,
"errno = %d
\n
"
,
errno
);
}
static
void
test_setmaxstdio
(
void
)
...
...
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