two windows telnet.c compiler warnings #1225

Closed
bagder opened this Issue Jan 23, 2017 · 2 comments

Projects

None yet

2 participants

@bagder
Member
bagder commented Jan 23, 2017

I did this

I looked at this windows build log showing these two compiler warnings

.\telnet.c(1455) : warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data
.\telnet.c(1474) : warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data

I expected the following

No warnings

curl/libcurl version

7.52.1 and current 7.53.0-dev in git master

operating system

Winsock

Suggested patch

curl-fix-telnet-warnings.patch, also inlined here:

--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -3,11 +3,11 @@
  *  Project                     ___| | | |  _ \| |
  *                             / __| | | | |_) | |
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
  * are also available at https://curl.haxx.se/docs/copyright.html.
  *
@@ -1414,11 +1414,11 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
     wait_timeout = 1000;
   }
 
   /* Keep on listening and act on events */
   while(keepon) {
-    const size_t buf_size = CURL_BUFSIZE(data->set.buffer_size);
+    const DWORD buf_size = (DWORD)CURL_BUFSIZE(data->set.buffer_size);
     waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout);
     switch(waitret) {
     case WAIT_TIMEOUT:
     {
       for(;;) {

@bagder bagder added the build label Jan 23, 2017
@jay
Member
jay commented Jan 24, 2017

👍

@bagder bagder added a commit that closed this issue Jan 24, 2017
@bagder bagder telnet: fix windows compiler warnings
Thumbs-up-by: Jay Satiro

Closes #1225
d8a3aa7
@bagder bagder closed this in d8a3aa7 Jan 24, 2017
@bagder
Member
bagder commented Jan 24, 2017

thanks!

@peterpih peterpih pushed a commit to railsnewbie257/curl that referenced this issue Jan 24, 2017
@bagder @railsnewbie257 bagder + railsnewbie257 telnet: fix windows compiler warnings
Thumbs-up-by: Jay Satiro

Closes #1225
0c16ad5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment