From 1041e0800387a8af7eb99ba3c7b5195aa7d9b157 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Sat, 22 Sep 2012 12:05:57 +0200 Subject: [PATCH] Fix dtfile crash on 64 bit When asking for data using XtVaGetValue() make sure that there is enough place for the return value (which is sometimes XtPointer). Providing pointer to (int) is not enough. Cast XtPointer into requested int types directly, which unfortunately introduces compilation warning: cast from pointer to integer of different size --- cde/programs/dtfile/File.c | 2 +- cde/programs/dtfile/FileDialog.c | 23 ++++++++++++++--------- cde/programs/dtfile/OverWrite.c | 7 +++++-- cde/programs/dtfile/dtcopy/utils.c | 12 +++++++++--- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/cde/programs/dtfile/File.c b/cde/programs/dtfile/File.c index 3d9fba3c..9f88b1ca 100644 --- a/cde/programs/dtfile/File.c +++ b/cde/programs/dtfile/File.c @@ -7193,7 +7193,7 @@ CommitWorkProcUpdates( /* If not managed yet, manage the file window again */ if (!XtIsManaged((Widget)file_window)) { - int incr; + XtPointer incr; Arg args[2]; XtManageChild ((Widget)file_window); diff --git a/cde/programs/dtfile/FileDialog.c b/cde/programs/dtfile/FileDialog.c index 6843c338..5a8577e7 100644 --- a/cde/programs/dtfile/FileDialog.c +++ b/cde/programs/dtfile/FileDialog.c @@ -192,7 +192,7 @@ ShowRenameFileDialog( XmUpdateDisplay (w); - if((int)client_data != 0) + if(client_data != 0) { file_view_data = (FileViewData *)client_data; mbar = XtParent(w); @@ -224,7 +224,7 @@ ShowRenameFileDialog( XtSetArg (args[n], XmNallowShellResize, True); n++; /* Ignore accelerators when we're insensitive */ - if((int)client_data == 0) + if(client_data == 0) { if ((file_mgr_rec->menuStates & RENAME) == 0) return; @@ -270,6 +270,7 @@ ShowCopyFileDialog( char * directory_name; char * tmpStr, *tempStr; + XtPointer width; Dimension f_width, d_width; Widget shell; @@ -301,7 +302,7 @@ ShowCopyFileDialog( XmUpdateDisplay (w); - if((int)client_data != 0) + if(client_data != 0) { file_view_data = (FileViewData *)client_data; mbar = XtParent(w); @@ -542,16 +543,20 @@ ShowCopyFileDialog( /* Make the two labels the same length - maximum. */ /* ------------------------------------------------ */ - XtVaGetValues(dir_label, XmNwidth, &d_width, NULL); - XtVaGetValues(file_label, XmNwidth, &f_width, NULL); + XtVaGetValues(dir_label, XmNwidth, &width, NULL); + d_width = (Dimension)width; + XtVaGetValues(file_label, XmNwidth, &width, NULL); + f_width = (Dimension)width; if (d_width > f_width) XtVaSetValues(file_label, XmNwidth, d_width, NULL); else XtVaSetValues(dir_label, XmNwidth, f_width, NULL); - XtVaGetValues(dir_text, XmNwidth, &d_width, NULL); - XtVaGetValues(file_text, XmNwidth, &f_width, NULL); + XtVaGetValues(dir_text, XmNwidth, &width, NULL); + d_width = (Dimension)width; + XtVaGetValues(file_text, XmNwidth, &width, NULL); + f_width = (Dimension)width; if (d_width > f_width) XtVaSetValues(file_text, XmNwidth, d_width, NULL); @@ -772,7 +777,7 @@ ShowMoveFileDialog( XmUpdateDisplay (w); - if((int)client_data != 0) + if(client_data != 0) { file_view_data = (FileViewData *)client_data; mbar = XtParent(w); @@ -1097,7 +1102,7 @@ ShowLinkFileDialog( XmUpdateDisplay (w); - if((int)client_data != 0) + if(client_data != 0) { file_view_data = (FileViewData *)client_data; mbar = XtParent(w); diff --git a/cde/programs/dtfile/OverWrite.c b/cde/programs/dtfile/OverWrite.c index e2f1d0be..38821b66 100644 --- a/cde/programs/dtfile/OverWrite.c +++ b/cde/programs/dtfile/OverWrite.c @@ -1757,9 +1757,12 @@ Create_Action_Area( if (i == actions.defaultAction) { + XtPointer heightptr; Dimension height, h; - XtVaGetValues (action_area, XmNmarginHeight, &h, NULL); - XtVaGetValues (widget, XmNheight, &height, NULL); + XtVaGetValues (action_area, XmNmarginHeight, &heightptr, NULL); + height = (Dimension)heightptr; + XtVaGetValues (widget, XmNheight, &heightptr, NULL); + h = (Dimension)heightptr; height +=2 * h; XtVaSetValues (action_area, diff --git a/cde/programs/dtfile/dtcopy/utils.c b/cde/programs/dtfile/dtcopy/utils.c index 196fa432..824101bd 100644 --- a/cde/programs/dtfile/dtcopy/utils.c +++ b/cde/programs/dtfile/dtcopy/utils.c @@ -137,7 +137,7 @@ help_callback( char *helpVolume, *locationId; int topic; - topic = (int) client_data; + topic = (int)client_data; helpVolume = HELP_VOLUME; switch (topic) @@ -418,9 +418,15 @@ Create_Action_Area( if (i == actions.defaultAction) { + union { + XtPointer ptr; + Dimension dim; + } wide; Dimension height, h; - XtVaGetValues (action_area, XmNmarginHeight, &h, NULL); - XtVaGetValues (widget, XmNheight, &height, NULL); + XtVaGetValues (action_area, XmNmarginHeight, &wide.ptr, NULL); + h = wide.dim; + XtVaGetValues (widget, XmNheight, &wide.ptr, NULL); + height = wide.dim; height +=2 * h; XtVaSetValues (action_area, -- 2.25.1