aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Cawley2019-07-23 17:21:09 +0100
committerCameron Cawley2019-07-23 17:21:09 +0100
commit357493082fb9b6b7e66f05394db839da761bbb29 (patch)
tree12101bd0cdaa3ff03e5b13ebc751a2603ce13684
parent1f2882b5a3b07c675a152f2f5e553f40c4bbd5b5 (diff)
downloadscummvm-rg350-357493082fb9b6b7e66f05394db839da761bbb29.tar.gz
scummvm-rg350-357493082fb9b6b7e66f05394db839da761bbb29.tar.bz2
scummvm-rg350-357493082fb9b6b7e66f05394db839da761bbb29.zip
ANDROID: Fix some Codacy warnings
-rw-r--r--backends/platform/android/android.cpp11
-rw-r--r--backends/platform/android/jni.cpp9
2 files changed, 7 insertions, 13 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 4f1b852d26..f3dc0b5876 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -231,9 +231,7 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
bool paused = true;
- byte *buf;
- int offset, left, written;
- int samples, i;
+ int offset, left, written, i;
struct timespec tv_delay;
tv_delay.tv_sec = 0;
@@ -245,7 +243,6 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
tv_full.tv_sec = 0;
tv_full.tv_nsec = msecs_full * 1000 * 1000;
- bool silence;
uint silence_count = 33;
while (!system->_audio_thread_exit) {
@@ -260,12 +257,12 @@ void *OSystem_Android::audioThreadFunc(void *arg) {
LOGD("audio thread woke up");
}
- buf = (byte *)env->GetPrimitiveArrayCritical(bufa, 0);
+ byte *buf = (byte *)env->GetPrimitiveArrayCritical(bufa, 0);
assert(buf);
- samples = mixer->mixCallback(buf, buf_size);
+ int samples = mixer->mixCallback(buf, buf_size);
- silence = samples < 1;
+ bool silence = samples < 1;
// looks stupid, and it is, but currently there's no way to detect
// silence-only buffers from the mixer
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 47dd5c73cf..ffe60062fb 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -260,9 +260,8 @@ bool JNI::openUrl(const char *url) {
}
bool JNI::hasTextInClipboard() {
- bool hasText = false;
JNIEnv *env = JNI::getEnv();
- hasText = env->CallBooleanMethod(_jobj, _MID_hasTextInClipboard);
+ bool hasText = env->CallBooleanMethod(_jobj, _MID_hasTextInClipboard);
if (env->ExceptionCheck()) {
LOGE("Failed to check the contents of the clipboard");
@@ -299,13 +298,12 @@ Common::String JNI::getTextFromClipboard() {
}
bool JNI::setTextInClipboard(const Common::String &text) {
- bool success = true;
JNIEnv *env = JNI::getEnv();
jbyteArray javaText = env->NewByteArray(text.size());
env->SetByteArrayRegion(javaText, 0, text.size(), reinterpret_cast<const jbyte*>(text.c_str()));
- success = env->CallBooleanMethod(_jobj, _MID_setTextInClipboard, javaText);
+ bool success = env->CallBooleanMethod(_jobj, _MID_setTextInClipboard, javaText);
if (env->ExceptionCheck()) {
LOGE("Failed to add text to the clipboard");
@@ -320,9 +318,8 @@ bool JNI::setTextInClipboard(const Common::String &text) {
}
bool JNI::isConnectionLimited() {
- bool limited = false;
JNIEnv *env = JNI::getEnv();
- limited = env->CallBooleanMethod(_jobj, _MID_isConnectionLimited);
+ bool limited = env->CallBooleanMethod(_jobj, _MID_isConnectionLimited);
if (env->ExceptionCheck()) {
LOGE("Failed to check whether connection's limited");