Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #8939 from JosJuice/oops
Android: Convert some files to LF
- Loading branch information
Showing
7 changed files
with
616 additions
and
616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,39 @@ | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "jni/AndroidCommon/AndroidCommon.h" | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <jni.h> | ||
|
|
||
| std::string GetJString(JNIEnv* env, jstring jstr) | ||
| { | ||
| std::string result = ""; | ||
| if (!jstr) | ||
| return result; | ||
|
|
||
| const char* s = env->GetStringUTFChars(jstr, nullptr); | ||
| result = s; | ||
| env->ReleaseStringUTFChars(jstr, s); | ||
| return result; | ||
| } | ||
|
|
||
| jstring ToJString(JNIEnv* env, const std::string& str) | ||
| { | ||
| return env->NewStringUTF(str.c_str()); | ||
| } | ||
|
|
||
| std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array) | ||
| { | ||
| const jsize size = env->GetArrayLength(array); | ||
| std::vector<std::string> result; | ||
| result.reserve(size); | ||
|
|
||
| for (jsize i = 0; i < size; ++i) | ||
| result.push_back(GetJString(env, (jstring)env->GetObjectArrayElement(array, i))); | ||
|
|
||
| return result; | ||
| } | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "jni/AndroidCommon/AndroidCommon.h" | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <jni.h> | ||
|
|
||
| std::string GetJString(JNIEnv* env, jstring jstr) | ||
| { | ||
| std::string result = ""; | ||
| if (!jstr) | ||
| return result; | ||
|
|
||
| const char* s = env->GetStringUTFChars(jstr, nullptr); | ||
| result = s; | ||
| env->ReleaseStringUTFChars(jstr, s); | ||
| return result; | ||
| } | ||
|
|
||
| jstring ToJString(JNIEnv* env, const std::string& str) | ||
| { | ||
| return env->NewStringUTF(str.c_str()); | ||
| } | ||
|
|
||
| std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array) | ||
| { | ||
| const jsize size = env->GetArrayLength(array); | ||
| std::vector<std::string> result; | ||
| result.reserve(size); | ||
|
|
||
| for (jsize i = 0; i < size; ++i) | ||
| result.push_back(GetJString(env, (jstring)env->GetObjectArrayElement(array, i))); | ||
|
|
||
| return result; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <jni.h> | ||
|
|
||
| std::string GetJString(JNIEnv* env, jstring jstr); | ||
| jstring ToJString(JNIEnv* env, const std::string& str); | ||
| std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array); | ||
| // Copyright 2018 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <jni.h> | ||
|
|
||
| std::string GetJString(JNIEnv* env, jstring jstr); | ||
| jstring ToJString(JNIEnv* env, const std::string& str); | ||
| std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array); |
Oops, something went wrong.