Code clean for libcameraservice
Cleaning compile warnings "variable 'XX' set but not used":
1. Remove the variables which are obviously not used;
2. Add "[[maybe_unused]]" to variable declaration of the ones
which are potentially used.
For the unused function parameters which were cast by "(void)":
We have changed them to the C++17 attribute "[[maybe_unused]]".
This seems not that necessary but it avoids redundant code lines.
Test: mmm frameworks/av/services/camera/libcameraservice,
presubmit check.
Change-Id: Ia68b78c01f8254d76be81b1ce98d2a5c3d7eea46
Signed-off-by: Jing Mike <jingyangliu@eswincomputing.com>
diff --git a/services/camera/libcameraservice/device3/Camera3InputStream.cpp b/services/camera/libcameraservice/device3/Camera3InputStream.cpp
index 9a3f7ed..631bb43 100644
--- a/services/camera/libcameraservice/device3/Camera3InputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3InputStream.cpp
@@ -104,17 +104,14 @@
status_t Camera3InputStream::returnBufferCheckedLocked(
const camera_stream_buffer &buffer,
- nsecs_t timestamp,
- nsecs_t readoutTimestamp,
- bool output,
+ [[maybe_unused]] nsecs_t timestamp,
+ [[maybe_unused]] nsecs_t readoutTimestamp,
+ [[maybe_unused]] bool output,
int32_t /*transform*/,
const std::vector<size_t>&,
/*out*/
sp<Fence> *releaseFenceOut) {
- (void)timestamp;
- (void)readoutTimestamp;
- (void)output;
ALOG_ASSERT(!output, "Expected output to be false");
status_t res;
@@ -218,8 +215,7 @@
return OK;
}
-void Camera3InputStream::dump(int fd, const Vector<String16> &args) const {
- (void) args;
+void Camera3InputStream::dump(int fd, [[maybe_unused]] const Vector<String16> &args) const {
String8 lines;
lines.appendFormat(" Stream[%d]: Input\n", mId);
write(fd, lines.string(), lines.size());