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
7f4e1c65
Commit
7f4e1c65
authored
Jan 18, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added support for commit flag in fopen.
parent
89f044db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
28 deletions
+42
-28
file.c
dlls/msvcrt/file.c
+39
-28
msvcrt.h
dlls/msvcrt/msvcrt.h
+3
-0
No files found.
dlls/msvcrt/file.c
View file @
7f4e1c65
...
...
@@ -764,6 +764,34 @@ int CDECL MSVCRT__wunlink(const MSVCRT_wchar_t *path)
return
-
1
;
}
/*********************************************************************
* _commit (MSVCRT.@)
*/
int
CDECL
MSVCRT__commit
(
int
fd
)
{
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
TRACE
(
":fd (%d) handle (%p)
\n
"
,
fd
,
hand
);
if
(
hand
==
INVALID_HANDLE_VALUE
)
return
-
1
;
if
(
!
FlushFileBuffers
(
hand
))
{
if
(
GetLastError
()
==
ERROR_INVALID_HANDLE
)
{
/* FlushFileBuffers fails for console handles
* so we ignore this error.
*/
return
0
;
}
TRACE
(
":failed-last error (%d)
\n
"
,
GetLastError
());
msvcrt_set_errno
(
GetLastError
());
return
-
1
;
}
TRACE
(
":ok
\n
"
);
return
0
;
}
/* flush_all_buffers calls MSVCRT_fflush which calls flush_all_buffers */
int
CDECL
MSVCRT_fflush
(
MSVCRT_FILE
*
file
);
...
...
@@ -811,6 +839,9 @@ int CDECL MSVCRT_fflush(MSVCRT_FILE* file)
MSVCRT__lock_file
(
file
);
res
=
msvcrt_flush_buffer
(
file
);
if
(
!
res
&&
(
file
->
_flag
&
MSVCRT__IOCOMMIT
))
res
=
MSVCRT__commit
(
file
->
_file
)
?
MSVCRT_EOF
:
0
;
MSVCRT__unlock_file
(
file
);
return
res
;
...
...
@@ -852,34 +883,6 @@ int CDECL MSVCRT__close(int fd)
}
/*********************************************************************
* _commit (MSVCRT.@)
*/
int
CDECL
MSVCRT__commit
(
int
fd
)
{
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
TRACE
(
":fd (%d) handle (%p)
\n
"
,
fd
,
hand
);
if
(
hand
==
INVALID_HANDLE_VALUE
)
return
-
1
;
if
(
!
FlushFileBuffers
(
hand
))
{
if
(
GetLastError
()
==
ERROR_INVALID_HANDLE
)
{
/* FlushFileBuffers fails for console handles
* so we ignore this error.
*/
return
0
;
}
TRACE
(
":failed-last error (%d)
\n
"
,
GetLastError
());
msvcrt_set_errno
(
GetLastError
());
return
-
1
;
}
TRACE
(
":ok
\n
"
);
return
0
;
}
/*********************************************************************
* _dup2 (MSVCRT.@)
* NOTES
* MSDN isn't clear on this point, but the remarks for _pipe
...
...
@@ -1284,6 +1287,8 @@ static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* st
return
-
1
;
}
*
stream_flags
|=
MSVCRT__commode
;
while
(
*
mode
&&
*
mode
!=
','
)
switch
(
*
mode
++
)
{
...
...
@@ -1301,6 +1306,12 @@ static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* st
case
'T'
:
*
open_flags
|=
MSVCRT__O_SHORT_LIVED
;
break
;
case
'c'
:
*
stream_flags
|=
MSVCRT__IOCOMMIT
;
break
;
case
'n'
:
*
stream_flags
&=
~
MSVCRT__IOCOMMIT
;
break
;
case
'+'
:
case
' '
:
case
'a'
:
...
...
dlls/msvcrt/msvcrt.h
View file @
7f4e1c65
...
...
@@ -238,6 +238,8 @@ extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **) DECLSP
MSVCRT_wchar_t
*
msvcrt_wstrdupa
(
const
char
*
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
MSVCRT__commode
;
/* FIXME: This should be declared in new.h but it's not an extern "C" so
* it would not be much use anyway. Even for Winelib applications.
*/
...
...
@@ -713,6 +715,7 @@ struct MSVCRT__stat64 {
#define MSVCRT__IOERR 0x0020
#define MSVCRT__IOSTRG 0x0040
#define MSVCRT__IORW 0x0080
#define MSVCRT__IOCOMMIT 0x4000
#define MSVCRT__S_IEXEC 0x0040
#define MSVCRT__S_IWRITE 0x0080
...
...
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