Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
090ce262
Commit
090ce262
authored
9 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/icu/Collate: use CompareStringEx() on Windows
parent
d551d408
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
Collate.cxx
src/lib/icu/Collate.cxx
+26
-0
No files found.
src/lib/icu/Collate.cxx
View file @
090ce262
...
...
@@ -37,6 +37,12 @@
#include <ctype.h>
#endif
#ifdef WIN32
#include "Win32.hxx"
#include "util/AllocatedString.hxx"
#include <windows.h>
#endif
#include <assert.h>
#include <string.h>
#include <strings.h>
...
...
@@ -107,6 +113,26 @@ IcuCollate(const char *a, const char *b)
return
result
;
#endif
#elif defined(WIN32)
const
auto
wa
=
MultiByteToWideChar
(
CP_UTF8
,
a
);
const
auto
wb
=
MultiByteToWideChar
(
CP_UTF8
,
b
);
if
(
wa
.
IsNull
())
return
wb
.
IsNull
()
?
0
:
-
1
;
else
if
(
wb
.
IsNull
())
return
1
;
auto
result
=
CompareStringEx
(
LOCALE_NAME_INVARIANT
,
LINGUISTIC_IGNORECASE
,
wa
.
c_str
(),
-
1
,
wb
.
c_str
(),
-
1
,
nullptr
,
nullptr
,
0
);
if
(
result
!=
0
)
/* "To maintain the C runtime convention of comparing
strings, the value 2 can be subtracted from a
nonzero return value." */
result
-=
2
;
return
result
;
#elif defined(HAVE_GLIB)
return
g_utf8_collate
(
a
,
b
);
#else
...
...
This diff is collapsed.
Click to expand it.
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