hal: Fix comparison of integers of different signs
The CameraHalManager::getCameraInfo() validates the camera id it
receives from the camera service, and in doing so compares it with an
unsigned integer, generating a compiler error:
src/android/camera_hal_manager.cpp:121:9: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
if (id >= numCameras() || id < 0) {
~~ ^ ~~~~~~~~~~~~
Fix this by turning the id into an unsigned int, as camera ids can't be
negative. If a negative id is received from the camera service it will
be converted to a large unsigned integer that will fail the comparison
with numCameras().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -30,7 +30,7 @@ public:
|
||||
int close(CameraProxy *proxy);
|
||||
|
||||
unsigned int numCameras() const;
|
||||
int getCameraInfo(int id, struct camera_info *info);
|
||||
int getCameraInfo(unsigned int id, struct camera_info *info);
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
|
||||
Reference in New Issue
Block a user