mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 00:25:07 +03:00
hal: Fix comparison of unsigned integer < 0
The CameraHalManager::getCameraInfo() validates the camera id it receives from the camera service, and in doing so generates a compiler error with gcc as the id is an unsigned integer and can never be negative: ../src/android/camera_hal_manager.cpp: In member function ‘CameraProxy* CameraHalManager::open(unsigned int, const hw_module_t*)’: ../src/android/camera_hal_manager.cpp:89:9: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] if (id < 0 || id >= numCameras()) { Fix it by removing the unneeded comparison. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
0268984c0d
commit
a8b472598e
1 changed files with 1 additions and 1 deletions
|
@ -86,7 +86,7 @@ void CameraHalManager::run()
|
||||||
CameraProxy *CameraHalManager::open(unsigned int id,
|
CameraProxy *CameraHalManager::open(unsigned int id,
|
||||||
const hw_module_t *hardwareModule)
|
const hw_module_t *hardwareModule)
|
||||||
{
|
{
|
||||||
if (id < 0 || id >= numCameras()) {
|
if (id >= numCameras()) {
|
||||||
LOG(HAL, Error) << "Invalid camera id '" << id << "'";
|
LOG(HAL, Error) << "Invalid camera id '" << id << "'";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue