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
8a5eae21
Commit
8a5eae21
authored
Jan 06, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Handle CR/LF in ScriptItemize.
parent
020456f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
4 deletions
+57
-4
usp10.c
dlls/usp10/tests/usp10.c
+38
-0
usp10.c
dlls/usp10/usp10.c
+19
-4
No files found.
dlls/usp10/tests/usp10.c
View file @
8a5eae21
...
...
@@ -1426,6 +1426,43 @@ static void test_ScriptBreak(void)
ok
(
!
la
.
fReserved
,
"fReserved set
\n
"
);
}
static
void
test_newlines
(
void
)
{
static
const
WCHAR
test1
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'\r'
,
't'
,
'e'
,
'x'
,
't'
,
0
};
static
const
WCHAR
test2
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'\n'
,
't'
,
'e'
,
'x'
,
't'
,
0
};
static
const
WCHAR
test3
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'\r'
,
'\n'
,
't'
,
'e'
,
'x'
,
't'
,
0
};
static
const
WCHAR
test4
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'\n'
,
'\r'
,
't'
,
'e'
,
'x'
,
't'
,
0
};
static
const
WCHAR
test5
[]
=
{
'1'
,
'2'
,
'3'
,
'4'
,
'\n'
,
'\r'
,
'1'
,
'2'
,
'3'
,
'4'
,
0
};
SCRIPT_ITEM
items
[
5
];
HRESULT
hr
;
int
count
;
count
=
0
;
hr
=
ScriptItemize
(
test1
,
lstrlenW
(
test1
),
5
,
NULL
,
NULL
,
items
,
&
count
);
ok
(
hr
==
S_OK
,
"ScriptItemize failed: 0x%08x
\n
"
,
hr
);
ok
(
count
==
3
,
"got %d expected 3
\n
"
,
count
);
count
=
0
;
hr
=
ScriptItemize
(
test2
,
lstrlenW
(
test2
),
5
,
NULL
,
NULL
,
items
,
&
count
);
ok
(
hr
==
S_OK
,
"ScriptItemize failed: 0x%08x
\n
"
,
hr
);
ok
(
count
==
3
,
"got %d expected 3
\n
"
,
count
);
count
=
0
;
hr
=
ScriptItemize
(
test3
,
lstrlenW
(
test3
),
5
,
NULL
,
NULL
,
items
,
&
count
);
ok
(
hr
==
S_OK
,
"ScriptItemize failed: 0x%08x
\n
"
,
hr
);
ok
(
count
==
4
,
"got %d expected 4
\n
"
,
count
);
count
=
0
;
hr
=
ScriptItemize
(
test4
,
lstrlenW
(
test4
),
5
,
NULL
,
NULL
,
items
,
&
count
);
ok
(
hr
==
S_OK
,
"ScriptItemize failed: 0x%08x
\n
"
,
hr
);
ok
(
count
==
4
,
"got %d expected 4
\n
"
,
count
);
count
=
0
;
hr
=
ScriptItemize
(
test5
,
lstrlenW
(
test5
),
5
,
NULL
,
NULL
,
items
,
&
count
);
ok
(
hr
==
S_OK
,
"ScriptItemize failed: 0x%08x
\n
"
,
hr
);
ok
(
count
==
4
,
"got %d expected 4
\n
"
,
count
);
}
START_TEST
(
usp10
)
{
HWND
hwnd
;
...
...
@@ -1471,6 +1508,7 @@ START_TEST(usp10)
test_digit_substitution
();
test_ScriptGetProperties
();
test_ScriptBreak
();
test_newlines
();
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
...
...
dlls/usp10/usp10.c
View file @
8a5eae21
...
...
@@ -519,6 +519,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
#define Script_Arabic 6
#define Script_Latin 1
#define Script_Numeric 5
#define Script_CR 22
#define Script_LF 23
int
cnt
=
0
,
index
=
0
;
int
New_Script
=
SCRIPT_UNDEFINED
;
...
...
@@ -532,6 +534,12 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
pItems
[
index
].
iCharPos
=
0
;
memset
(
&
pItems
[
index
].
a
,
0
,
sizeof
(
SCRIPT_ANALYSIS
));
if
(
pwcInChars
[
cnt
]
==
'\r'
)
pItems
[
index
].
a
.
eScript
=
Script_CR
;
else
if
(
pwcInChars
[
cnt
]
==
'\n'
)
pItems
[
index
].
a
.
eScript
=
Script_LF
;
else
if
(
pwcInChars
[
cnt
]
>=
Numeric_start
&&
pwcInChars
[
cnt
]
<=
Numeric_stop
)
pItems
[
index
].
a
.
eScript
=
Script_Numeric
;
else
...
...
@@ -546,10 +554,16 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
TRACE
(
"New_Script=%d, eScript=%d index=%d cnt=%d iCharPos=%d
\n
"
,
New_Script
,
pItems
[
index
].
a
.
eScript
,
index
,
cnt
,
pItems
[
index
].
iCharPos
=
cnt
);
pItems
[
index
].
iCharPos
);
for
(
cnt
=
0
;
cnt
<
cInChars
;
cnt
++
)
for
(
cnt
=
1
;
cnt
<
cInChars
;
cnt
++
)
{
if
(
pwcInChars
[
cnt
]
==
'\r'
)
New_Script
=
Script_CR
;
else
if
(
pwcInChars
[
cnt
]
==
'\n'
)
New_Script
=
Script_LF
;
else
if
((
pwcInChars
[
cnt
]
>=
Numeric_start
&&
pwcInChars
[
cnt
]
<=
Numeric_stop
)
||
(
New_Script
==
Script_Numeric
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Numeric
;
...
...
@@ -558,7 +572,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
||
(
New_Script
==
Script_Arabic
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Arabic
;
else
if
((
WCHAR
)
pwcInChars
[
cnt
]
>=
Latin_start
&&
(
WCHAR
)
pwcInChars
[
cnt
]
<=
Latin_stop
)
if
((
pwcInChars
[
cnt
]
>=
Latin_start
&&
pwcInChars
[
cnt
]
<=
Latin_stop
)
||
(
New_Script
==
Script_Latin
&&
pwcInChars
[
cnt
]
==
Numeric_space
))
New_Script
=
Script_Latin
;
else
New_Script
=
SCRIPT_UNDEFINED
;
...
...
@@ -580,7 +595,7 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
if
(
New_Script
==
Script_Arabic
)
pItems
[
index
].
a
.
s
.
uBidiLevel
=
1
;
TRACE
(
"index=%d cnt=%d iCharPos=%d
\n
"
,
index
,
cnt
,
pItems
[
index
].
iCharPos
=
cnt
);
TRACE
(
"index=%d cnt=%d iCharPos=%d
\n
"
,
index
,
cnt
,
pItems
[
index
].
iCharPos
);
}
}
...
...
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