Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Convert some files to LF #8939

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 39 additions & 39 deletions Source/Android/jni/AndroidCommon/AndroidCommon.cpp
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;
}
26 changes: 13 additions & 13 deletions Source/Android/jni/AndroidCommon/AndroidCommon.h
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);