dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtmail / dtmail / SendMsgDialog.C
index d2dcd9a4d30b6ce46feb7af40618fd526e500625..93961b2eb3818ff53aba6883110190776e67dae4 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
  */
@@ -158,6 +158,7 @@ SendMsgDialog::HeaderList::HeaderList(const HeaderList & other)
 {
     label = NULL;
     header = NULL;
+    value = NULL;
     show = other.show;
     form_widget = other.form_widget;
     label_widget = other.label_widget;
@@ -460,7 +461,7 @@ SendMsgDialog::updateMsgHnd()
 {
     DtMailEnv error;
     DtMail::Envelope * env;
-    int textLen;
+    int textLen = 0;
 
     env = _msgHandle->getEnvelope(error);
     storeHeaders();
@@ -471,9 +472,9 @@ SendMsgDialog::updateMsgHnd()
        XtFree(widget_text);
        widget_text = NULL;
     }
-    else
-       textLen = strlen(widget_text);
-    
+    else if(widget_text) {
+       textLen = strlen(widget_text);
+    }
     // Even if textlen is 0 because user has cleared all previous text,
     // need to setContents again to clear first BP.  Otherwise, deleted
     // text will show up. 
@@ -860,7 +861,7 @@ SendMsgDialog::loadHeaders(DtMail::Message * input,
 
        int slot = lookupHeader(name);
        if (slot < 0) {
-           // We dont have a place for this information. We may need
+           // We don't have a place for this information. We may need
            // to create a new header.
            //
            if (load_all) {
@@ -915,9 +916,7 @@ SendMsgDialog::storeHeaders(DtMail::Message * input)
        else {
            env->removeHeader(error, hl->header);
        }
-       if (value) {
-               XtFree(value);
-        }
+       XtFree(value);
     }
 }
 
@@ -1062,7 +1061,7 @@ SendMsgDialog::sendmailErrorProc (int, int status, void *data)
             * There was an error in one or more of the email addresses.  
             * Ask the user to type in a valid address and try again.
             */
-           sprintf(buf, GETMSG(DT_catd, 5, 5, 
+           sprintf(buf, "%s", GETMSG(DT_catd, 5, 5, 
 "Some of the addresses in the message are incorrect,\n\
 and do not refer to any known users in the system.\n\
 Please make sure all of the addresses are valid and try again."));
@@ -1076,7 +1075,7 @@ Please make sure all of the addresses are valid and try again."));
             * applications so there will be more memory available.
             */
  
-            sprintf(buf, GETMSG(DT_catd, 5, 6,
+            sprintf(buf, "%s", GETMSG(DT_catd, 5, 6,
 "Mailer does not have enough memory\n\
 available to send this message.\n\
 Try quitting other applications and\n\
@@ -1091,7 +1090,7 @@ resend this message."));
             * There was an error from the mail transport (sendmail).
             */
 
-           sprintf(buf, GETMSG(DT_catd, 5, 7,
+           sprintf(buf, "%s", GETMSG(DT_catd, 5, 7,
 "An error occurred while trying to send your message.\n\
 Check to make sure the message was received.  If not,\n\
 you may have to resend this message."));
@@ -1153,7 +1152,7 @@ SendMsgDialog::send_message(const char * trans_impl, int trans_type)
     if (!this->hasAddressee()) {
        // Message has no valid addressee.  Pop up error dialog.
 
-       sprintf(buf, GETMSG(DT_catd, 5, 8,
+       sprintf(buf, "%s", GETMSG(DT_catd, 5, 8,
                 "Try Send after specifying  recipient(s) of the message in \nthe To:, Cc:, or Bcc: fields."));
 
        helpId = DTMAILHELPNEEDADDRESSEE;
@@ -1197,7 +1196,7 @@ SendMsgDialog::send_message(const char * trans_impl, int trans_type)
     
     
     numPendingActions = attachArea->getNumPendingActions();
-    sprintf(buf, GETMSG(
+    sprintf(buf, "%s", GETMSG(
                        DT_catd, 
                        3, 
                        77, 
@@ -1330,7 +1329,7 @@ SendMsgDialog::popupMemoryError(DtMailEnv &error)
             * Mailer ran out of memory.  Ask the user to quit some other
             * applications so there will be more memory available.
             */
-           sprintf(buf, GETMSG(DT_catd, 5, 6,
+           sprintf(buf, "%s", GETMSG(DT_catd, 5, 6,
 "Mailer does not have enough memory\n\
 available to send this message.\n\
 Try quitting other applications and\n\
@@ -1727,9 +1726,7 @@ SendMsgDialog::include_file_cb( void *client_data, char *selection )
 {
     SendMsgDialog *obj = (SendMsgDialog *)client_data;
     obj->include_file(selection);
-    if (NULL != selection)
-      XtFree(selection);
-    
+    XtFree(selection);
 }
 
 void
@@ -2375,18 +2372,6 @@ SendMsgDialog::construct_text_popup(void)
     _textPopupMenuList->add( _edit_cut );
     _textPopupMenuList->add( _edit_copy );
     _textPopupMenuList->add( _edit_paste );
-#ifdef __osf__
-    // Work in progress from Mike. This adds the Paste Special to the
-    // third mouse button in the compose area of a compose window.
-    // Begin Paste Special submenu
-    CmdList * subcmdList1 = new CmdList ( "Paste Special", GETMSG(DT_catd, 1, 135 , "Paste Special") );
-    subcmdList1->add(_edit_paste_special[0]);
-    subcmdList1->add(_edit_paste_special[1]);
-    // End Paste Special submenu
-    _textPopupMenuList->add( subcmdList1 ); // Add Paste Special submenu
-    // (Either way) _textPopupMenuList->add( separator );
-    _textPopupMenuList->add( _edit_clear );
-#endif
     _textPopupMenuList->add( _edit_delete );
     _textPopupMenuList->add( _edit_select_all );
 
@@ -3153,7 +3138,7 @@ SendMsgDialog::parseNplace(const char * path)
     
     if (SafeRead(fd, _dead_letter_buf, 
                 (unsigned int) buf.st_size) != buf.st_size) {
-       delete _dead_letter_buf;
+       delete [] _dead_letter_buf;
        close(fd);
        return;
     }
@@ -3409,7 +3394,7 @@ SendMsgDialog::renameAttachmentOK()
     if (attachArea->getIconSelectedCount() > 1) {
        char *buf = new char[512];
        
-       sprintf(buf, GETMSG(DT_catd, 5, 4, "Select only one attachment\n\
+       sprintf(buf, "%s", GETMSG(DT_catd, 5, 4, "Select only one attachment\n\
 and then choose rename"));
        
        _genDialog->setToQuestionDialog(
@@ -3920,7 +3905,7 @@ SendMsgDialog::resetHeaders(void)
     for (i=0, j=results.length(); i < j; i++) {
        PropStringPair * psp = results[i];
        int slot = lookupHeader(psp->label);
-       // dont allow removal of default headers.
+       // don't allow removal of default headers.
        HeaderList * hl = _header_list[slot];
        if (!reservedHeader(hl->label)) {
                if (slot != -1)