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
5bf1ae82
Commit
5bf1ae82
authored
Jan 28, 2009
by
Dan Kegel
Committed by
Alexandre Julliard
Jan 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: _flsbuf zeroes _cnt.
parent
c2c564db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
file.c
dlls/msvcrt/file.c
+2
-0
file.c
dlls/msvcrt/tests/file.c
+22
-1
No files found.
dlls/msvcrt/file.c
View file @
5bf1ae82
...
...
@@ -2592,6 +2592,8 @@ int CDECL MSVCRT__flsbuf(int c, MSVCRT_FILE* file)
}
else
{
unsigned
char
cc
=
c
;
int
len
;
/* set _cnt to 0 for unbuffered FILEs */
file
->
_cnt
=
0
;
len
=
MSVCRT__write
(
file
->
_file
,
&
cc
,
1
);
if
(
len
==
1
)
return
c
&
0xff
;
file
->
_flag
|=
MSVCRT__IOERR
;
...
...
dlls/msvcrt/tests/file.c
View file @
5bf1ae82
...
...
@@ -471,9 +471,10 @@ static void test_flsbuf( void )
{
char
*
tempf
;
FILE
*
tempfh
;
int
c
;
int
ret
;
int
bufmode
;
int
bufmodes
[]
=
{
_IOFBF
,
_IONBF
};
static
const
int
bufmodes
[]
=
{
_IOFBF
,
_IONBF
};
tempf
=
_tempnam
(
"."
,
"wne"
);
for
(
bufmode
=
0
;
bufmode
<
sizeof
(
bufmodes
)
/
sizeof
(
bufmodes
[
0
]);
bufmode
++
)
...
...
@@ -497,6 +498,26 @@ static void test_flsbuf( void )
ok
(
EOF
==
ret
,
"_flsbuf(0,tempfh) on r/o file expected %x got %x
\n
"
,
EOF
,
ret
);
fclose
(
tempfh
);
/* See bug 17123, exposed by WinAVR's make */
tempfh
=
fopen
(
tempf
,
"w"
);
ok
(
tempfh
->
_cnt
==
0
,
"_cnt on freshly opened file was %d
\n
"
,
tempfh
->
_cnt
);
setbuf
(
tempfh
,
NULL
);
ok
(
tempfh
->
_cnt
==
0
,
"_cnt on unbuffered file was %d
\n
"
,
tempfh
->
_cnt
);
/* Inlined putchar sets _cnt to -1. Native seems to ignore the value... */
tempfh
->
_cnt
=
1234
;
ret
=
_flsbuf
(
'Q'
,
tempfh
);
ok
(
'Q'
==
ret
,
"_flsbuf('Q',tempfh) expected %x got %x
\n
"
,
'Q'
,
ret
);
/* ... and reset it to zero */
ok
(
tempfh
->
_cnt
==
0
,
"after unbuf _flsbuf, _cnt was %d
\n
"
,
tempfh
->
_cnt
);
fclose
(
tempfh
);
/* And just for grins, make sure the file is correct */
tempfh
=
fopen
(
tempf
,
"r"
);
c
=
fgetc
(
tempfh
);
ok
(
c
==
'Q'
,
"first byte should be 'Q'
\n
"
);
c
=
fgetc
(
tempfh
);
ok
(
c
==
EOF
,
"there should only be one byte
\n
"
);
fclose
(
tempfh
);
unlink
(
tempf
);
}
...
...
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