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
f773ad83
Commit
f773ad83
authored
May 20, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 20, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Make _filbuf thread safe.
parent
1b264962
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
24 deletions
+35
-24
file.c
dlls/msvcrt/file.c
+35
-24
No files found.
dlls/msvcrt/file.c
View file @
f773ad83
...
...
@@ -2605,36 +2605,47 @@ int CDECL MSVCRT_ferror(MSVCRT_FILE* file)
*/
int
CDECL
MSVCRT__filbuf
(
MSVCRT_FILE
*
file
)
{
/* Allocate buffer if needed */
if
(
file
->
_bufsiz
==
0
&&
!
(
file
->
_flag
&
MSVCRT__IONBF
)
)
{
msvcrt_alloc_buffer
(
file
);
}
if
(
!
(
file
->
_flag
&
MSVCRT__IOREAD
))
{
if
(
file
->
_flag
&
MSVCRT__IORW
)
{
file
->
_flag
|=
MSVCRT__IOREAD
;
}
else
{
return
MSVCRT_EOF
;
}
}
if
(
file
->
_flag
&
MSVCRT__IONBF
)
{
unsigned
char
c
;
unsigned
char
c
;
MSVCRT__lock_file
(
file
);
/* Allocate buffer if needed */
if
(
file
->
_bufsiz
==
0
&&
!
(
file
->
_flag
&
MSVCRT__IONBF
))
msvcrt_alloc_buffer
(
file
);
if
(
!
(
file
->
_flag
&
MSVCRT__IOREAD
))
{
if
(
file
->
_flag
&
MSVCRT__IORW
)
file
->
_flag
|=
MSVCRT__IOREAD
;
else
{
MSVCRT__unlock_file
(
file
);
return
MSVCRT_EOF
;
}
}
if
(
file
->
_flag
&
MSVCRT__IONBF
)
{
int
r
;
if
((
r
=
read_i
(
file
->
_file
,
&
c
,
1
))
!=
1
)
{
if
((
r
=
read_i
(
file
->
_file
,
&
c
,
1
))
!=
1
)
{
file
->
_flag
|=
(
r
==
0
)
?
MSVCRT__IOEOF
:
MSVCRT__IOERR
;
MSVCRT__unlock_file
(
file
);
return
MSVCRT_EOF
;
}
return
c
;
}
else
{
file
->
_cnt
=
read_i
(
file
->
_file
,
file
->
_base
,
file
->
_bufsiz
);
if
(
file
->
_cnt
<=
0
)
{
}
MSVCRT__unlock_file
(
file
);
return
c
;
}
else
{
file
->
_cnt
=
read_i
(
file
->
_file
,
file
->
_base
,
file
->
_bufsiz
);
if
(
file
->
_cnt
<=
0
)
{
file
->
_flag
|=
(
file
->
_cnt
==
0
)
?
MSVCRT__IOEOF
:
MSVCRT__IOERR
;
file
->
_cnt
=
0
;
MSVCRT__unlock_file
(
file
);
return
MSVCRT_EOF
;
}
file
->
_cnt
--
;
file
->
_ptr
=
file
->
_base
+
1
;
return
*
(
unsigned
char
*
)
file
->
_base
;
}
}
file
->
_cnt
--
;
file
->
_ptr
=
file
->
_base
+
1
;
c
=
*
(
unsigned
char
*
)
file
->
_base
;
MSVCRT__unlock_file
(
file
);
return
c
;
}
}
/*********************************************************************
...
...
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