aboutsummaryrefslogtreecommitdiff
path: root/lib/strequal.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-15 16:18:52 +0000
committerYang Tse <yangsita@gmail.com>2010-02-15 16:18:52 +0000
commit4b43d18c4a733b1c47ccab481502a7d84fd07691 (patch)
tree7ff142992e81f61de113eaaff329bcbc5ebea1b6 /lib/strequal.c
parent2596fe0cb779e64599d8b11f27419a2caecd804a (diff)
fix compiler warning: conversion from "long" to "size_t" may lose sign
Diffstat (limited to 'lib/strequal.c')
-rw-r--r--lib/strequal.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/strequal.c b/lib/strequal.c
index e8c667497..803064887 100644
--- a/lib/strequal.c
+++ b/lib/strequal.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, 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
@@ -95,16 +95,19 @@ size_t Curl_strlcat(char *dst, const char *src, size_t siz)
char *d = dst;
const char *s = src;
size_t n = siz;
- size_t dlen;
+ union {
+ ssize_t sig;
+ size_t uns;
+ } dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while(n-- != 0 && *d != '\0')
d++;
- dlen = d - dst;
- n = siz - dlen;
+ dlen.sig = d - dst;
+ n = siz - dlen.uns;
if(n == 0)
- return(dlen + strlen(s));
+ return(dlen.uns + strlen(s));
while(*s != '\0') {
if(n != 1) {
*d++ = *s;
@@ -114,6 +117,6 @@ size_t Curl_strlcat(char *dst, const char *src, size_t siz)
}
*d = '\0';
- return(dlen + (s - src)); /* count does not include NUL */
+ return(dlen.uns + (s - src)); /* count does not include NUL */
}
#endif