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
fdd61a7a
Commit
fdd61a7a
authored
Oct 13, 2006
by
Markus Amsler
Committed by
Alexandre Julliard
Oct 13, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: fread: Fill buffer on small reads.
parent
ef5ed0a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
file.c
dlls/msvcrt/file.c
+23
-1
No files found.
dlls/msvcrt/file.c
View file @
fdd61a7a
...
...
@@ -2524,7 +2524,29 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
}
while
(
rcnt
>
0
)
{
int
i
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
int
i
;
/* Fill the buffer on small reads.
* TODO: Use a better buffering strategy.
*/
if
(
!
file
->
_cnt
&&
size
*
nmemb
<=
MSVCRT_BUFSIZ
/
2
&&
!
(
file
->
_flag
&
MSVCRT__IONBF
))
{
if
(
file
->
_bufsiz
==
0
)
{
msvcrt_alloc_buffer
(
file
);
}
file
->
_cnt
=
_read
(
file
->
_file
,
file
->
_base
,
file
->
_bufsiz
);
file
->
_ptr
=
file
->
_base
;
i
=
(
file
->
_cnt
<
rcnt
)
?
file
->
_cnt
:
rcnt
;
/* If the buffer fill reaches eof but fread wouldn't, clear eof. */
if
(
i
>
0
&&
i
<
file
->
_cnt
)
{
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&=
~
WX_ATEOF
;
}
if
(
i
>
0
)
{
memcpy
(
ptr
,
file
->
_ptr
,
i
);
file
->
_cnt
-=
i
;
file
->
_ptr
+=
i
;
}
}
else
{
i
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
}
pread
+=
i
;
rcnt
-=
i
;
/* expose feof condition in the flags
...
...
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