Commit 107fb22c authored by Sylvain Berfini's avatar Sylvain Berfini

Fix XML2LPC and LPC2XML converters JNI log callbacks

parent a216dc8f
......@@ -26,6 +26,7 @@ extern "C" {
#endif
#include <stdio.h>
#include "mediastreamer2/mscommon.h"
struct jni_lpc2xml_ctx {
JNIEnv *env;
......@@ -52,10 +53,14 @@ extern "C" void Java_org_linphone_tools_Lpc2Xml_callback (void *ctx, lpc2xml_log
char buffer[LPC2XML_CALLBACK_BUFFER_SIZE];
vsnprintf(buffer, LPC2XML_CALLBACK_BUFFER_SIZE, fmt, list);
jstring javaString = env->NewStringUTF(buffer);
jint javaLevel = level;
my_jni::callVoidMethod<void>(env, obj, "Lpc2Xml", "printLog", "(ILjava/lang/String;)V", javaLevel, javaString);
}
if (level == LPC2XML_ERROR)
ms_error("%s", buffer);
else if (level == LPC2XML_WARNING)
ms_warning("%s", buffer);
else
ms_message("%s", buffer);
}
}
extern "C" void Java_org_linphone_tools_Lpc2Xml_init(JNIEnv *env, jobject obj) {
......
......@@ -26,6 +26,7 @@ extern "C" {
#endif
#include <stdio.h>
#include "mediastreamer2/mscommon.h"
struct jni_xml2lpc_ctx {
JNIEnv *env;
......@@ -52,9 +53,13 @@ extern "C" void Java_org_linphone_tools_Xml2Lpc_callback (void *ctx, xml2lpc_log
char buffer[XML2LPC_CALLBACK_BUFFER_SIZE];
vsnprintf(buffer, XML2LPC_CALLBACK_BUFFER_SIZE, fmt, list);
jstring javaString = env->NewStringUTF(buffer);
jint javaLevel = level;
my_jni::callVoidMethod<void>(env, obj, "Xml2Lpc", "printLog", "(ILjava/lang/String;)V", javaLevel, javaString);
if (level == XML2LPC_ERROR)
ms_error("%s", buffer);
else if (level == XML2LPC_WARNING)
ms_warning("%s", buffer);
else
ms_message("%s", buffer);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment