[PATCH:xfs 1/7] MakeAtom: get rid of unnecessary casts
Alan Coopersmith
alan.coopersmith at oracle.com
Sat Jan 19 23:03:49 PST 2013
strncmp & strncpy expect an unsigned (size_t) argument, so don't take our
unsigned len and cast it back to a signed int, because that makes clang sad:
difs/atom.c:92:44: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
comp = strncmp(string, (*np)->string, (int) len);
~~~~~~~ ^~~~~~~~~
difs/atom.c:118:34: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
strncpy(nd->string, string, (int) len);
~~~~~~~ ^~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
difs/atom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/difs/atom.c b/difs/atom.c
index 17ed085..00e05a5 100644
--- a/difs/atom.c
+++ b/difs/atom.c
@@ -89,7 +89,7 @@ MakeAtom(const char *string, unsigned int len, Bool makeit)
else if (fp > (*np)->fingerPrint)
np = &((*np)->right);
else { /* now start testing the strings */
- comp = strncmp(string, (*np)->string, (int) len);
+ comp = strncmp(string, (*np)->string, len);
if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
np = &((*np)->left);
else if (comp > 0)
@@ -115,7 +115,7 @@ MakeAtom(const char *string, unsigned int len, Bool makeit)
fsfree(nd);
return BAD_RESOURCE;
}
- strncpy(nd->string, string, (int) len);
+ strncpy(nd->string, string, len);
nd->string[len] = 0;
}
if ((lastAtom + 1) >= tableLength) {
--
1.7.9.2
More information about the xorg-devel
mailing list