Fix uninitialized local variable in curl code

Compiler warning:

    src/api/baseapi.cpp:1151:27: warning:
      variable 'curlcode' is uninitialized when used here [-Wuninitialized]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Browse Source
Stefan Weil 1 year ago
parent
commit
9f5a3f6ac7
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      src/api/baseapi.cpp

+ 1
- 2
src/api/baseapi.cpp

@@ -1147,14 +1147,13 @@ bool TessBaseAPI::ProcessPagesInternal(const char* filename,
       fprintf(stderr, "Error, curl_easy_init failed\n");
       return false;
     } else {
-      CURLcode curlcode;
+      CURLcode curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
       auto error = [curl, curlcode](const char* function) {
         fprintf(stderr, "Error, %s failed with error %s\n", function,
                 curl_easy_strerror(curlcode));
         curl_easy_cleanup(curl);
         return false;
       };
-      curlcode = curl_easy_setopt(curl, CURLOPT_URL, filename);
       if (curlcode != CURLE_OK) {
         return error("curl_easy_setopt");
       }