From f2e6d2ecfea635ab952649156e31ca893d4b1a47 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 12 Aug 2017 08:49:20 -0700 Subject: [PATCH] Fix build with clang Fix errors e.g. error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare] and psnr.cpp:225:17: error: bool literal returned from 'main' [-Werror,-Wmain] Signed-off-by: Khem Raj Upstream-Status: Pending --- tests/decodehelp.cpp | 2 +- tests/encodehelp.h | 2 +- tests/vpp.cpp | 2 +- tests/yamitranscode.cpp | 2 +- testscripts/psnr.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/decodehelp.cpp b/tests/decodehelp.cpp index b27b977..62cca63 100644 --- a/tests/decodehelp.cpp +++ b/tests/decodehelp.cpp @@ -81,7 +81,7 @@ bool processCmdLine(int argc, char** argv, DecodeParameter* parameters) { NULL, no_argument, NULL, 0 } }; - char opt; + int opt; while ((opt = getopt_long_only(argc, argv, "h:m:n:i:f:o:w:?", long_opts,&option_index)) != -1){ switch (opt) { case 'h': diff --git a/tests/encodehelp.h b/tests/encodehelp.h index 63580a4..651ec08 100644 --- a/tests/encodehelp.h +++ b/tests/encodehelp.h @@ -109,7 +109,7 @@ static VideoRateControl string_to_rc_mode(char *str) static bool process_cmdline(int argc, char *argv[]) { - char opt; + int opt; const struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, { "qp", required_argument, NULL, 0 }, diff --git a/tests/vpp.cpp b/tests/vpp.cpp index 5a60c0a..52da43b 100644 --- a/tests/vpp.cpp +++ b/tests/vpp.cpp @@ -151,7 +151,7 @@ public: private: bool processCmdLine(int argc, char* argv[]) { - char opt; + int opt; const struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, { "sharpening", required_argument, NULL, 's' }, diff --git a/tests/yamitranscode.cpp b/tests/yamitranscode.cpp index 6207209..00164ce 100755 --- a/tests/yamitranscode.cpp +++ b/tests/yamitranscode.cpp @@ -100,7 +100,7 @@ static VideoRateControl string_to_rc_mode(char *str) static bool processCmdLine(int argc, char *argv[], TranscodeParams& para) { - char opt; + int opt; const struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, { "qp", required_argument, NULL, 0 }, diff --git a/testscripts/psnr.cpp b/testscripts/psnr.cpp index 5cc24c9..68bd668 100644 --- a/testscripts/psnr.cpp +++ b/testscripts/psnr.cpp @@ -215,14 +215,14 @@ int main(int argc, char *argv[]) const char* psnrresult = "average_psnr.txt"; int width=0,height=0; int standardpsnr = NORMAL_PSNR; - char opt; + int opt; while ((opt = getopt(argc, argv, "h:W:H:i:o:s:?")) != -1) { switch (opt) { case 'h': case '?': print_help(argv[0]); - return false; + return -1; case 'i': filename1 = optarg; break;