summaryrefslogtreecommitdiff
path: root/lib/warnless.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-03-20 18:28:24 +0100
committerYang Tse <yangsita@gmail.com>2012-03-20 18:28:24 +0100
commitc6825b7a6b5e8798bc861b3d280430e8149e7298 (patch)
tree7647999b7351ab4330f2218622fcfbc1469cb975 /lib/warnless.c
parente6a89cb6c4f0ed51a41425cf78a56394f397c5e5 (diff)
downloadcurl-c6825b7a6b5e8798bc861b3d280430e8149e7298.tar.gz
fix several compiler warnings
Diffstat (limited to 'lib/warnless.c')
-rw-r--r--lib/warnless.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/warnless.c b/lib/warnless.c
index 5fbc23400..6b77eea22 100644
--- a/lib/warnless.c
+++ b/lib/warnless.c
@@ -185,6 +185,7 @@ unsigned long curlx_uztoul(size_t uznum)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
+ DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG);
return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG);
#ifdef __INTEL_COMPILER
@@ -193,6 +194,25 @@ unsigned long curlx_uztoul(size_t uznum)
}
/*
+** unsigned size_t to unsigned int
+*/
+
+unsigned int curlx_uztoui(size_t uznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT);
+ return (unsigned int)(uznum & (size_t) CURL_MASK_UINT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
+/*
** signed long to signed int
*/