diff mbox

[07/10] mountd: Avoid unnecessary type conversions

Message ID 20121022160644.4552.477.stgit@lebasque.1015granger.net (mailing list archive)
State New, archived
Headers show

Commit Message

Chuck Lever Oct. 22, 2012, 4:06 p.m. UTC
Clean up compiler warnings:

cache.c: In function ‘get_uuid’:
cache.c:256:17: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:258:17: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:260:16: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]
cache.c:262:6: warning: conversion to ‘char’ from ‘int’ may
  alter its value [-Wconversion]

Seen with gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mountd/cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index fbaa28e..e950ec6 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -248,7 +248,7 @@  static int get_uuid(const char *val, size_t uuidlen, char *u)
 	
 	memset(u, 0, uuidlen);
 	for ( ; *val ; val++) {
-		char c = *val;
+		int c = *val;
 		if (!isxdigit(c))
 			continue;
 		if (isalpha(c)) {
@@ -260,7 +260,7 @@  static int get_uuid(const char *val, size_t uuidlen, char *u)
 			c = c - '0' + 0;
 		if ((i&1) == 0)
 			c <<= 4;
-		u[i/2] ^= c;
+		u[i/2] ^= (char)c;
 		i++;
 		if (i == uuidlen*2)
 			i = 0;