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
5c4b18a9
Commit
5c4b18a9
authored
Jul 31, 2006
by
Duane Clark
Committed by
Alexandre Julliard
Jul 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Remove read_i loop and fix fread.
parent
3e1ace5a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
21 deletions
+9
-21
file.c
dlls/msvcrt/file.c
+9
-21
No files found.
dlls/msvcrt/file.c
View file @
5c4b18a9
...
@@ -1619,7 +1619,7 @@ static unsigned int remove_cr(char *buf, unsigned int count)
...
@@ -1619,7 +1619,7 @@ static unsigned int remove_cr(char *buf, unsigned int count)
*/
*/
static
int
read_i
(
int
fd
,
void
*
buf
,
unsigned
int
count
)
static
int
read_i
(
int
fd
,
void
*
buf
,
unsigned
int
count
)
{
{
DWORD
num_read
,
all_read
=
0
;
DWORD
num_read
;
char
*
bufstart
=
buf
;
char
*
bufstart
=
buf
;
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
...
@@ -1630,34 +1630,25 @@ static int read_i(int fd, void *buf, unsigned int count)
...
@@ -1630,34 +1630,25 @@ static int read_i(int fd, void *buf, unsigned int count)
return
-
1
;
return
-
1
;
/* Reading single bytes in O_TEXT mode makes things slow
/* Reading single bytes in O_TEXT mode makes things slow
* So read big chunks, then remove the \r in memory and try reading
* So read big chunks
* the rest until the request is satisfied or EOF is met
*/
*/
while
(
all_read
<
count
)
if
(
ReadFile
(
hand
,
bufstart
,
count
,
&
num_read
,
NULL
)
)
{
{
if
(
ReadFile
(
hand
,
bufstart
+
all_read
,
count
-
all_read
,
&
num_read
,
NULL
)
)
if
(
num_read
!=
count
)
{
{
if
(
num_read
!=
(
count
-
all_read
))
{
TRACE
(
":EOF
\n
"
);
MSVCRT_fdesc
[
fd
].
wxflag
|=
WX_ATEOF
;
MSVCRT_fdesc
[
fd
].
wxflag
|=
WX_ATEOF
;
all_read
+=
num_read
;
TRACE
(
":EOF %s
\n
"
,
debugstr_an
(
buf
,
num_read
));
if
(
count
>
4
)
TRACE
(
"%s
\n
"
,
debugstr_an
(
buf
,
all_read
));
return
all_read
;
}
}
all_read
+=
num_read
;
}
}
else
else
{
{
TRACE
(
":failed-last error (%ld)
\n
"
,
GetLastError
());
TRACE
(
":failed-last error (%ld)
\n
"
,
GetLastError
());
return
-
1
;
return
-
1
;
}
}
}
if
(
count
>
4
)
if
(
count
>
4
)
TRACE
(
"(%lu), %s
\n
"
,
all_read
,
debugstr_an
(
buf
,
all
_read
));
TRACE
(
"(%lu), %s
\n
"
,
num_read
,
debugstr_an
(
buf
,
num
_read
));
return
all
_read
;
return
num
_read
;
}
}
/*********************************************************************
/*********************************************************************
...
@@ -2132,11 +2123,8 @@ int CDECL MSVCRT_fgetc(MSVCRT_FILE* file)
...
@@ -2132,11 +2123,8 @@ int CDECL MSVCRT_fgetc(MSVCRT_FILE* file)
file
->
_cnt
--
;
file
->
_cnt
--
;
i
=
file
->
_ptr
++
;
i
=
file
->
_ptr
++
;
j
=
*
i
;
j
=
*
i
;
}
else
{
}
else
j
=
MSVCRT__filbuf
(
file
);
j
=
MSVCRT__filbuf
(
file
);
if
(
j
==
MSVCRT_EOF
)
return
j
;
}
if
(
!
(
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&
WX_TEXT
)
||
(
j
!=
'\r'
))
if
(
!
(
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&
WX_TEXT
)
||
(
j
!=
'\r'
))
return
j
;
return
j
;
}
while
(
1
);
}
while
(
1
);
...
@@ -2508,7 +2496,6 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
...
@@ -2508,7 +2496,6 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
while
(
rcnt
>
0
)
while
(
rcnt
>
0
)
{
{
int
i
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
int
i
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
if
(
i
==
0
)
break
;
pread
+=
i
;
pread
+=
i
;
rcnt
-=
i
;
rcnt
-=
i
;
/* expose feof condition in the flags
/* expose feof condition in the flags
...
@@ -2522,6 +2509,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
...
@@ -2522,6 +2509,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
pread
=
0
;
pread
=
0
;
rcnt
=
0
;
rcnt
=
0
;
}
}
if
(
i
<
1
)
break
;
}
}
read
+=
pread
;
read
+=
pread
;
return
read
/
size
;
return
read
/
size
;
...
...
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