diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-03-17 17:19:45 -0400 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-04-06 10:31:25 -0700 |
commit | cf9e8c73c4ffa671d580938c9a84d6ef0bd2710d (patch) | |
tree | 21cd4cab8b92df9f9050ea8df40d9cc35bed451d /src/Callback.c | |
parent | fb7e899e94dd402c868e8eb59ccf32284732f6ac (diff) |
This cleans up the "easy" warning fixes which can be made using my
Regress script, comparing object-files before/after the edits:
https://invisible-island.net/ansification/index.html
https://invisible-island.net/scripts/readme.html
The changes are casts, which quiet the gcc warnings about implicit
conversion that my "gcc-normal" script would show. I avoided
reformatting the code.
The change reduces the number of gcc warnings from 769 to 163.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/Callback.c')
-rw-r--r-- | src/Callback.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/Callback.c b/src/Callback.c index 7413da0..5064a6e 100644 --- a/src/Callback.c +++ b/src/Callback.c @@ -122,17 +122,17 @@ void _XtAddCallback( if (icl && icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; icl = (InternalCallbackList) - __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (count + 1)); + __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (count + 1))); (void) memmove((char *)ToList(icl), (char *)ToList(*callbacks), sizeof(XtCallbackRec) * count); } else { icl = (InternalCallbackList) - XtRealloc((char *) icl, sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (count + 1)); + XtRealloc((char *) icl, (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (count + 1))); } *callbacks = icl; - icl->count = count + 1; + icl->count = (unsigned short) (count + 1); icl->is_padded = 0; icl->call_state = 0; cl = ToList(icl) + count; @@ -208,17 +208,17 @@ static void AddCallbacks( for (j=0, cl = newcallbacks; cl->callback; cl++, j++); if (icl && icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; - icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+j)); + icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+j))); (void) memmove((char *)ToList(*callbacks), (char *)ToList(icl), - sizeof(XtCallbackRec) * i); + sizeof(XtCallbackRec) * (size_t) i); } else { icl = (InternalCallbackList) XtRealloc((char *) icl, - sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+j)); + (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+j))); } *callbacks = icl; - icl->count = i+j; + icl->count = (unsigned short) (i+j); icl->is_padded = 0; icl->call_state = 0; for (cl = ToList(icl) + i; --j >= 0; ) @@ -283,9 +283,9 @@ void _XtRemoveCallback ( j = icl->count - i - 1; ocl = ToList(icl); icl = (InternalCallbackList) - __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i + j)); - icl->count = i + j; + __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i + j))); + icl->count = (unsigned short) (i + j); icl->is_padded = 0; icl->call_state = 0; ncl = ToList(icl); @@ -301,8 +301,8 @@ void _XtRemoveCallback ( while (--i >= 0) *cl++ = *ncl++; icl = (InternalCallbackList) - XtRealloc((char *) icl, sizeof(InternalCallbackRec) - + sizeof(XtCallbackRec) * icl->count); + XtRealloc((char *) icl, (Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * icl->count)); icl->is_padded = 0; *callbacks = icl; } else { @@ -385,9 +385,9 @@ void XtRemoveCallbacks ( cl = ToList(icl); if (icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; - icl = (InternalCallbackList)__XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * i); - icl->count = i; + icl = (InternalCallbackList)__XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) i)); + icl->count = (unsigned short) i; icl->call_state = 0; } ccl = ToList(icl); @@ -404,7 +404,7 @@ void XtRemoveCallbacks ( } if (icl->count) { icl = (InternalCallbackList) - XtRealloc((char *)icl, (sizeof(InternalCallbackRec) + + XtRealloc((char *)icl, (Cardinal) (sizeof(InternalCallbackRec) + sizeof(XtCallbackRec) * icl->count)); icl->is_padded = 0; *callbacks = icl; @@ -484,9 +484,9 @@ InternalCallbackList _XtCompileCallbackList( for (n=0, xtcl=xtcallbacks; xtcl->callback; n++, xtcl++) {}; if (n == 0) return (InternalCallbackList) NULL; - callbacks = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * n); - callbacks->count = n; + callbacks = (InternalCallbackList) __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) n)); + callbacks->count = (unsigned short) n; callbacks->is_padded = 0; callbacks->call_state = 0; cl = ToList(callbacks); @@ -514,17 +514,17 @@ XtCallbackList _XtGetCallbackList( if (icl->call_state) { icl->call_state |= _XtCBFreeAfterCalling; ocl = ToList(icl); - icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+1)); - icl->count = i; + icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t) (i+1))); + icl->count = (unsigned short) i; icl->call_state = 0; cl = ToList(icl); while (--i >= 0) *cl++ = *ocl++; } else { icl = (InternalCallbackList) XtRealloc((char *)icl, - sizeof(InternalCallbackRec) + - sizeof(XtCallbackRec) * (i+1)); + (Cardinal)(sizeof(InternalCallbackRec) + + sizeof(XtCallbackRec) * (size_t)(i+1))); cl = ToList(icl) + i; } icl->is_padded = 1; |