mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 10:31:07 +00:00
Use LiStringifyPortFlags() instead of coding it ourselves
This commit is contained in:
@@ -293,13 +293,11 @@ public class MoonBridge {
|
||||
|
||||
public static native int testClientConnectivity(String testServerHostName, int referencePort, int testFlags);
|
||||
|
||||
public static native int getPortFromPortFlagIndex(int portFlagIndex);
|
||||
|
||||
public static native String getProtocolFromPortFlagIndex(int portFlagIndex);
|
||||
|
||||
public static native int getPortFlagsFromStage(int stage);
|
||||
|
||||
public static native int getPortFlagsFromTerminationErrorCode(int errorCode);
|
||||
|
||||
public static native String stringifyPortFlags(int portFlags, String separator);
|
||||
|
||||
public static native void init();
|
||||
}
|
||||
|
||||
@@ -101,11 +101,7 @@ public class ServerHelper {
|
||||
}
|
||||
else {
|
||||
dialogSummary = parent.getResources().getString(R.string.nettest_text_failure);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if ((ret & (1 << i)) != 0) {
|
||||
dialogSummary += MoonBridge.getProtocolFromPortFlagIndex(i) + " " + MoonBridge.getPortFromPortFlagIndex(i) + "\n";
|
||||
}
|
||||
}
|
||||
dialogSummary += MoonBridge.stringifyPortFlags(ret, "\n");
|
||||
}
|
||||
|
||||
Dialog.displayDialog(parent,
|
||||
|
||||
Submodule app/src/main/jni/moonlight-core/moonlight-common-c updated: ce546b12b0...cca2ba9aab
@@ -115,17 +115,6 @@ Java_com_limelight_nvstream_jni_MoonBridge_testClientConnectivity(JNIEnv *env, j
|
||||
return ret;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFromPortFlagIndex(JNIEnv *env, jclass clazz, jint portFlagIndex) {
|
||||
return LiGetPortFromPortFlagIndex(portFlagIndex);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_getProtocolFromPortFlagIndex(JNIEnv *env, jclass clazz, jint portFlagIndex) {
|
||||
int protocol = LiGetProtocolFromPortFlagIndex(portFlagIndex);
|
||||
return (*env)->NewStringUTF(env, protocol == IPPROTO_TCP ? "TCP" : "UDP");
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jclass clazz, jint stage) {
|
||||
return LiGetPortFlagsFromStage(stage);
|
||||
@@ -134,4 +123,15 @@ Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jc
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromTerminationErrorCode(JNIEnv *env, jclass clazz, jint errorCode) {
|
||||
return LiGetPortFlagsFromTerminationErrorCode(errorCode);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_stringifyPortFlags(JNIEnv *env, jclass clazz, jint portFlags, jstring separator) {
|
||||
const char* separatorStr = (*env)->GetStringUTFChars(env, separator, NULL);
|
||||
char outputBuffer[512];
|
||||
|
||||
LiStringifyPortFlags(portFlags, separatorStr, outputBuffer, sizeof(outputBuffer));
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, separator, separatorStr);
|
||||
return (*env)->NewStringUTF(env, outputBuffer);
|
||||
}
|
||||
Reference in New Issue
Block a user