From dd3e028d2a1bc5daf87865ca1e5e923000186af8 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 16 Jun 2021 14:33:31 +0100 Subject: Cast via intptr_t when converting integers to pointers I found these by compiling libXt with the CHERI Clang compiler, as it warns about conversions from integer to pointer that do not use intptr_t. Signed-off-by: Alex Richardson --- src/Convert.c | 4 ++-- src/Create.c | 4 ++-- src/Manage.c | 2 +- src/Object.c | 2 +- src/Popup.c | 2 +- src/Resources.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Convert.c b/src/Convert.c index 9b2d465..440d624 100644 --- a/src/Convert.c +++ b/src/Convert.c @@ -608,8 +608,8 @@ ComputeArgs(Widget widget, /* Convert in place for next usage */ convert_args[i].address_mode = XtResourceQuark; convert_args[i].address_id = - (XtPointer) (long) XrmStringToQuark((String) convert_args[i]. - address_id); + (XtPointer) (XtIntPtr) XrmStringToQuark((String) convert_args[i]. + address_id); /* Fall through */ case XtResourceQuark: diff --git a/src/Create.c b/src/Create.c index 27df827..8131f42 100644 --- a/src/Create.c +++ b/src/Create.c @@ -145,8 +145,8 @@ XtInitializeWidgetClass(WidgetClass wc) Cardinal num_params; param[0] = wc->core_class.class_name; - param[1] = (String) wc->core_class.version; - param[2] = (String) XtVersion; + param[1] = (String) (XtIntPtr) wc->core_class.version; + param[2] = (String) (XtIntPtr) XtVersion; if (wc->core_class.version == (11 * 1000 + 5) || /* MIT X11R5 */ wc->core_class.version == (11 * 1000 + 4)) { /* MIT X11R4 */ diff --git a/src/Manage.c b/src/Manage.c index 77f3d9f..b1ca9c8 100644 --- a/src/Manage.c +++ b/src/Manage.c @@ -396,7 +396,7 @@ XtSetMappedWhenManaged(Widget widget, _XtBoolean mapped_when_managed) call_data.type = XtHsetMappedWhenManaged; call_data.widget = widget; - call_data.event_data = (XtPointer) (unsigned long) mapped_when_managed; + call_data.event_data = (XtPointer) (XtUIntPtr) mapped_when_managed; XtCallCallbackList(hookobj, ((HookObject) hookobj)->hooks.changehook_callbacks, (XtPointer) &call_data); diff --git a/src/Object.c b/src/Object.c index 843ff7d..178bcb5 100644 --- a/src/Object.c +++ b/src/Object.c @@ -180,7 +180,7 @@ ConstructCallbackOffsets(WidgetClass myWidgetClass) __XtMalloc((Cardinal) (sizeof(XrmResource *) * (size_t) (tableSize + 1))); - newTable[0] = (XrmResource *) (long) tableSize; + newTable[0] = (XrmResource *) (XtIntPtr) tableSize; if (superTable) tableSize -= (int) (long) superTable[0]; diff --git a/src/Popup.c b/src/Popup.c index 30b6ca6..f904486 100644 --- a/src/Popup.c +++ b/src/Popup.c @@ -114,7 +114,7 @@ XtPopup(Widget widget, XtGrabKind grab_kind) call_data.type = XtHpopup; call_data.widget = widget; - call_data.event_data = (XtPointer) grab_kind; + call_data.event_data = (XtPointer) (XtIntPtr) grab_kind; XtCallCallbackList(hookobj, ((HookObject) hookobj)->hooks.changehook_callbacks, (XtPointer) &call_data); diff --git a/src/Resources.c b/src/Resources.c index 4512517..932ba7d 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -336,7 +336,7 @@ BadSize(Cardinal size, XrmQuark name) String params[2]; Cardinal num_params = 2; - params[0] = (String) (long) size; + params[0] = (String) (XtIntPtr) size; params[1] = XrmQuarkToString(name); XtWarningMsg("invalidSizeOverride", "xtDependencies", XtCXtToolkitError, "Representation size %d must match superclass's to override %s", -- cgit v1.2.3