diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-08-09 17:24:16 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-08-09 17:24:16 -0700 |
commit | 95cb4dcd618774b3f7b5b915c5ce5aa72f853b53 (patch) | |
tree | 5855871af9beca9549fe978bac71434e53f3828f | |
parent | 5a06ff257f72a629539f23b35026fbcdb8bb372e (diff) |
Fix some clang warnings about integer size/sign conversions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/SMlibint.h | 4 | ||||
-rw-r--r-- | src/sm_client.c | 6 | ||||
-rw-r--r-- | src/sm_error.c | 8 | ||||
-rw-r--r-- | src/sm_genid.c | 8 | ||||
-rw-r--r-- | src/sm_manager.c | 4 | ||||
-rw-r--r-- | src/sm_process.c | 2 |
6 files changed, 16 insertions, 16 deletions
diff --git a/src/SMlibint.h b/src/SMlibint.h index 52c72e7..7946920 100644 --- a/src/SMlibint.h +++ b/src/SMlibint.h @@ -157,7 +157,7 @@ in this Software without prior written authorization from The Open Group. #define STORE_ARRAY8(_pBuf, _len, _array8) \ { \ - STORE_CARD32 (_pBuf, _len); \ + STORE_CARD32 (_pBuf, (CARD32) _len); \ if (_len) \ memcpy (_pBuf, _array8, _len); \ _pBuf += _len + PAD64 (4 + _len); \ @@ -240,7 +240,7 @@ in this Software without prior written authorization from The Open Group. #define SKIP_LISTOF_PROPERTY(_pBuf, _swap) \ { \ - int _i, _j; \ + CARD32 _i, _j; \ CARD32 _count; \ EXTRACT_CARD32 (_pBuf, _swap, _count); \ _pBuf += 4; \ diff --git a/src/sm_client.c b/src/sm_client.c index ef1160b..7d00961 100644 --- a/src/sm_client.c +++ b/src/sm_client.c @@ -65,7 +65,7 @@ SmcOpenConnection(char *networkIdsList, SmPointer context, char *release = NULL; smRegisterClientMsg *pMsg; char *pData; - int extra, len; + unsigned int extra, len; IceReplyWaitInfo replyWait; _SmcRegisterClientReply reply; Bool gotReply, ioErrorOccured; @@ -296,7 +296,7 @@ SmcCloseConnection(SmcConn smcConn, int count, char **reasonMsgs) SIZEOF (smCloseConnectionMsg), WORD64COUNT (extra), smCloseConnectionMsg, pMsg, pData); - STORE_CARD32 (pData, count); + STORE_CARD32 (pData, (CARD32) count); pData += 4; for (i = 0; i < count; i++) @@ -360,7 +360,7 @@ SmcSetProperties(SmcConn smcConn, int numProps, SmProp **props) smSetPropertiesMsg *pMsg; char *pBuf; char *pStart; - int bytes; + unsigned int bytes; IceGetHeader (iceConn, _SmcOpcode, SM_SetProperties, SIZEOF (smSetPropertiesMsg), smSetPropertiesMsg, pMsg); diff --git a/src/sm_error.c b/src/sm_error.c index 29f6e45..5996600 100644 --- a/src/sm_error.c +++ b/src/sm_error.c @@ -119,7 +119,7 @@ _SmcDefaultErrorHandler(SmcConn smcConn, Bool swap, int offendingMinorOpcode, { case IceBadValue: { - int offset, length, val; + unsigned int offset, length, val; EXTRACT_CARD32 (pData, swap, offset); EXTRACT_CARD32 (pData, swap, length); @@ -132,7 +132,7 @@ _SmcDefaultErrorHandler(SmcConn smcConn, Bool swap, int offendingMinorOpcode, if (length <= 4) { if (length == 1) - val = (int) *pData; + val = (unsigned int) *pData; else if (length == 2) { EXTRACT_CARD16 (pData, swap, val); @@ -233,7 +233,7 @@ _SmsDefaultErrorHandler(SmsConn smsConn, Bool swap, int offendingMinorOpcode, { case IceBadValue: { - int offset, length, val; + unsigned int offset, length, val; EXTRACT_CARD32 (pData, swap, offset); EXTRACT_CARD32 (pData, swap, length); @@ -246,7 +246,7 @@ _SmsDefaultErrorHandler(SmsConn smsConn, Bool swap, int offendingMinorOpcode, if (length <= 4) { if (length == 1) - val = (int) *pData; + val = (unsigned int) *pData; else if (length == 2) { EXTRACT_CARD16 (pData, swap, val); diff --git a/src/sm_genid.c b/src/sm_genid.c index ef7acae..bcd10a6 100644 --- a/src/sm_genid.c +++ b/src/sm_genid.c @@ -149,7 +149,7 @@ SmsGenerateClientID(SmsConn smsConn) char* inet_addr; char *ptr1; unsigned char decimal[4]; - int i, len; + int i; struct in_addr *haddr = NULL; # if defined(IPv6) && defined(AF_INET6) struct addrinfo *ai, *first_ai; @@ -202,8 +202,8 @@ SmsGenerateClientID(SmsConn smsConn) { char temp4[4]; char *ptr2 = strchr (ptr1, '.'); + size_t len = (size_t) (ptr2 - ptr1); - len = ptr2 - ptr1; if (!ptr2 || len > 3) { # if defined(IPv6) && defined(AF_INET6) freeaddrinfo(first_ai); @@ -212,11 +212,11 @@ SmsGenerateClientID(SmsConn smsConn) } strncpy (temp4, ptr1, len); temp4[len] = '\0'; - decimal[i] = atoi (temp4); + decimal[i] = (unsigned char) atoi (temp4); ptr1 = ptr2 + 1; } - decimal[3] = atoi (ptr1); + decimal[3] = (unsigned char) atoi (ptr1); *addr_ptr++ = '1'; diff --git a/src/sm_manager.c b/src/sm_manager.c index 7a11a33..7d0e583 100644 --- a/src/sm_manager.c +++ b/src/sm_manager.c @@ -183,7 +183,7 @@ Status SmsRegisterClientReply(SmsConn smsConn, char *clientId) { IceConn iceConn = smsConn->iceConn; - int extra; + size_t extra; smRegisterClientReplyMsg *pMsg; char *pData; @@ -307,7 +307,7 @@ void SmsReturnProperties(SmsConn smsConn, int numProps, SmProp **props) { IceConn iceConn = smsConn->iceConn; - int bytes; + unsigned int bytes; smPropertiesReplyMsg *pMsg; char *pBuf; char *pStart; diff --git a/src/sm_process.c b/src/sm_process.c index 651ddef..95883b9 100644 --- a/src/sm_process.c +++ b/src/sm_process.c @@ -54,7 +54,7 @@ in this Software without prior written authorization from The Open Group. } #define CHECK_COMPLETE_SIZE(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _pStart, _severity) \ - if (((PADDED_BYTES64((_actual_len)) - SIZEOF (iceMsg)) >> 3) \ + if (((unsigned long)(PADDED_BYTES64((_actual_len)) - SIZEOF (iceMsg)) >> 3) \ != _expected_len) \ { \ _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \ |