Remove redundant test in if-statement

While compiling the BOINC client on Linux using gcc I stumbled over another warning:

<code>http_curl.cpp: In member function ‘int HTTP_OP::libcurl_exec(const char*, const char*, const char*, double, double, bool)’:
http_curl.cpp:605:13: warning: the address of ‘HTTP_OP::infile’ will never be NULL [-Waddress]
  605 |         if (infile && strlen(infile)>0) {
      |             ^~~~~~
In file included from gui_http.h:53,
                 from cs_notice.h:58,
                 from client_types.h:45,
                 from client_msgs.h:26,
                 from http_curl.cpp:44:
http_curl.h:86:10: note: ‘HTTP_OP::infile’ declared here
   86 |     char infile[256];
      |          ^~~~~~</code>

      
Wouldn't it be enough to just test:
<code>if (strlen(infile)>0) {</code>
This commit is contained in:
computezrmle 2022-07-29 14:04:04 +02:00 committed by GitHub
parent 856707951c
commit 344de7fca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -602,7 +602,7 @@ int HTTP_OP::libcurl_exec(
if (is_post) {
want_upload = true;
want_download = false;
if (infile && strlen(infile)>0) {
if (strlen(infile)>0) {
fileIn = boinc_fopen(infile, "rb");
if (!fileIn) {
msg_printf(NULL, MSG_INTERNAL_ERROR, "No HTTP input file %s", infile);