mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Add android redirect to logcat
This commit is contained in:
parent
c368a8b74a
commit
51e8a00f58
@ -644,6 +644,9 @@ Java_java_io_FileOutputStream_open(JNIEnv* e, jclass, jstring path, jboolean app
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
#include <android/log.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_java_io_FileOutputStream_write__II(JNIEnv* e, jclass, jint fd, jint c)
|
Java_java_io_FileOutputStream_write__II(JNIEnv* e, jclass, jint fd, jint c)
|
||||||
@ -657,13 +660,18 @@ Java_java_io_FileOutputStream_write__I_3BII
|
|||||||
(JNIEnv* e, jclass, jint fd, jbyteArray b, jint offset, jint length)
|
(JNIEnv* e, jclass, jint fd, jbyteArray b, jint offset, jint length)
|
||||||
{
|
{
|
||||||
jbyte* data = static_cast<jbyte*>(malloc(length));
|
jbyte* data = static_cast<jbyte*>(malloc(length));
|
||||||
|
|
||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
throwNew(e, "java/lang/OutOfMemoryError", 0);
|
throwNew(e, "java/lang/OutOfMemoryError", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
e->GetByteArrayRegion(b, offset, length, data);
|
e->GetByteArrayRegion(b, offset, length, data);
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
if(fd == 1) {
|
||||||
|
__android_log_print(ANDROID_LOG_WARN, "net.osmand:native", "%.*s",length, data);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (not e->ExceptionCheck()) {
|
if (not e->ExceptionCheck()) {
|
||||||
doWrite(e, fd, data, length);
|
doWrite(e, fd, data, length);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user