NativeHandleWrapper shouldn't return native_handle_t* in const
DuplicateHandle() and TakeHandle() are returning the native_handle_t*
as passing ownership out of the wrapper. Thus the returned pointer
shouldn't be in const.
Bug: 111976433
Test: buffer_hub-test
Change-Id: Ie353046f5b59beab674a81f4490d5de1d4beaa2e
diff --git a/libs/vr/libbufferhub/include/private/dvr/native_handle_wrapper.h b/libs/vr/libbufferhub/include/private/dvr/native_handle_wrapper.h
index 3086982..ae70b77 100644
--- a/libs/vr/libbufferhub/include/private/dvr/native_handle_wrapper.h
+++ b/libs/vr/libbufferhub/include/private/dvr/native_handle_wrapper.h
@@ -40,7 +40,7 @@
bool IsValid() const { return ints_.size() != 0 || fds_.size() != 0; }
// Duplicate a native handle from the wrapper.
- const native_handle_t* DuplicateHandle() const {
+ native_handle_t* DuplicateHandle() const {
if (!IsValid()) {
return nullptr;
}
@@ -58,7 +58,7 @@
}
// Takes the native handle out of the wrapper.
- const native_handle_t* TakeHandle() {
+ native_handle_t* TakeHandle() {
if (!IsValid()) {
return nullptr;
}
@@ -70,8 +70,8 @@
NativeHandleWrapper(const NativeHandleWrapper&) = delete;
void operator=(const NativeHandleWrapper&) = delete;
- static const native_handle_t* FromFdsAndInts(std::vector<FileHandleType> fds,
- std::vector<int> ints) {
+ static native_handle_t* FromFdsAndInts(std::vector<FileHandleType> fds,
+ std::vector<int> ints) {
native_handle_t* handle = native_handle_create(fds.size(), ints.size());
if (!handle) {
ALOGE("NativeHandleWrapper::TakeHandle: Failed to create new handle.");