1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtpdm: XtVaGetValues, XtPointer, XtArgVal, ...

Make XtVaGetValues return variables safe for 64-bit
This commit is contained in:
Marcin Cieslak 2012-09-24 18:11:36 +02:00 committed by Jon Trulson
parent 917f7da191
commit a8c2232e48
3 changed files with 39 additions and 26 deletions

View file

@ -275,6 +275,7 @@ PdmShellPresent(PdmShell* me)
{ {
int parent_abs_x, parent_abs_y; int parent_abs_x, parent_abs_y;
Position x, y; Position x, y;
XtArgVal width0, height0;
Dimension width, height; Dimension width, height;
Window dummy_child; Window dummy_child;
/* /*
@ -290,7 +291,9 @@ PdmShellPresent(PdmShell* me)
* get the dimensions of the PDM window * get the dimensions of the PDM window
*/ */
XtRealizeWidget(me->widget); XtRealizeWidget(me->widget);
XtVaGetValues(me->widget, XmNwidth, &width, XmNheight, &height, NULL); XtVaGetValues(me->widget, XmNwidth, &width0, XmNheight, &height0, NULL);
width = (Dimension)width0;
height = (Dimension)height0;
/* /*
* determine the origin of the PDM popup such that it is * determine the origin of the PDM popup such that it is
* centered w.r.t. the parent window * centered w.r.t. the parent window

View file

@ -447,12 +447,13 @@ PdmMainWinHelpCB(Widget w, XtPointer client_data, XtPointer call_data)
* determine the current setup box * determine the current setup box
*/ */
{ {
int current_page, i; XtArgVal current_page;
int i;
PdmBoxNode* node; PdmBoxNode* node;
XtVaGetValues(me->notebook, XmNcurrentPageNumber, &current_page, NULL); XtVaGetValues(me->notebook, XmNcurrentPageNumber, &current_page, NULL);
node = me->box_list_head; node = me->box_list_head;
for(i = 1; i < current_page; i++) for(i = 1; i < (int)current_page; i++)
node = node->next; node = node->next;
box = node->box; box = node->box;
} }

View file

@ -825,8 +825,8 @@ PdmPrinterBoxResizeCB(Widget w,
PdmSetupBox* me = (PdmSetupBox*)client_data; PdmSetupBox* me = (PdmSetupBox*)client_data;
PdmPrinterBoxData* data = (PdmPrinterBoxData*)me->subclass_data; PdmPrinterBoxData* data = (PdmPrinterBoxData*)me->subclass_data;
typedef struct { typedef struct {
Position x, y; XtArgVal /* Position */ x, y;
Dimension width, height; XtArgVal /* Dimension */ width, height;
} PdmRect; } PdmRect;
PdmRect rt, rs, ro, rp, c1, c2, r1, r2; PdmRect rt, rs, ro, rp, c1, c2, r1, r2;
/* /*
@ -1121,9 +1121,9 @@ static void
OrientCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data) OrientCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
OrientCtl* me = (OrientCtl*)client_data; OrientCtl* me = (OrientCtl*)client_data;
Dimension height, width, margin_width, new_width; XtArgVal /* Dimension */ height, width, margin_width, new_width;
Position menu_x, menu_y, icon_x, icon_y; XtArgVal /* Position */ menu_x, menu_y, icon_x, icon_y;
Dimension menu_h, menu_w, icon_h, icon_w; XtArgVal /* Dimension */ menu_h, menu_w, icon_h, icon_w;
/* /*
* get current layout info * get current layout info
*/ */
@ -1212,7 +1212,7 @@ static void
OrientCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data) OrientCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
OrientCtl* me; OrientCtl* me;
int selected_item = (int)client_data; XtArgVal /* int */ selected_item = (XtArgVal)client_data;
XtVaGetValues(w, XmNuserData, &me, NULL); XtVaGetValues(w, XmNuserData, &me, NULL);
OrientCtlSetSelectedItem(me, selected_item); OrientCtlSetSelectedItem(me, selected_item);
@ -1574,9 +1574,9 @@ static void
PlexCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data) PlexCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
PlexCtl* me = (PlexCtl*)client_data; PlexCtl* me = (PlexCtl*)client_data;
Dimension height, width, margin_width, new_width; XtArgVal /* Dimension */ height, width, margin_width, new_width;
Position menu_x, menu_y, icon_x, icon_y; XtArgVal /* Position */ menu_x, menu_y, icon_x, icon_y;
Dimension menu_h, menu_w, icon_h, icon_w; XtArgVal /* Dimension */ menu_h, menu_w, icon_h, icon_w;
/* /*
* get current layout info * get current layout info
*/ */
@ -1665,7 +1665,7 @@ static void
PlexCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data) PlexCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
PlexCtl* me; PlexCtl* me;
int selected_item = (int)client_data; XtArgVal /* int */ selected_item = (XtArgVal)client_data;
XtVaGetValues(w, XmNuserData, &me, NULL); XtVaGetValues(w, XmNuserData, &me, NULL);
PlexCtlSetSelectedItem(me, selected_item); PlexCtlSetSelectedItem(me, selected_item);
@ -2072,8 +2072,8 @@ static void
TrayCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data) TrayCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
TrayCtl* me = (TrayCtl*)client_data; TrayCtl* me = (TrayCtl*)client_data;
Dimension height, menu_h; XtArgVal /* Dimension */ height, menu_h;
Position menu_y; XtArgVal /* Position */ menu_y;
/* /*
* get current layout info * get current layout info
*/ */
@ -2217,7 +2217,7 @@ static void
TrayCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data) TrayCtlSelectCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
TrayCtl* me; TrayCtl* me;
int selected_item = (int)client_data; XtArgVal /* int */ selected_item = (XtArgVal)client_data;
XtVaGetValues(w, XmNuserData, &me, NULL); XtVaGetValues(w, XmNuserData, &me, NULL);
TrayCtlSetSelectedItem(me, selected_item); TrayCtlSetSelectedItem(me, selected_item);
@ -2725,9 +2725,9 @@ static void
SizeCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data) SizeCtlResizeCB(Widget w, XtPointer client_data, XtPointer call_data)
{ {
SizeCtl* me = (SizeCtl*)client_data; SizeCtl* me = (SizeCtl*)client_data;
Dimension height, width, margin_width, new_width; XtArgVal /* Dimension */ height, width, margin_width, new_width;
Position list_x, list_y, radio_x, radio_y; XtArgVal /* Position */ list_x, list_y, radio_x, radio_y;
Dimension list_h, list_w, radio_h, radio_w; XtArgVal /* Dimension */ list_h, list_w, radio_h, radio_w;
Widget scrolled_list = XtParent(me->list_box); Widget scrolled_list = XtParent(me->list_box);
/* /*
* get current layout info * get current layout info
@ -2969,7 +2969,7 @@ CreateOptionMenuPulldown(String pulldown_name,
NULL); NULL);
if(activate_proc != (XtCallbackProc)NULL) if(activate_proc != (XtCallbackProc)NULL)
XtAddCallback(button, XmNactivateCallback, XtAddCallback(button, XmNactivateCallback,
activate_proc, (XtPointer)i); activate_proc, (XtPointer)(XtArgVal)i);
if(i == initial_item) if(i == initial_item)
initial_selected = button; initial_selected = button;
} }
@ -3063,6 +3063,7 @@ IconMaxDimension(Widget icon_label,
Dimension* max_width, Dimension* max_height) Dimension* max_width, Dimension* max_height)
{ {
Dimension width, height; Dimension width, height;
XtArgVal width0, height0;
/* /*
* set the pixmap in the label * set the pixmap in the label
*/ */
@ -3073,9 +3074,11 @@ IconMaxDimension(Widget icon_label,
* get the label dimensions * get the label dimensions
*/ */
XtVaGetValues(icon_label, XtVaGetValues(icon_label,
XmNwidth, &width, XmNwidth, &width0,
XmNheight, &height, XmNheight, &height0,
NULL); NULL);
width = (Dimension)width0;
height = (Dimension)height0;
/* /*
* update the max dimensions * update the max dimensions
*/ */
@ -3104,6 +3107,7 @@ PdmPixmapListNew(int count,
Boolean stipple) Boolean stipple)
{ {
PdmPixmapList* me = (PdmPixmapList*)XtCalloc(1, sizeof(PdmPixmapList)); PdmPixmapList* me = (PdmPixmapList*)XtCalloc(1, sizeof(PdmPixmapList));
XtArgVal fg, bg;
me->pixmap = (Pixmap*)XtCalloc(count, sizeof(Pixmap)); me->pixmap = (Pixmap*)XtCalloc(count, sizeof(Pixmap));
me->image_name = (char**)XtCalloc(count, sizeof(char*)); me->image_name = (char**)XtCalloc(count, sizeof(char*));
@ -3118,9 +3122,11 @@ PdmPixmapListNew(int count,
me->stipple = None; me->stipple = None;
} }
XtVaGetValues(w, XtVaGetValues(w,
XmNforeground, &me->foreground, XmNforeground, &fg,
XmNbackground, &me->background, XmNbackground, &bg,
NULL); NULL);
me->foreground = (Pixel)fg;
me->background = (Pixel)bg;
return me; return me;
} }
@ -3263,6 +3269,7 @@ PdmPixmapListGetPixmap(PdmPixmapList* me, int i)
static void static void
SetListBoxSelection(Widget list_box, int position) SetListBoxSelection(Widget list_box, int position)
{ {
XtArgVal visible_item_count0, item_count0;
int visible_item_count; int visible_item_count;
int item_count; int item_count;
int middle_offset; int middle_offset;
@ -3273,9 +3280,11 @@ SetListBoxSelection(Widget list_box, int position)
* it the initial selection. * it the initial selection.
*/ */
XtVaGetValues(list_box, XtVaGetValues(list_box,
XmNitemCount, &item_count, XmNitemCount, &item_count0,
XmNvisibleItemCount, &visible_item_count, XmNvisibleItemCount, &visible_item_count0,
NULL); NULL);
item_count = (int)item_count0;
visible_item_count = (int)visible_item_count0;
if(item_count > visible_item_count) if(item_count > visible_item_count)
{ {