usbcamera: Fix compiler warnings
Change-Id: Ifc9fec5e90f5295d2b4a5b4c8648510565b9ba17
diff --git a/modules/usbcamera/Camera.cpp b/modules/usbcamera/Camera.cpp
index cf62f7f..b396291 100644
--- a/modules/usbcamera/Camera.cpp
+++ b/modules/usbcamera/Camera.cpp
@@ -484,9 +484,9 @@
// TODO: dump all settings
dprintf(fd, "Most Recent Settings: (%p)\n", mSettings);
- dprintf(fd, "Number of streams: %d\n", mStreams.size());
+ dprintf(fd, "Number of streams: %zu\n", mStreams.size());
for (size_t i = 0; i < mStreams.size(); i++) {
- dprintf(fd, "Stream %d/%d:\n", i, mStreams.size());
+ dprintf(fd, "Stream %zu/%zu:\n", i, mStreams.size());
mStreams[i]->dump(fd);
}
}
diff --git a/modules/usbcamera/CameraHAL.cpp b/modules/usbcamera/CameraHAL.cpp
index 652e937..c54283b 100644
--- a/modules/usbcamera/CameraHAL.cpp
+++ b/modules/usbcamera/CameraHAL.cpp
@@ -65,7 +65,7 @@
int CameraHAL::getNumberOfCameras() {
android::Mutex::Autolock al(mModuleLock);
- ALOGV("%s: %d", __func__, mCameras.size());
+ ALOGV("%s: %zu", __func__, mCameras.size());
return static_cast<int>(mCameras.size());
}
@@ -126,29 +126,29 @@
}
static hw_module_methods_t gCameraModuleMethods = {
- open : open_dev
+ .open = open_dev
};
camera_module_t HAL_MODULE_INFO_SYM __attribute__ ((visibility("default"))) = {
- common : {
- tag : HARDWARE_MODULE_TAG,
- module_api_version : CAMERA_MODULE_API_VERSION_2_4,
- hal_api_version : HARDWARE_HAL_API_VERSION,
- id : CAMERA_HARDWARE_MODULE_ID,
- name : "Default USB Camera HAL",
- author : "The Android Open Source Project",
- methods : &gCameraModuleMethods,
- dso : NULL,
- reserved : {0},
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = CAMERA_MODULE_API_VERSION_2_4,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
+ .id = CAMERA_HARDWARE_MODULE_ID,
+ .name = "Default USB Camera HAL",
+ .author = "The Android Open Source Project",
+ .methods = &gCameraModuleMethods,
+ .dso = NULL,
+ .reserved = {0},
},
- get_number_of_cameras : get_number_of_cameras,
- get_camera_info : get_camera_info,
- set_callbacks : set_callbacks,
- get_vendor_tag_ops : NULL,
- open_legacy : NULL,
- set_torch_mode : NULL,
- init : NULL,
- reserved : {0},
+ .get_number_of_cameras = get_number_of_cameras,
+ .get_camera_info = get_camera_info,
+ .set_callbacks = set_callbacks,
+ .get_vendor_tag_ops = NULL,
+ .open_legacy = NULL,
+ .set_torch_mode = NULL,
+ .init = NULL,
+ .reserved = {0},
};
} // extern "C"
diff --git a/modules/usbcamera/HotplugThread.cpp b/modules/usbcamera/HotplugThread.cpp
index 6c65086..02e7167 100644
--- a/modules/usbcamera/HotplugThread.cpp
+++ b/modules/usbcamera/HotplugThread.cpp
@@ -39,6 +39,7 @@
}
bool HotplugThread::threadLoop() {
+ (void)mModule; // silence warning about unused member.
/**
* Check camera connection status change, if connected, do below:
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index f56866e..2b83421 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -170,10 +170,9 @@
// ToDo: prettyprint usage mask flags
dprintf(fd, "Gralloc Usage Mask: %#" PRIx32 "\n", mStream->usage);
dprintf(fd, "Max Buffer Count: %" PRIu32 "\n", mStream->max_buffers);
- dprintf(fd, "Number of Buffers in use by HAL: %" PRIu32 "\n", mBuffers.size());
+ dprintf(fd, "Number of Buffers in use by HAL: %zu\n", mBuffers.size());
for (size_t i = 0; i < mBuffers.size(); i++) {
- dprintf(fd, "Buffer %" PRIu32 "/%" PRIu32 ": %p\n", i, mBuffers.size(),
- mBuffers[i]);
+ dprintf(fd, "Buffer %zu/%zu: %p\n", i, mBuffers.size(), mBuffers[i]);
}
}
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index d0aaded..9d53fc6 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -313,7 +313,7 @@
return setTemplate(CAMERA3_TEMPLATE_MANUAL, m.get());
}
-bool UsbCamera::isValidCaptureSettings(const camera_metadata_t* settings) {
+bool UsbCamera::isValidCaptureSettings(const camera_metadata_t* /*settings*/) {
// TODO: reject settings that cannot be captured
return true;
}