Skip to content

Commit 761de8f

Browse files
authored
Avoid longs when specifying precision in a sprintf argument. (#1041)
Causes a compiler warning which is treated as error when building for the Android platform. Note 1: Simply casting to an int here as no real harm can befall us if it wraps or gets treated as negative. Note 2: Given that JNI tracing is a compile time option (there's a constant in trace.cc) we should probably re-write the JNI_TRACE macro to expand to nothing unless it is enabled, as currently we are wasting several k on format strings that will never be used. This would also improve our coverage metrics for trace messages that are never reached by tests too ;) I shall do that as a follow-up
1 parent 8c00322 commit 761de8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

common/src/jni/main/cpp/conscrypt/native_crypto.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4193,7 +4193,7 @@ static jobject GENERAL_NAME_to_jobject(JNIEnv* env, GENERAL_NAME* gen) {
41934193
// Converting ASCII to UTF-16 is the identity function.
41944194
jchars.push_back(data[i]);
41954195
}
4196-
JNI_TRACE("GENERAL_NAME_to_jobject(%p) => Email/DNS/URI \"%.*s\"", gen, len, data);
4196+
JNI_TRACE("GENERAL_NAME_to_jobject(%p)=> Email/DNS/URI \"%.*s\"", gen, (int) len, data);
41974197
return env->NewString(jchars.data(), jchars.size());
41984198
}
41994199
case GEN_DIRNAME:

0 commit comments

Comments
 (0)