mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-26 06:22:45 +00:00
Use LiStringifyPortFlags() instead of coding it ourselves
This commit is contained in:
parent
f26b384697
commit
7b26852a1f
@ -293,13 +293,11 @@ public class MoonBridge {
|
|||||||
|
|
||||||
public static native int testClientConnectivity(String testServerHostName, int referencePort, int testFlags);
|
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 getPortFlagsFromStage(int stage);
|
||||||
|
|
||||||
public static native int getPortFlagsFromTerminationErrorCode(int errorCode);
|
public static native int getPortFlagsFromTerminationErrorCode(int errorCode);
|
||||||
|
|
||||||
|
public static native String stringifyPortFlags(int portFlags, String separator);
|
||||||
|
|
||||||
public static native void init();
|
public static native void init();
|
||||||
}
|
}
|
||||||
|
@ -101,11 +101,7 @@ public class ServerHelper {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dialogSummary = parent.getResources().getString(R.string.nettest_text_failure);
|
dialogSummary = parent.getResources().getString(R.string.nettest_text_failure);
|
||||||
for (int i = 0; i < 32; i++) {
|
dialogSummary += MoonBridge.stringifyPortFlags(ret, "\n");
|
||||||
if ((ret & (1 << i)) != 0) {
|
|
||||||
dialogSummary += MoonBridge.getProtocolFromPortFlagIndex(i) + " " + MoonBridge.getPortFromPortFlagIndex(i) + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.displayDialog(parent,
|
Dialog.displayDialog(parent,
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ce546b12b0135c6267edff4a04f0d83925a8a25d
|
Subproject commit cca2ba9aabfc0e9ae18b980e7ecc08abb3888ec1
|
@ -115,17 +115,6 @@ Java_com_limelight_nvstream_jni_MoonBridge_testClientConnectivity(JNIEnv *env, j
|
|||||||
return ret;
|
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
|
JNIEXPORT jint JNICALL
|
||||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jclass clazz, jint stage) {
|
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jclass clazz, jint stage) {
|
||||||
return LiGetPortFlagsFromStage(stage);
|
return LiGetPortFlagsFromStage(stage);
|
||||||
@ -134,4 +123,15 @@ Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jc
|
|||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromTerminationErrorCode(JNIEnv *env, jclass clazz, jint errorCode) {
|
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromTerminationErrorCode(JNIEnv *env, jclass clazz, jint errorCode) {
|
||||||
return LiGetPortFlagsFromTerminationErrorCode(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);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user