Avoid overwrite of local variables when using
short (int, etc.) types with XtVaGetValues().

Cast XtPointer using (XtArgVal) without
the need to use C99 <stdint.h> and friends.
---
 cde/programs/dtpad/main.c        |    4 ++--
 cde/programs/dtpad/printJob.c    |    9 ++++++---
 cde/programs/dtpad/printOutput.c |   20 ++++++++++++++------
 cde/programs/dtpad/printSetup.c  |    2 +-
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/cde/programs/dtpad/main.c b/cde/programs/dtpad/main.c
index cccff2b..402e688 100644
--- a/cde/programs/dtpad/main.c
+++ b/cde/programs/dtpad/main.c
@@ -924,7 +924,7 @@ SendMessageToServer(
      ttdt_subcontract_manage(msg,
                        pStatusCB,
                        NULL,
-                       (void *) ((int) pPad->xrdb.blocking));/* client data */
+                       (void *) ((XtArgVal) pPad->xrdb.blocking));/* client 
data */
 
      /* Add pArgs to msg using tt_message_context_set */
      SetupLoadArgs(msg, pPad);
@@ -1163,7 +1163,7 @@ StartDbUpdate(
 void
 exitCB(Widget w, XtPointer callData, XtPointer clientData)
 {
-    exit((int) clientData);
+    exit((XtArgVal) clientData);
 }
 
 /************************************************************************
diff --git a/cde/programs/dtpad/printJob.c b/cde/programs/dtpad/printJob.c
index cc1e0ae..3372603 100644
--- a/cde/programs/dtpad/printJob.c
+++ b/cde/programs/dtpad/printJob.c
@@ -953,14 +953,17 @@ _pjPrintOnePageCB(
 
     if (pJob->pOutput == NULL)
     {
-       Dimension       width, height;
+        XtArgVal       width0, height0;
+        Dimension      width, height;
 
         width = 0; height=0;
         XtVaGetValues(
                 pJob->pShell,
-                XmNwidth, &width,
-                XmNheight, &height,
+                XmNwidth, &width0,
+                XmNheight, &height0,
                 NULL);
+        width = (Dimension)width0;
+        height = (Dimension)height0;
 
 #if defined(PRINT_TO_VIDEO)
         printf("PrintShell in _pjPrintOnePageCB: <W %d - H 
%d>\n",width,height);
diff --git a/cde/programs/dtpad/printOutput.c b/cde/programs/dtpad/printOutput.c
index 071145e..ca61c38 100644
--- a/cde/programs/dtpad/printOutput.c
+++ b/cde/programs/dtpad/printOutput.c
@@ -569,6 +569,7 @@ PrintOutputGetLinesPerPage(PrintOutput *pOutput)
 int
 PrintOutputGetNumLines(PrintOutput *pOutput)
 {
+    XtArgVal p;
     int        total = 0;
     int saveTop;
 
@@ -581,7 +582,8 @@ PrintOutputGetNumLines(PrintOutput *pOutput)
     DtEditorGoToLine(pOutput->editor, saveTop);
     pOutput->currentLine = saveTop;
 #else
-    XtVaGetValues(pOutput->editor, XmNtotalLines, &total, NULL);
+    XtVaGetValues(pOutput->editor, XmNtotalLines, &p, NULL);
+    total = (int)p;
 #endif
     return(total);
 }
@@ -698,7 +700,7 @@ PrintOutputLoadFile( PrintOutput *pOutput, char *file)
 static int
 _poDoGetLinesPerPage(PrintOutput *pOutput)
 {
-    Dimension   lpp;
+    XtArgVal   lpp;
 
     XtVaGetValues(pOutput->editor, XmNrows, &lpp, NULL);
     return ((int) lpp);
@@ -714,23 +716,29 @@ _poSetInnerPageDimensions(
                        Dimension left
                        )
 {
+    XtArgVal   outer_height0, outer_width0, footer_height0, header_height0;
     Dimension  inner_height, inner_width, inner_x, inner_y,
                outer_height, outer_width,
                editor_height, footer_height, header_height;
 
     XtVaGetValues(pOutput->page,
-                 XmNheight, &outer_height,
-                 XmNwidth, &outer_width,
+                 XmNheight, &outer_height0,
+                 XmNwidth, &outer_width0,
                  NULL);
 
     XtVaGetValues(pOutput->headerLeft,
-                 XmNheight, &header_height,
+                 XmNheight, &header_height0,
                  NULL);
 
     XtVaGetValues(pOutput->footerLeft,
-                 XmNheight, &footer_height,
+                 XmNheight, &footer_height0,
                  NULL);
 
+    outer_height = (Dimension)outer_height0;
+    outer_width = (Dimension)outer_width0;
+    header_height = (Dimension)header_height0;
+    footer_height = (Dimension)footer_height0;
+
     inner_x = left;
     inner_y = top;
     inner_height = (outer_height > (Dimension) (top + bottom)) ?
diff --git a/cde/programs/dtpad/printSetup.c b/cde/programs/dtpad/printSetup.c
index 4c74e14..33e537e 100644
--- a/cde/programs/dtpad/printSetup.c
+++ b/cde/programs/dtpad/printSetup.c
@@ -614,7 +614,7 @@ _psSetupToUi(PrintSetup *pSetup)
 static void
 _psUiToSetup(PrintSetup *pSetup)
 {
-    unsigned char      isSet;
+    XtArgVal           isSet;
     Widget             frame, w;
     PrintOptions       *pOption;
     char               *marginSpec;
-- 
1.7.9.2


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to