[Scummvm-git-logs] scummvm master -> 357493082fb9b6b7e66f05394db839da761bbb29

ccawley2011 ccawley2011 at gmail.com
Tue Jul 23 18:21:46 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
357493082f ANDROID: Fix some Codacy warnings


Commit: 357493082fb9b6b7e66f05394db839da761bbb29
    https://github.com/scummvm/scummvm/commit/357493082fb9b6b7e66f05394db839da761bbb29
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-23T17:21:09+01:00

Commit Message:
ANDROID: Fix some Codacy warnings

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/jni.cpp


diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 4f1b852..f3dc0b5 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 47dd5c7..ffe6006 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");





More information about the Scummvm-git-logs mailing list