From 125f38c753284ee15f6258782b41fcaffa41f42c Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Thu, 6 Sep 2018 09:04:07 -0700 Subject: Fix invalid logical constant creation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code incorrectly uses || to combine a bunch of state constants. The next Clang warns on this buggy pattern. hardware/qcom/media/msm8996/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp:1130:40: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] if (eState == (OMX_StateLoaded || OMX_StateWaitForResources ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ hardware/qcom/media/msm8996/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp:1130:40: note: use '|' for a bitwise operation if (eState == (OMX_StateLoaded || OMX_StateWaitForResources ^~ | Bug: http://b/110779387 Test: ./test_compiler.py --build-only --target aosp_sailfish-eng --no-clean-built-target ../../ --clang-path ../../prebuilts/clang/host/linux-x86/llvm-toolchain-dev/ Change-Id: I7332508f0f9827c7968a4680fe42eedffb3714e7 Signed-off-by: D. Andrei Măceș --- mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp | 8 ++++---- mm-video-v4l2/vidc/venc/src/omx_video_base.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp index 04e964f7..845e722d 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -3228,10 +3228,10 @@ OMX_ERRORTYPE omx_vdec::send_command_proxy(OMX_IN OMX_HANDLETYPE hComp, /* Current State is Invalid */ /*******************************/ else if (m_state == OMX_StateInvalid) { - /* State Transition from Inavlid to any state */ - if (eState == (OMX_StateLoaded || OMX_StateWaitForResources - || OMX_StateIdle || OMX_StateExecuting - || OMX_StatePause || OMX_StateInvalid)) { + /* State Transition from Invalid to any state */ + if (eState == OMX_StateLoaded || eState == OMX_StateWaitForResources || + eState == OMX_StateIdle || eState == OMX_StateExecuting || + eState == OMX_StatePause || eState == OMX_StateInvalid) { DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Invalid -->Loaded"); post_event(OMX_EventError,OMX_ErrorInvalidState,\ OMX_COMPONENT_GENERATE_EVENT); diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp index f9f96593..7893a5fd 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -1138,10 +1138,10 @@ OMX_ERRORTYPE omx_video::send_command_proxy(OMX_IN OMX_HANDLETYPE hComp, /* Current State is Invalid */ /*******************************/ else if (m_state == OMX_StateInvalid) { - /* State Transition from Inavlid to any state */ - if (eState == (OMX_StateLoaded || OMX_StateWaitForResources - || OMX_StateIdle || OMX_StateExecuting - || OMX_StatePause || OMX_StateInvalid)) { + /* State Transition from Invalid to any state */ + if (eState == OMX_StateLoaded || eState == OMX_StateWaitForResources || + eState == OMX_StateIdle || eState == OMX_StateExecuting || + eState == OMX_StatePause || eState == OMX_StateInvalid) { DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Invalid -->Loaded"); post_event(OMX_EventError,OMX_ErrorInvalidState,\ OMX_COMPONENT_GENERATE_EVENT); -- cgit v1.2.3