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
545f446b
Commit
545f446b
authored
Aug 19, 2007
by
Mikolaj Zalewski
Committed by
Alexandre Julliard
Aug 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Test and fix _mbsnextc.
parent
ba43c67f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
mbcs.c
dlls/msvcrt/mbcs.c
+2
-2
string.c
dlls/msvcrt/tests/string.c
+10
-0
No files found.
dlls/msvcrt/mbcs.c
View file @
545f446b
...
...
@@ -282,9 +282,9 @@ int CDECL _getmbcp(void)
*/
unsigned
int
CDECL
_mbsnextc
(
const
unsigned
char
*
str
)
{
if
(
MSVCRT___mb_cur_max
>
1
&&
MSVCRT_isleadbyte
(
*
str
))
if
(
_ismbblead
(
*
str
))
return
*
str
<<
8
|
str
[
1
];
return
*
str
;
/* ASCII CP or SB char */
return
*
str
;
}
/*********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
545f446b
...
...
@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <mbctype.h>
#define expect_eq(expr, value, type, format) { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }
static
void
*
(
*
pmemcpy
)(
void
*
,
const
void
*
,
size_t
n
);
static
int
*
(
*
pmemcmp
)(
void
*
,
const
void
*
,
size_t
n
);
...
...
@@ -163,6 +165,7 @@ static void test_mbcp(void)
{
int
mb_orig_max
=
__mb_cur_max
;
int
curr_mbcp
=
_getmbcp
();
unsigned
char
*
mbstring
=
(
unsigned
char
*
)
"
\xb0\xb1\xb2
\xb3\xb4
\xb5
"
;
/* incorrect string */
/* some two single-byte code pages*/
test_codepage
(
1252
);
...
...
@@ -182,6 +185,13 @@ static void test_mbcp(void)
ok
(
_ismbblead
(
0x123420
)
==
FALSE
,
"0x123420 should not be a lead byte
\n
"
);
ok
(
_ismbbtrail
(
'\xb0'
),
"
\xa0
should be a trail byte
\n
"
);
ok
(
_ismbbtrail
(
' '
)
==
FALSE
,
"' ' should not be a trail byte
\n
"
);
/* _mbsnextc */
expect_eq
(
_mbsnextc
(
mbstring
),
0xb0b1
,
int
,
"%x"
);
expect_eq
(
_mbsnextc
(
&
mbstring
[
2
]),
0xb220
,
int
,
"%x"
);
/* lead + invalid tail */
expect_eq
(
_mbsnextc
(
&
mbstring
[
3
]),
0x20
,
int
,
"%x"
);
/* single char */
_setmbcp
(
curr_mbcp
);
}
...
...
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