1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 01:36:55 +00:00

Log sample size

This commit is contained in:
M66B 2020-10-25 11:27:35 +01:00
parent 8fcb2b831b
commit ec8317b1be
2 changed files with 11 additions and 4 deletions

View file

@ -111,18 +111,20 @@ class CharsetHelper {
private static class DetectResult { private static class DetectResult {
String charset; String charset;
int sample_size;
int bytes_consumed; int bytes_consumed;
boolean is_reliable; boolean is_reliable;
DetectResult(String charset, int bytes_consumed, boolean is_reliable) { DetectResult(String charset, int sample_size, int bytes_consumed, boolean is_reliable) {
this.charset = charset; this.charset = charset;
this.sample_size = sample_size;
this.bytes_consumed = bytes_consumed; this.bytes_consumed = bytes_consumed;
this.is_reliable = is_reliable; this.is_reliable = is_reliable;
} }
@Override @Override
public String toString() { public String toString() {
return charset + " c=" + bytes_consumed + " r=" + is_reliable; return charset + " s=" + bytes_consumed + "/" + sample_size + " r=" + is_reliable;
} }
} }
} }

View file

@ -42,7 +42,12 @@ Java_eu_faircode_email_CharsetHelper_jni_1detect(JNIEnv *env, jclass type, jbyte
env->ReleaseByteArrayElements(_octets, octets, JNI_ABORT); env->ReleaseByteArrayElements(_octets, octets, JNI_ABORT);
jclass cls = env->FindClass("eu/faircode/email/CharsetHelper$DetectResult"); jclass cls = env->FindClass("eu/faircode/email/CharsetHelper$DetectResult");
jmethodID ctor = env->GetMethodID(cls, "<init>", "(Ljava/lang/String;IZ)V"); jmethodID ctor = env->GetMethodID(cls, "<init>", "(Ljava/lang/String;IIZ)V");
jstring jname = env->NewStringUTF(name); jstring jname = env->NewStringUTF(name);
return env->NewObject(cls, ctor, jname, (jint) bytes_consumed, (jboolean) is_reliable); return env->NewObject(
cls, ctor,
jname,
(jint) len,
(jint) bytes_consumed,
(jboolean) is_reliable);
} }