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
7b8b62e6
Commit
7b8b62e6
authored
Oct 07, 2003
by
Uwe Bonnes
Committed by
Alexandre Julliard
Oct 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fget(w)s(): Don't drop characters when buffer is not large enough.
parent
16fa0090
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
file.c
dlls/msvcrt/file.c
+16
-22
No files found.
dlls/msvcrt/file.c
View file @
7b8b62e6
...
...
@@ -1714,27 +1714,24 @@ int MSVCRT_fgetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
*/
char
*
MSVCRT_fgets
(
char
*
s
,
int
size
,
MSVCRT_FILE
*
file
)
{
int
cc
;
int
cc
=
MSVCRT_EOF
;
char
*
buf_start
=
s
;
TRACE
(
":file(%p) fd (%d) str (%p) len (%d)
\n
"
,
file
,
file
->
_file
,
s
,
size
);
for
(
cc
=
MSVCRT_fgetc
(
file
);
cc
!=
MSVCRT_EOF
&&
cc
!=
'\n'
;
cc
=
MSVCRT_fgetc
(
file
))
/* _read already handled the translation */
while
((
size
>
1
)
&&
(
cc
=
MSVCRT_fgetc
(
file
))
!=
MSVCRT_EOF
&&
cc
!=
'\n'
)
{
if
(
--
size
<=
0
)
break
;
*
s
++
=
(
char
)
cc
;
size
--
;
}
if
((
cc
==
MSVCRT_EOF
)
&&
(
s
==
buf_start
))
/* If nothing read, return 0*/
{
TRACE
(
":nothing read
\n
"
);
return
0
;
return
NULL
;
}
if
(
cc
==
'\n'
)
if
(
--
size
>
0
)
*
s
++
=
'\n'
;
if
((
cc
!=
MSVCRT_EOF
)
&&
(
size
>
1
))
*
s
++
=
cc
;
*
s
=
'\0'
;
TRACE
(
":got '%s'
\n
"
,
debugstr_a
(
buf_start
));
return
buf_start
;
...
...
@@ -1797,29 +1794,26 @@ MSVCRT_wint_t MSVCRT_getwchar(void)
*/
MSVCRT_wchar_t
*
MSVCRT_fgetws
(
MSVCRT_wchar_t
*
s
,
int
size
,
MSVCRT_FILE
*
file
)
{
int
cc
;
int
cc
=
MSVCRT_WEOF
;
MSVCRT_wchar_t
*
buf_start
=
s
;
TRACE
(
":file(%p) fd (%d) str (%p) len (%d)
\n
"
,
file
,
file
->
_file
,
s
,
size
);
for
(
cc
=
MSVCRT_fgetwc
(
file
);
cc
!=
MSVCRT_WEOF
&&
cc
!=
L'\n'
;
cc
=
MSVCRT_fgetwc
(
file
))
/* _read already handled the translation */
while
((
size
>
1
)
&&
(
cc
=
MSVCRT_fgetwc
(
file
))
!=
MSVCRT_WEOF
&&
cc
!=
'\n'
)
{
if
(
--
size
<=
0
)
break
;
*
s
++
=
cc
;
*
s
++
=
(
char
)
cc
;
size
--
;
}
if
((
cc
==
MSVCRT_EOF
)
&&
(
s
==
buf_start
))
/* If nothing read, return 0*/
if
((
cc
==
MSVCRT_
W
EOF
)
&&
(
s
==
buf_start
))
/* If nothing read, return 0*/
{
TRACE
(
":nothing read
\n
"
);
return
0
;
return
NULL
;
}
if
(
cc
==
L'\n'
)
if
(
--
size
>
0
)
*
s
++
=
'\n'
;
*
s
=
'\0'
;
/* TRACE(":got '%s'\n", buf_start); */
if
((
cc
!=
MSVCRT_WEOF
)
&&
(
size
>
1
))
*
s
++
=
cc
;
*
s
=
0
;
TRACE
(
":got %s
\n
"
,
debugstr_w
(
buf_start
));
return
buf_start
;
}
...
...
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