diff options
author | 2014-05-14 17:42:47 +0900 | |
---|---|---|
committer | 2014-05-14 17:42:47 +0900 | |
commit | d2f7cd28aefb71f3f340f1a8572e5477e5f5dfb3 (patch) | |
tree | df9d2a749eb114922cfbbecdee7a08000c427a3c /native/jni/src/utils/jni_data_utils.h | |
parent | c1e86d3f491e65ae11b9dc8d932c3775c50394e4 (diff) | |
download | latinime-d2f7cd28aefb71f3f340f1a8572e5477e5f5dfb3.tar.gz latinime-d2f7cd28aefb71f3f340f1a8572e5477e5f5dfb3.tar.xz latinime-d2f7cd28aefb71f3f340f1a8572e5477e5f5dfb3.zip |
Use JniDataUtils::outputCodePoints() to output code points
Bug: 14119293
Bug: 13758761
Change-Id: I516d2f96e219e6e65246f502186ccb9bd5f0670f
Diffstat (limited to 'native/jni/src/utils/jni_data_utils.h')
-rw-r--r-- | native/jni/src/utils/jni_data_utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/native/jni/src/utils/jni_data_utils.h b/native/jni/src/utils/jni_data_utils.h index 2ce02dc05..0e393e315 100644 --- a/native/jni/src/utils/jni_data_utils.h +++ b/native/jni/src/utils/jni_data_utils.h @@ -65,6 +65,18 @@ class JniDataUtils { return attributeMap; } + static void outputCodePoints(JNIEnv *env, jintArray intArrayToOutputCodePoints, const int start, + const int maxLength, const int *const codePoints, const int codePointCount, + const bool needsNullTermination) { + const int outputCodePointCount = std::min(maxLength, codePointCount); + env->SetIntArrayRegion(intArrayToOutputCodePoints, start, outputCodePointCount, codePoints); + if (needsNullTermination && outputCodePointCount < maxLength) { + const int terminal = 0; + env->SetIntArrayRegion(intArrayToOutputCodePoints, start + outputCodePointCount, + 1 /* len */, &terminal); + } + } + private: DISALLOW_IMPLICIT_CONSTRUCTORS(JniDataUtils); }; |