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
b44ea808
Commit
b44ea808
authored
Jul 29, 2006
by
Duane Clark
Committed by
Alexandre Julliard
Jul 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix fread.
parent
b37b967a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
file.c
dlls/msvcrt/file.c
+9
-3
file.c
dlls/msvcrt/tests/file.c
+2
-8
No files found.
dlls/msvcrt/file.c
View file @
b44ea808
...
...
@@ -2490,6 +2490,8 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
memcpy
(
ptr
,
file
->
_ptr
,
pcnt
);
file
->
_cnt
-=
pcnt
;
file
->
_ptr
+=
pcnt
;
if
(
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&
WX_TEXT
)
pcnt
-=
remove_cr
(
ptr
,
pcnt
);
read
+=
pcnt
;
rcnt
-=
pcnt
;
ptr
=
(
char
*
)
ptr
+
pcnt
;
...
...
@@ -2499,18 +2501,22 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
}
else
return
0
;
}
if
(
rcnt
)
while
(
rcnt
>
0
)
{
pread
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
int
i
=
_read
(
file
->
_file
,
ptr
,
rcnt
);
if
(
i
==
0
)
break
;
pread
+=
i
;
rcnt
-=
i
;
/* expose feof condition in the flags
* MFC tests file->_flag for feof, and doesn't not call feof())
*/
if
(
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&
WX_ATEOF
)
file
->
_flag
|=
MSVCRT__IOEOF
;
else
if
(
pread
==
-
1
)
else
if
(
i
==
-
1
)
{
file
->
_flag
|=
MSVCRT__IOERR
;
pread
=
0
;
rcnt
=
0
;
}
}
read
+=
pread
;
...
...
dlls/msvcrt/tests/file.c
View file @
b44ea808
...
...
@@ -210,10 +210,7 @@ static void test_readmode( BOOL ascii_mode )
ok
(
fgets
(
buffer
,
MSVCRT_BUFSIZ
-
6
,
file
)
!=
0
,
"padding line fgets failed unexpected in %s
\n
"
,
IOMODE
);
j
=
strlen
(
outbuffer
);
i
=
fread
(
buffer
,
1
,
256
,
file
);
if
(
ao
==
-
1
)
todo_wine
todo_wine
ok
(
i
==
j
+
6
+
ao
*
4
,
"fread failed, expected %d got %d in %s
\n
"
,
j
+
6
+
ao
*
4
,
i
,
IOMODE
);
else
ok
(
i
==
j
+
6
+
ao
*
4
,
"fread failed, expected %d got %d in %s
\n
"
,
j
+
6
+
ao
*
4
,
i
,
IOMODE
);
ok
(
i
==
j
+
6
+
ao
*
4
,
"fread failed, expected %d got %d in %s
\n
"
,
j
+
6
+
ao
*
4
,
i
,
IOMODE
);
l
=
ftell
(
file
);
ok
(
l
==
pl
+
j
+
1
,
"ftell after fread got %ld should be %d in %s
\n
"
,
l
,
pl
+
j
+
1
,
IOMODE
);
/* fread should return the requested number of bytes if available */
...
...
@@ -222,10 +219,7 @@ static void test_readmode( BOOL ascii_mode )
ok
(
fgets
(
buffer
,
MSVCRT_BUFSIZ
-
6
,
file
)
!=
0
,
"padding line fgets failed unexpected in %s
\n
"
,
IOMODE
);
j
=
fp
+
10
;
i
=
fread
(
buffer
,
1
,
j
,
file
);
if
(
ao
==
-
1
)
todo_wine
ok
(
i
==
j
,
"fread failed, expected %d got %d in %s
\n
"
,
j
,
i
,
IOMODE
);
else
ok
(
i
==
j
,
"fread failed, expected %d got %d in %s
\n
"
,
j
,
i
,
IOMODE
);
ok
(
i
==
j
,
"fread failed, expected %d got %d in %s
\n
"
,
j
,
i
,
IOMODE
);
/* test some additional functions */
rewind
(
file
);
...
...
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