gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 09/219: tool_cb_wrt: fix bad-function-cast warning


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 09/219: tool_cb_wrt: fix bad-function-cast warning
Date: Wed, 22 May 2019 19:15:48 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit d110d96b981fb0d0df54ded3f7fc876be891e2e3
Author: Marcel Raad <address@hidden>
AuthorDate: Mon Apr 1 18:40:01 2019 +0200

    tool_cb_wrt: fix bad-function-cast warning
    
    Commit f5bc578f4cdfdc6c708211dfc2962a0e9d79352d reintroduced the
    warning fixed in commit 2f5f31bb57d68b54e03bffcd9648aece1fe564f8.
    Extend fhnd's scope and reuse that variable instead of calling
    _get_osfhandle a second time to fix the warning again.
    
    Closes https://github.com/curl/curl/pull/3718
---
 src/tool_cb_wrt.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c
index 1944f16c2..f403ab34c 100644
--- a/src/tool_cb_wrt.c
+++ b/src/tool_cb_wrt.c
@@ -81,6 +81,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, 
void *userdata)
   bool is_tty = config->global->isatty;
 #ifdef WIN32
   CONSOLE_SCREEN_BUFFER_INFO console_info;
+  intptr_t fhnd;
 #endif
 
   /*
@@ -159,13 +160,12 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t 
nmemb, void *userdata)
   }
 
 #ifdef _WIN32
+  fhnd = _get_osfhandle(fileno(outs->stream));
   if(isatty(fileno(outs->stream)) &&
-     GetConsoleScreenBufferInfo(
-       (HANDLE)_get_osfhandle(fileno(outs->stream)), &console_info)) {
+     GetConsoleScreenBufferInfo((HANDLE)fhnd, &console_info)) {
     DWORD in_len = (DWORD)(sz * nmemb);
     wchar_t* wc_buf;
     DWORD wc_len;
-    intptr_t fhnd;
 
     /* calculate buffer size for wide characters */
     wc_len = MultiByteToWideChar(CP_UTF8, 0, buffer, in_len,  NULL, 0);
@@ -180,8 +180,6 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, 
void *userdata)
       return failure;
     }
 
-    fhnd = _get_osfhandle(fileno(outs->stream));
-
     if(!WriteConsoleW(
         (HANDLE) fhnd,
         wc_buf,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]