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 {
String charset;
int sample_size;
int bytes_consumed;
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.sample_size = sample_size;
this.bytes_consumed = bytes_consumed;
this.is_reliable = is_reliable;
}
@Override
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);
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);
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);
}