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
45f1b06b
Commit
45f1b06b
authored
Jun 25, 2005
by
Paul Rupe
Committed by
Alexandre Julliard
Jun 25, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ungetc(EOF) a no-op.
parent
f6be23e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
file.c
dlls/msvcrt/file.c
+4
-1
file.c
dlls/msvcrt/tests/file.c
+22
-0
No files found.
dlls/msvcrt/file.c
View file @
45f1b06b
...
...
@@ -2190,7 +2190,7 @@ char *MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file)
if
((
cc
!=
MSVCRT_EOF
)
&&
(
size
>
1
))
*
s
++
=
cc
;
*
s
=
'\0'
;
TRACE
(
":got
'%s'
\n
"
,
debugstr_a
(
buf_start
));
TRACE
(
":got
%s
\n
"
,
debugstr_a
(
buf_start
));
return
buf_start
;
}
...
...
@@ -2983,6 +2983,8 @@ int MSVCRT_printf(const char *format, ...)
*/
int
MSVCRT_ungetc
(
int
c
,
MSVCRT_FILE
*
file
)
{
if
(
c
==
MSVCRT_EOF
)
return
MSVCRT_EOF
;
if
(
file
->
_bufsiz
==
0
&&
!
(
file
->
_flag
&
MSVCRT__IONBF
))
{
msvcrt_alloc_buffer
(
file
);
file
->
_ptr
++
;
...
...
@@ -2991,6 +2993,7 @@ int MSVCRT_ungetc(int c, MSVCRT_FILE * file)
file
->
_ptr
--
;
*
file
->
_ptr
=
c
;
file
->
_cnt
++
;
MSVCRT_clearerr
(
file
);
return
c
;
}
return
MSVCRT_EOF
;
...
...
dlls/msvcrt/tests/file.c
View file @
45f1b06b
...
...
@@ -2,6 +2,7 @@
* Unit test suite for file functions
*
* Copyright 2002 Bill Currie
* Copyright 2005 Paul Rupe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -59,6 +60,7 @@ static void test_fileops( void )
int
fd
;
FILE
*
file
;
fpos_t
pos
;
int
i
,
c
;
fd
=
open
(
"fdopen.tst"
,
O_WRONLY
|
O_CREAT
|
O_BINARY
,
_S_IREAD
|
_S_IWRITE
);
write
(
fd
,
outbuffer
,
sizeof
(
outbuffer
));
...
...
@@ -78,6 +80,26 @@ static void test_fileops( void )
ok
(
buffer
[
0
]
==
outbuffer
[
strlen
(
outbuffer
)
-
1
],
"fgets exchanged chars
\n
"
);
rewind
(
file
);
for
(
i
=
0
,
c
=
EOF
;
i
<
sizeof
(
outbuffer
);
i
++
)
{
ok
((
c
=
fgetc
(
file
))
==
outbuffer
[
i
],
"fgetc returned wrong data
\n
"
);
}
ok
((
c
=
fgetc
(
file
))
==
EOF
,
"getc did not return EOF
\n
"
);
ok
(
feof
(
file
),
"feof did not return EOF
\n
"
);
ok
(
ungetc
(
c
,
file
)
==
EOF
,
"ungetc(EOF) did not return EOF
\n
"
);
ok
(
feof
(
file
),
"feof after ungetc(EOF) did not return EOF
\n
"
);
ok
((
c
=
fgetc
(
file
))
==
EOF
,
"getc did not return EOF
\n
"
);
c
=
outbuffer
[
sizeof
(
outbuffer
)
-
1
];
ok
(
ungetc
(
c
,
file
)
==
c
,
"ungetc did not return its input
\n
"
);
ok
(
!
feof
(
file
),
"feof after ungetc returned EOF
\n
"
);
ok
((
c
=
fgetc
(
file
))
!=
EOF
,
"getc after ungetc returned EOF
\n
"
);
ok
(
c
==
outbuffer
[
sizeof
(
outbuffer
)
-
1
],
"getc did not return ungetc'd data
\n
"
);
ok
(
!
feof
(
file
),
"feof after getc returned EOF prematurely
\n
"
);
ok
((
c
=
fgetc
(
file
))
==
EOF
,
"getc did not return EOF
\n
"
);
ok
(
feof
(
file
),
"feof after getc did not return EOF
\n
"
);
rewind
(
file
);
ok
(
fgetpos
(
file
,
&
pos
)
==
0
,
"fgetpos failed unexpected
\n
"
);
ok
(
pos
==
0
,
"Unexpected result of fgetpos 0x%Lx
\n
"
,
pos
);
pos
=
(
ULONGLONG
)
sizeof
(
outbuffer
);
...
...
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