dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtmail / dtmail / RoamMenuWindow.C
index b28f702aa0ed60bd1ccbc13f5cd6a4332ba43d14..75764df982bc628c8129a1ddcc464c865fcec701 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  * Floor, Boston, MA 02110-1301 USA
  */
 #include <unistd.h>
 #include <sys/param.h>
 
-#ifdef __uxp__
-#include <string.h>
-#endif
-
-#if !defined(USL) && !defined(__uxp__)
 #include <strings.h>
-#endif
 #include <errno.h>
 #include <unistd.h>
 #include <sys/utsname.h>
 
 #include "SortCmd.hh"
 
-extern force( Widget );
+extern int force( Widget );
 
  static const char * NormalIcon = "DtMail";
  static const char * EmptyIcon = "DtMnone";
@@ -421,8 +415,7 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
     else
       _inbox = FALSE;
 
-    if (NULL != mail_file)
-      free((void*)mail_file);
+    free((void*)mail_file);
 
     _list      = NULL;
     _genDialog  = NULL;
@@ -430,8 +423,8 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
     //
     // Initialize private variables
     //
-    _mbox_image = NULL;
-    _mbox_mask  = NULL;
+    _mbox_image = 0;
+    _mbox_mask  = 0;
 
     _my_editor = NULL;
     _message = NULL;
@@ -465,8 +458,8 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
     else
       _last_sorted_by = (SortBy) atoi(value);
 
-    if (NULL != value) free((void*) value);
-    if (NULL != buffer) XtFree(buffer);
+    free((void*) value);
+    XtFree(buffer);
 
 }
 
@@ -655,7 +648,7 @@ RoamMenuWindow::initialize()
     if (!this->baseWidget())
     {
        fprintf(
-               stderr, 
+               stderr, "%s",
                GETMSG(DT_catd, 2, 3,
                  "Unable to initialize windows. Exiting.\n"));
        exit(1);
@@ -683,7 +676,7 @@ RoamMenuWindow::initialize()
 
        if (_mbox_image == XmUNSPECIFIED_PIXMAP ||
            _mbox_mask == XmUNSPECIFIED_PIXMAP)
-         _mbox_image = _mbox_mask = NULL;
+         _mbox_image = _mbox_mask = 0;
     }
     
     // Add an event handler for structureNotify.
@@ -725,7 +718,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
     printHelpId("form1", form1);
     /* add help callback */
     // XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);
-    XtAddCallback(form1, XmNhelpCallback, HelpCB, DTMAILWINDOWID);
+    XtAddCallback(form1, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWID);
 
     panedW = XtCreateManagedWidget("panedW", xmPanedWindowWidgetClass,
                                   form1, NULL, 0);
@@ -757,7 +750,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
     /* add help callback */
     // XtAddCallback(_rowOfLabels, XmNhelpCallback, HelpCB, helpId);
     XtAddCallback(
-       _rowOfLabels, XmNhelpCallback, HelpCB, DTMAILWINDOWROWOFLABELSID);
+       _rowOfLabels, XmNhelpCallback, HelpCB, (void *)DTMAILWINDOWROWOFLABELSID);
 
     XtVaSetValues(_rowOfLabels, 
                  XmNrightAttachment,XmATTACH_FORM, 
@@ -788,11 +781,11 @@ RoamMenuWindow::createWorkArea(Widget parent)
 
     int header_lines = (int) strtol(value, NULL, 10);
     _list->visibleItems(header_lines);
-    if (NULL != value) free((void*) value);
+    free((void*) value);
 
     XtAddCallback(
        _list->get_scrolling_list(), XmNhelpCallback, 
-       HelpCB, DTMAILMSGLISTID);
+       HelpCB, (void *)DTMAILMSGLISTID);
 
     XtVaSetValues(_list->get_scrolling_list(), XmNuserData, this, NULL);
     _rowOfButtons =
@@ -1615,7 +1608,7 @@ RoamMenuWindow::open(
        else if ((DTMailError_t)error == DTME_BadRunGroup)
        {
 
-           sprintf(buf, GETMSG(DT_catd, 2, 4,
+           sprintf(buf, "%s", GETMSG(DT_catd, 2, 4,
                   "Mailer has not been properly installed,\n\
 and cannot run because the execution group\n\
 is incorrectly set."));
@@ -1796,7 +1789,7 @@ RoamMenuWindow::propsChanged(void)
            //
            displayInCurrentWorkspace();
            sprintf(
-               buf,
+               buf, "%s",
                GETMSG(DT_catd, 99, 99,"The INBOX path has changed.\nReopen?"));
            _genDialog->setToQuestionDialog(
                                        GETMSG(DT_catd, 3, 22, "Mailer"),
@@ -1863,8 +1856,7 @@ RoamMenuWindow::propsChanged(void)
     if (header_lines != _list->visibleItems())
        _list->visibleItems(header_lines);
 
-    if (NULL != value)
-      free((void*) value);
+    free((void*) value);
 
     _list->checkDisplayProp();
     _my_editor->textEditor()->update_display_from_props();
@@ -2240,7 +2232,7 @@ RoamMenuWindow::message( char *text )
     }
     else {
        buf = new char[2];
-       sprintf(buf, "");
+       sprintf(buf, "%s", "");
        labelStr = XmStringCreateLocalized(buf);
        _clear_message_p = FALSE;
     }
@@ -2788,7 +2780,7 @@ RoamMenuWindow::create_container_callback(void *client_data, char *selection)
 {
     RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
     obj->create_new_container(selection);
-    if (NULL != selection) XtFree(selection);
+    XtFree(selection);
 }
 
 void
@@ -2863,7 +2855,7 @@ RoamMenuWindow::addToRowOfButtons()
                                TRUE, this );
     ci  = new ButtonInterface (_rowOfButtons, _delete_button);
     w = ci->baseWidget();
-    XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILDELBTNID);
+    XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILDELBTNID);
     XtVaSetValues(w,
        XmNleftAttachment, XmATTACH_FORM,
        XmNtopAttachment, XmATTACH_FORM,
@@ -2880,7 +2872,7 @@ RoamMenuWindow::addToRowOfButtons()
                        TRUE, this );
     ci  = new ButtonInterface (_rowOfButtons, _next_button);
     w = ci->baseWidget();
-    XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILNEXTBTNID);
+    XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILNEXTBTNID);
     XtVaSetValues(w,
        XmNleftAttachment, XmATTACH_WIDGET,
        XmNleftWidget, prev_widget,
@@ -2899,7 +2891,7 @@ RoamMenuWindow::addToRowOfButtons()
                                TRUE, this );
     ci  = new ButtonInterface (_rowOfButtons, _previous_button);
     w = ci->baseWidget();
-    XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILPREVBTNID);
+    XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPREVBTNID);
     XtVaSetValues(w,
        XmNleftAttachment, XmATTACH_WIDGET,
        XmNleftWidget, prev_widget,
@@ -2920,7 +2912,7 @@ RoamMenuWindow::addToRowOfButtons()
                                FALSE );
     ci  = new ButtonInterface (_rowOfButtons, _replySender_button);
     w = ci->baseWidget();
-    XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILREPLYBTNID);
+    XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILREPLYBTNID);
     XtVaSetValues(w,
        XmNleftAttachment, XmATTACH_WIDGET,
        XmNleftWidget, prev_widget,
@@ -2938,7 +2930,7 @@ RoamMenuWindow::addToRowOfButtons()
                                TRUE, TRUE, this);
     ci  = new ButtonInterface (_rowOfButtons, _print_button);
     w = ci->baseWidget();
-    XtAddCallback(w, XmNhelpCallback, HelpCB, DTMAILPRINTBTNID);
+    XtAddCallback(w, XmNhelpCallback, HelpCB, (void *)DTMAILPRINTBTNID);
     XtVaSetValues(w,
        XmNleftAttachment, XmATTACH_WIDGET,
        XmNleftWidget, prev_widget,
@@ -3292,7 +3284,7 @@ RoamMenuWindow::createContainerList()
 void
 RoamMenuWindow::createOpenContainerList(CmdList * open_container)
 {
-    int                        ncontainers;
+    int                        ncontainers, i;
     char               *container_name;
     ContainerMenuCmd   *container_cmd;
 
@@ -3327,7 +3319,7 @@ RoamMenuWindow::createOpenContainerList(CmdList * open_container)
     _open_container_containerlist =
       new DtVirtArray<ContainerMenuCmd*>(ncontainers);
 
-    for (int i=0; i<ncontainers; i++)
+    for (i=0; i<ncontainers; i++)
     {
        container_name = (*_user_containerlist)[i]->containerName();
        if (NULL != container_name)
@@ -3490,7 +3482,7 @@ RoamMenuWindow::construct_file_menu()
 void
 RoamMenuWindow::createCopyList(CmdList * copy_to)
 {
-    int                        ncontainers;
+    int                        ncontainers, i;
     char               *container_name;
     ContainerMenuCmd   *container_cmd;
 
@@ -3550,7 +3542,7 @@ RoamMenuWindow::createCopyList(CmdList * copy_to)
     _copyto_containerlist =
       new DtVirtArray<ContainerMenuCmd *> (ncontainers);
 
-    for (int i=0; i<ncontainers; i++)
+    for (i=0; i<ncontainers; i++)
     {
        container_name = (*_user_containerlist)[i]->containerName();
        if (NULL != container_name)
@@ -3930,7 +3922,7 @@ RoamMenuWindow::construct_compose_menu()
 void
 RoamMenuWindow::construct_move_menu()
 {
-    int                        ncontainers;
+    int                        ncontainers, i;
     char               *container_name;
     ContainerMenuCmd   *container_cmd;
 
@@ -3967,7 +3959,7 @@ RoamMenuWindow::construct_move_menu()
       delete _move_containerlist;
     _move_containerlist = new DtVirtArray<ContainerMenuCmd *> (ncontainers);
 
-    for (int i=0; i<ncontainers; i++)
+    for (i=0; i<ncontainers; i++)
     {
        container_name = (*_user_containerlist)[i]->containerName();
        if (NULL != container_name)
@@ -4250,6 +4242,8 @@ RoamMenuWindow::syncViewAndStoreCallback(
     RoamMenuWindow * rmw = (RoamMenuWindow *)client_data;
 
     bval = rmw->syncViewAndStore(op, path, args);
+    
+    va_end(args);
     return(bval);
 }
 
@@ -5115,7 +5109,7 @@ RoamMenuWindow::inList(char *filename, DtVirtArray<ContainerMenuCmd *> *list)
     for (int i=0; i < list->length(); i++)
     {
        cmd = (*list)[i];
-       if (strcmp(filename, cmd->containerName()) == 0)
+       if (filename && strcmp(filename, cmd->containerName()) == 0)
          return(i);
     }
     return(-1);
@@ -5152,8 +5146,7 @@ RoamMenuWindow::addToCachedContainerList(char *filename)
                        &mail_file);
 
         is_inbox = (0 == strcmp(mail_file, filename));
-       if (NULL != mail_file)
-         free((void*) mail_file);
+       free((void*) mail_file);
        if (is_inbox)
          return;