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
56eb6f67
Commit
56eb6f67
authored
Oct 05, 2007
by
Dan Kegel
Committed by
Alexandre Julliard
Oct 09, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix ^Z handling in text mode.
parent
3978535c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
file.c
dlls/msvcrt/file.c
+8
-2
file.c
dlls/msvcrt/tests/file.c
+17
-0
No files found.
dlls/msvcrt/file.c
View file @
56eb6f67
...
...
@@ -59,6 +59,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/* values for wxflag in file descriptor */
#define WX_OPEN 0x01
#define WX_ATEOF 0x02
#define WX_READEOF 0x04
/* like ATEOF, but for underlying file rather than buffer */
#define WX_DONTINHERIT 0x10
#define WX_APPEND 0x20
#define WX_TEXT 0x80
...
...
@@ -827,7 +828,7 @@ __int64 CDECL _lseeki64(int fd, __int64 offset, int whence)
ofs
.
QuadPart
=
offset
;
if
(
SetFilePointerEx
(
hand
,
ofs
,
&
ret
,
whence
))
{
MSVCRT_fdesc
[
fd
].
wxflag
&=
~
WX_ATEOF
;
MSVCRT_fdesc
[
fd
].
wxflag
&=
~
(
WX_ATEOF
|
WX_READEOF
)
;
/* FIXME: What if we seek _to_ EOF - is EOF set? */
return
ret
.
QuadPart
;
...
...
@@ -1666,6 +1667,11 @@ static int read_i(int fd, void *buf, unsigned int count)
char
*
bufstart
=
buf
;
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
if
(
MSVCRT_fdesc
[
fd
].
wxflag
&
WX_READEOF
)
{
MSVCRT_fdesc
[
fd
].
wxflag
|=
WX_ATEOF
;
TRACE
(
"already at EOF, returning 0
\n
"
);
return
0
;
}
/* Don't trace small reads, it gets *very* annoying */
if
(
count
>
4
)
TRACE
(
":fd (%d) handle (%p) buf (%p) len (%d)
\n
"
,
fd
,
hand
,
buf
,
count
);
...
...
@@ -1692,7 +1698,7 @@ static int read_i(int fd, void *buf, unsigned int count)
}
if
(
num_read
!=
count
)
{
MSVCRT_fdesc
[
fd
].
wxflag
|=
WX_ATEOF
;
MSVCRT_fdesc
[
fd
].
wxflag
|=
(
WX_ATEOF
|
WX_READEOF
)
;
TRACE
(
":EOF %s
\n
"
,
debugstr_an
(
buf
,
num_read
));
}
}
...
...
dlls/msvcrt/tests/file.c
View file @
56eb6f67
...
...
@@ -287,6 +287,23 @@ static void test_asciimode(void)
ok
((
fread
(
buf
,
1
,
sizeof
(
buf
),
fp
)
==
2
)
&&
(
0
==
strcmp
(
buf
,
"
\r\n
"
)),
"CR CR LF not read as CR LF
\n
"
);
fclose
(
fp
);
unlink
(
"ascii.tst"
);
/* Simple test of foo ^Z [more than one block] bar handling */
fp
=
fopen
(
"ascii.tst"
,
"wb"
);
fputs
(
"foo
\032
"
,
fp
);
/* foo, logical EOF, ... */
fseek
(
fp
,
65536L
,
SEEK_SET
);
/* ... more than MSVCRT_BUFSIZ, ... */
fputs
(
"bar"
,
fp
);
/* ... bar */
fclose
(
fp
);
fp
=
fopen
(
"ascii.tst"
,
"rt"
);
ok
(
fgets
(
buf
,
sizeof
(
buf
),
fp
)
!=
NULL
,
"fgets foo
\n
"
);
ok
(
0
==
strcmp
(
buf
,
"foo"
),
"foo ^Z not read as foo by fgets
\n
"
);
ok
(
fgets
(
buf
,
sizeof
(
buf
),
fp
)
==
NULL
,
"fgets after logical EOF
\n
"
);
rewind
(
fp
);
ok
((
fread
(
buf
,
1
,
sizeof
(
buf
),
fp
)
==
3
)
&&
(
0
==
strcmp
(
buf
,
"foo"
)),
"foo ^Z not read as foo by fread
\n
"
);
ok
((
fread
(
buf
,
1
,
sizeof
(
buf
),
fp
)
==
0
),
"fread after logical EOF
\n
"
);
fclose
(
fp
);
unlink
(
"ascii.tst"
);
}
static
WCHAR
*
AtoW
(
const
char
*
p
)
...
...
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