]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_negotiate_sspi.c: fix compiler warning
authorYang Tse <yangsita@gmail.com>
Fri, 13 Jan 2012 12:34:43 +0000 (13:34 +0100)
committerYang Tse <yangsita@gmail.com>
Fri, 13 Jan 2012 12:34:43 +0000 (13:34 +0100)
lib/http_negotiate_sspi.c
lib/warnless.c
lib/warnless.h

index a63de7dc5feda4dec9e420e0310b786aee20ec05..f1ab33d6d438fef1e603bcc4a1067f0dfb5194f3 100644 (file)
@@ -29,6 +29,7 @@
 #include "urldata.h"
 #include "sendf.h"
 #include "rawstr.h"
+#include "warnless.h"
 #include "curl_base64.h"
 #include "http_negotiate.h"
 #include "curl_memory.h"
@@ -189,7 +190,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
   out_buff_desc.cBuffers  = 1;
   out_buff_desc.pBuffers  = &out_sec_buff;
 
-  out_sec_buff.cbBuffer   = neg_ctx->max_token_length;
+  out_sec_buff.cbBuffer   = curlx_uztoul(neg_ctx->max_token_length);
   out_sec_buff.BufferType = SECBUFFER_TOKEN;
   out_sec_buff.pvBuffer   = neg_ctx->output_token;
 
@@ -199,7 +200,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
     in_buff_desc.cBuffers  = 1;
     in_buff_desc.pBuffers  = &in_sec_buff;
 
-    in_sec_buff.cbBuffer   = input_token_len;
+    in_sec_buff.cbBuffer   = curlx_uztoul(input_token_len);
     in_sec_buff.BufferType = SECBUFFER_TOKEN;
     in_sec_buff.pvBuffer   = input_token;
   }
index 0f5fb5f4d17e36f077971e6aa1163a3295467070..acdcb26eaa9bbfb773b749ee74cce692cb748317 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 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
@@ -174,6 +174,24 @@ int curlx_uztosi(size_t uznum)
 #endif
 }
 
+/*
+** unsigned size_t to unsigned long
+*/
+
+unsigned long curlx_uztoul(size_t uznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+  return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
 /*
 ** signed long to signed int
 */
index 27cf57c31abb64b1a2aaed26ef1b145cdf2b548a..9ba650f20de344dea24fe2dfc99ba399e7020591 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 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
@@ -28,6 +28,8 @@ unsigned char curlx_ultouc(unsigned long ulnum);
 
 int curlx_uztosi(size_t uznum);
 
+unsigned long curlx_uztoul(size_t uznum);
+
 int curlx_sltosi(long slnum);
 
 unsigned int curlx_sltoui(long slnum);