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
e12862a9
Commit
e12862a9
authored
Jul 19, 2016
by
Aleksey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code-style
parent
236cd7f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
support-lib/jni/djinni_support.cpp
support-lib/jni/djinni_support.cpp
+4
-5
No files found.
support-lib/jni/djinni_support.cpp
View file @
e12862a9
...
@@ -385,8 +385,8 @@ template<>
...
@@ -385,8 +385,8 @@ template<>
inline
std
::
u16string
implWStringToUTF16
<
4
>
(
const
std
::
wstring
&
str
)
{
inline
std
::
u16string
implWStringToUTF16
<
4
>
(
const
std
::
wstring
&
str
)
{
// case when wchar_t is represented by utf-32 encoding
// case when wchar_t is represented by utf-32 encoding
std
::
u16string
utf16
;
std
::
u16string
utf16
;
utf16
.
reserve
(
str
.
size
());
utf16
.
reserve
(
str
.
length
());
for
(
size_t
i
=
0
;
i
<
str
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
str
.
length
();
++
i
)
utf16_encode
(
static_cast
<
char32_t
>
(
str
[
i
]),
utf16
);
utf16_encode
(
static_cast
<
char32_t
>
(
str
[
i
]),
utf16
);
return
utf16
;
return
utf16
;
}
}
...
@@ -400,9 +400,8 @@ inline std::u16string wstringToUTF16(const std::wstring & str) {
...
@@ -400,9 +400,8 @@ inline std::u16string wstringToUTF16(const std::wstring & str) {
jstring
jniStringFromWString
(
JNIEnv
*
env
,
const
std
::
wstring
&
str
)
{
jstring
jniStringFromWString
(
JNIEnv
*
env
,
const
std
::
wstring
&
str
)
{
std
::
u16string
utf16
=
wstringToUTF16
(
str
);
std
::
u16string
utf16
=
wstringToUTF16
(
str
);
const
size_t
len
=
utf16
.
size
();
jstring
res
=
env
->
NewString
(
jstring
res
=
env
->
NewString
(
reinterpret_cast
<
const
jchar
*>
(
utf16
.
data
()),
len
);
reinterpret_cast
<
const
jchar
*>
(
utf16
.
data
()),
utf16
.
length
()
);
DJINNI_ASSERT
(
res
,
env
);
DJINNI_ASSERT
(
res
,
env
);
return
res
;
return
res
;
}
}
...
@@ -511,7 +510,7 @@ std::wstring jniWStringFromString(JNIEnv * env, const jstring jstr) {
...
@@ -511,7 +510,7 @@ std::wstring jniWStringFromString(JNIEnv * env, const jstring jstr) {
const
auto
deleter
=
[
env
,
jstr
]
(
const
jchar
*
c
)
{
env
->
ReleaseStringChars
(
jstr
,
c
);
};
const
auto
deleter
=
[
env
,
jstr
]
(
const
jchar
*
c
)
{
env
->
ReleaseStringChars
(
jstr
,
c
);
};
std
::
unique_ptr
<
const
jchar
,
decltype
(
deleter
)
>
ptr
(
env
->
GetStringChars
(
jstr
,
nullptr
),
std
::
unique_ptr
<
const
jchar
,
decltype
(
deleter
)
>
ptr
(
env
->
GetStringChars
(
jstr
,
nullptr
),
deleter
);
deleter
);
const
char16_t
*
data
=
reinterpret_cast
<
const
char16_t
*>
(
ptr
.
get
());
const
char16_t
*
data
=
reinterpret_cast
<
const
char16_t
*>
(
ptr
.
get
());
return
UTF16ToWString
(
data
,
length
);
return
UTF16ToWString
(
data
,
length
);
}
}
...
...
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