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
bc194793
Commit
bc194793
authored
Jul 31, 2006
by
Duane Clark
Committed by
Alexandre Julliard
Jul 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix fgetwc/s in binary mode.
parent
d74b6055
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
file.c
dlls/msvcrt/file.c
+22
-4
file.c
dlls/msvcrt/tests/file.c
+10
-10
No files found.
dlls/msvcrt/file.c
View file @
bc194793
...
...
@@ -2179,14 +2179,32 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
if
(
!
(
MSVCRT_fdesc
[
file
->
_file
].
wxflag
&
WX_TEXT
))
{
MSVCRT_wchar_t
wc
;
int
r
;
if
((
r
=
_read
(
file
->
_file
,
&
wc
,
sizeof
(
wc
)))
!=
sizeof
(
wc
))
int
i
,
j
;
char
*
chp
,
*
wcp
;
wcp
=
(
char
*
)
&
wc
;
for
(
i
=
0
;
i
<
sizeof
(
wc
);
i
++
)
{
file
->
_flag
|=
(
r
==
0
)
?
MSVCRT__IOEOF
:
MSVCRT__IOERR
;
return
MSVCRT_WEOF
;
if
(
file
->
_cnt
>
0
)
{
file
->
_cnt
--
;
chp
=
file
->
_ptr
++
;
wcp
[
i
]
=
*
chp
;
}
else
{
j
=
MSVCRT__filbuf
(
file
);
if
(
file
->
_cnt
<=
0
)
{
file
->
_flag
|=
(
file
->
_cnt
==
0
)
?
MSVCRT__IOEOF
:
MSVCRT__IOERR
;
file
->
_cnt
=
0
;
return
MSVCRT_WEOF
;
}
wcp
[
i
]
=
j
;
}
}
return
wc
;
}
c
=
MSVCRT_fgetc
(
file
);
if
((
*
__p___mb_cur_max
()
>
1
)
&&
MSVCRT_isleadbyte
(
c
))
{
...
...
dlls/msvcrt/tests/file.c
View file @
bc194793
...
...
@@ -329,28 +329,28 @@ static void test_fgetwc( void )
j
++
;
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
fgetws
(
wtextW
,
3
,
tempfh
);
todo_wine
ok
(
wtextW
[
0
]
==
'\r'
,
"expected carriage return got %04hx
\n
"
,
wtextW
[
0
]);
todo_wine
ok
(
wtextW
[
1
]
==
'\n'
,
"expected newline got %04hx
\n
"
,
wtextW
[
1
]);
ok
(
wtextW
[
0
]
==
'\r'
,
"expected carriage return got %04hx
\n
"
,
wtextW
[
0
]);
ok
(
wtextW
[
1
]
==
'\n'
,
"expected newline got %04hx
\n
"
,
wtextW
[
1
]);
l
=
ftell
(
tempfh
);
j
+=
4
;
todo_wine
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
for
(
i
=
0
;
i
<
strlen
(
mytext
);
i
++
)
wtextW
[
i
]
=
0
;
/* the first time we get the string, it should be entirely within the local buffer */
fgetws
(
wtextW
,
LLEN
,
tempfh
);
l
=
ftell
(
tempfh
);
j
+=
(
strlen
(
mytext
)
-
1
)
*
sizeof
(
WCHAR
);
todo_wine
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
ok
(
l
==
j
,
"ftell expected %d got %ld
\n
"
,
j
,
l
);
diff_found
=
FALSE
;
aptr
=
mytextW
;
wptr
=
wtextW
;
for
(
i
=
0
;
i
<
strlen
(
mytext
)
-
2
;
i
++
,
aptr
++
,
wptr
++
)
{
todo_wine
ok
(
*
aptr
==
*
wptr
,
"Char %d expected %04hx got %04hx
\n
"
,
i
,
*
aptr
,
*
wptr
);
ok
(
*
aptr
==
*
wptr
,
"Char %d expected %04hx got %04hx
\n
"
,
i
,
*
aptr
,
*
wptr
);
diff_found
|=
(
*
aptr
!=
*
wptr
);
}
todo_wine
ok
(
!
(
diff_found
),
"fgetwc difference found in BINARY mode
\n
"
);
todo_wine
ok
(
*
wptr
==
'\n'
,
"Should get newline
\n
"
);
ok
(
!
(
diff_found
),
"fgetwc difference found in BINARY mode
\n
"
);
ok
(
*
wptr
==
'\n'
,
"Should get newline
\n
"
);
for
(
i
=
0
;
i
<
strlen
(
mytext
);
i
++
)
wtextW
[
i
]
=
0
;
/* the second time we get the string, it should cross the local buffer boundary.
...
...
@@ -361,11 +361,11 @@ static void test_fgetwc( void )
wptr
=
wtextW
;
for
(
i
=
0
;
i
<
strlen
(
mytext
)
-
2
;
i
++
,
aptr
++
,
wptr
++
)
{
todo_wine
ok
(
*
aptr
==
*
wptr
,
"Char %d expected %04hx got %04hx
\n
"
,
i
,
*
aptr
,
*
wptr
);
ok
(
*
aptr
==
*
wptr
,
"Char %d expected %04hx got %04hx
\n
"
,
i
,
*
aptr
,
*
wptr
);
diff_found
|=
(
*
aptr
!=
*
wptr
);
}
todo_wine
ok
(
!
(
diff_found
),
"fgetwc difference found in BINARY mode
\n
"
);
todo_wine
ok
(
*
wptr
==
'\n'
,
"Should get newline
\n
"
);
ok
(
!
(
diff_found
),
"fgetwc difference found in BINARY mode
\n
"
);
ok
(
*
wptr
==
'\n'
,
"Should get newline
\n
"
);
if
(
mytextW
)
free
(
mytextW
);
fclose
(
tempfh
);
...
...
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