Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
cb083019
Commit
cb083019
authored
Aug 04, 2016
by
Aleksey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround for bug #264
parent
b753eff6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
support-lib/jni/djinni_support.cpp
support-lib/jni/djinni_support.cpp
+8
-8
No files found.
support-lib/jni/djinni_support.cpp
View file @
cb083019
...
...
@@ -372,25 +372,25 @@ jstring jniStringFromUTF8(JNIEnv * env, const std::string & str) {
}
template
<
int
wcharTypeSize
>
static
std
::
u16string
implWStringToUTF16
(
const
std
::
wstring
&
st
r
)
static
std
::
u16string
implWStringToUTF16
(
std
::
wstring
::
const_iterator
,
std
::
wstring
::
const_iterato
r
)
{
static_assert
(
wcharTypeSize
==
2
||
wcharTypeSize
==
4
,
"wchar_t must be represented by UTF-16 or UTF-32 encoding"
);
return
{};
// unreachable
}
template
<
>
inline
std
::
u16string
implWStringToUTF16
<
2
>
(
const
std
::
wstring
&
str
)
{
inline
std
::
u16string
implWStringToUTF16
<
2
>
(
std
::
wstring
::
const_iterator
begin
,
std
::
wstring
::
const_iterator
end
)
{
// case when wchar_t is represented by utf-16 encoding
return
std
::
u16string
(
str
.
begin
(),
str
.
end
()
);
return
std
::
u16string
(
begin
,
end
);
}
template
<
>
inline
std
::
u16string
implWStringToUTF16
<
4
>
(
const
std
::
wstring
&
str
)
{
inline
std
::
u16string
implWStringToUTF16
<
4
>
(
std
::
wstring
::
const_iterator
begin
,
std
::
wstring
::
const_iterator
end
)
{
// case when wchar_t is represented by utf-32 encoding
std
::
u16string
utf16
;
utf16
.
reserve
(
st
r
.
length
(
));
for
(
size_t
i
=
0
;
i
<
str
.
length
();
++
i
)
utf16_encode
(
static_cast
<
char32_t
>
(
str
[
i
]
),
utf16
);
utf16
.
reserve
(
st
d
::
distance
(
begin
,
end
));
for
(;
begin
!=
end
;
++
begin
)
utf16_encode
(
static_cast
<
char32_t
>
(
*
begin
),
utf16
);
return
utf16
;
}
...
...
@@ -398,7 +398,7 @@ inline std::u16string wstringToUTF16(const std::wstring & str) {
// hide "defined but not used" warnings
(
void
)
implWStringToUTF16
<
2
>
;
(
void
)
implWStringToUTF16
<
4
>
;
return
implWStringToUTF16
<
sizeof
(
wchar_t
)
>
(
str
);
return
implWStringToUTF16
<
sizeof
(
wchar_t
)
>
(
str
.
cbegin
(),
str
.
cend
()
);
}
jstring
jniStringFromWString
(
JNIEnv
*
env
,
const
std
::
wstring
&
str
)
{
...
...
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