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.

Introduce unions to cast XtPointer into
the requested data type.
---
 cde/programs/dtfile/File.c         |    2 +-
 cde/programs/dtfile/FileDialog.c   |   26 +++++++++++++++++---------
 cde/programs/dtfile/OverWrite.c    |   10 ++++++++--
 cde/programs/dtfile/dtcopy/utils.c |   17 ++++++++++++++---
 4 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/cde/programs/dtfile/File.c b/cde/programs/dtfile/File.c
index 3d9fba3..9f88b1c 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 6843c33..6961797 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,10 @@ ShowCopyFileDialog(
    char * directory_name;
    char * tmpStr, *tempStr;
 
+   union {
+     XtPointer ptr;
+     Dimension dim;
+   } wide;
    Dimension f_width, d_width;
 
    Widget shell;
@@ -301,7 +305,7 @@ ShowCopyFileDialog(
 
    XmUpdateDisplay (w);
 
-   if((int)client_data != 0)
+   if(client_data != 0)
    {
       file_view_data = (FileViewData *)client_data;
       mbar = XtParent(w);
@@ -542,16 +546,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, &wide.ptr, NULL);
+   d_width = wide.dim;
+   XtVaGetValues(file_label, XmNwidth, &wide.ptr, NULL);
+   f_width = wide.dim;
 
    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, &wide.ptr, NULL);
+   d_width = wide.dim;
+   XtVaGetValues(file_text, XmNwidth, &wide.ptr, NULL);
+   f_width = wide.dim;
 
    if (d_width > f_width)
        XtVaSetValues(file_text, XmNwidth, d_width, NULL);
@@ -772,7 +780,7 @@ ShowMoveFileDialog(
 
    XmUpdateDisplay (w);
 
-   if((int)client_data != 0)
+   if(client_data != 0)
    {
       file_view_data = (FileViewData *)client_data;
       mbar = XtParent(w);
@@ -1097,7 +1105,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 e2f1d0b..159848d 100644
--- a/cde/programs/dtfile/OverWrite.c
+++ b/cde/programs/dtfile/OverWrite.c
@@ -1757,9 +1757,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);
+            height = wide.dim;
+            XtVaGetValues (widget, XmNheight, &wide.ptr, NULL);
+            h = wide.dim;
 
             height +=2 * h;
             XtVaSetValues (action_area,
diff --git a/cde/programs/dtfile/dtcopy/utils.c 
b/cde/programs/dtfile/dtcopy/utils.c
index 196fa43..21ead35 100644
--- a/cde/programs/dtfile/dtcopy/utils.c
+++ b/cde/programs/dtfile/dtcopy/utils.c
@@ -135,9 +135,14 @@ help_callback(
        XtPointer call_data)
 {
   char  *helpVolume, *locationId;
+  union {
+    XtPointer ptr;
+    int num;
+  } wide;
   int   topic;
 
-  topic = (int) client_data;
+  wide.ptr = client_data;
+  topic = wide.num;
   helpVolume = HELP_VOLUME;
 
   switch (topic)
@@ -418,9 +423,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,
-- 
1.7.9.2


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to