Allow const pointer in NativeToJavaPointer

Bug: webrtc:15032
Change-Id: I3355e3e5d6fdc15652ffb0d6d0ff0328f49fcadb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298900
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Fabian Bergmark <fabianbergmark@google.com>
Cr-Commit-Position: refs/heads/main@{#39652}
This commit is contained in:
Magnus Jedvert 2023-03-23 10:57:18 +01:00 committed by WebRTC LUCI CQ
parent 80850ca477
commit 342bbe1ad4
2 changed files with 2 additions and 2 deletions

View File

@ -328,7 +328,7 @@ void JavaMapBuilder::put(const JavaRef<jobject>& key,
JNI_Map::Java_Map_put(env_, j_map_, key, value);
}
jlong NativeToJavaPointer(void* ptr) {
jlong NativeToJavaPointer(const void* ptr) {
static_assert(sizeof(intptr_t) <= sizeof(jlong),
"Time to rethink the use of jlongs");
// Going through intptr_t to be obvious about the definedness of the

View File

@ -324,7 +324,7 @@ ScopedJavaLocalRef<jobject> NativeToJavaStringMap(JNIEnv* env,
// Return a `jlong` that will correctly convert back to `ptr`. This is needed
// because the alternative (of silently passing a 32-bit pointer to a vararg
// function expecting a 64-bit param) picks up garbage in the high 32 bits.
jlong NativeToJavaPointer(void* ptr);
jlong NativeToJavaPointer(const void* ptr);
// ------------------------
// -- Deprecated methods --