diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-01-16 08:45:37 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-01-16 08:45:37 -0800 |
commit | e7cc00f1f390f2516b077fd1286e798351094fc9 (patch) | |
tree | 2233ee0ce660f052732fcf9ede2149f5a4a5609a | |
parent | 5737e77061a36b004d815aaff9cb0fff914e1e47 (diff) |
Fix some clang warnings about implicit integer size/sign conversions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xfindproxy.c | 5 | ||||
-rw-r--r-- | xfindproxy.h | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/xfindproxy.c b/xfindproxy.c index bb144c2..d2ea0e8 100644 --- a/xfindproxy.c +++ b/xfindproxy.c @@ -126,7 +126,8 @@ main(int argc, char *argv[]) char *release = NULL; pmGetProxyAddrMsg *pMsg; char *pData; - int len, i; + int i; + size_t len; IceReplyWaitInfo replyWait; GetProxyAddrReply reply; int majorVersion, minorVersion; @@ -291,7 +292,7 @@ main(int argc, char *argv[]) SIZEOF (pmGetProxyAddrMsg), WORD64COUNT (len), pmGetProxyAddrMsg, pMsg, pData); - pMsg->authLen = authLen; + pMsg->authLen = (CARD16) authLen; STORE_STRING (pData, serviceName); STORE_STRING (pData, serverAddress); diff --git a/xfindproxy.h b/xfindproxy.h index 9eb84fd..b4fa797 100644 --- a/xfindproxy.h +++ b/xfindproxy.h @@ -31,7 +31,7 @@ from The Open Group. * Pad to a 64 bit boundary */ -#define PAD64(_bytes) ((8 - ((unsigned int) (_bytes) % 8)) % 8) +#define PAD64(_bytes) ((8 - ((size_t) (_bytes) % 8)) % 8) #define PADDED_BYTES64(_bytes) (_bytes + PAD64 (_bytes)) @@ -40,16 +40,16 @@ from The Open Group. * Number of 8 byte units in _bytes. */ -#define WORD64COUNT(_bytes) (((unsigned int) ((_bytes) + 7)) >> 3) +#define WORD64COUNT(_bytes) (((size_t) ((_bytes) + 7)) >> 3) /* * Compute the number of bytes for a STRING representation */ -static inline int +static inline size_t STRING_BYTES(const char *string) { - int len = string ? strlen (string) : 0; + size_t len = string ? strlen (string) : 0; return (2 + len + PAD64 (2 + len)); } @@ -76,8 +76,8 @@ STRING_BYTES(const char *string) { static inline char * store_string(char *pBuf, const char *string) { - int len = string ? strlen (string) : 0; - STORE_CARD16 (pBuf, len); + size_t len = string ? strlen (string) : 0; + STORE_CARD16 (pBuf, (CARD16) len); if (len) { memcpy (pBuf, string, len); pBuf += len; |