_last_state = 0;
_flash_owin = 0;
_flash_iwin = 0;
+ _main = NULL;
memset(&_window_attributes, 0, sizeof(XWindowAttributes));
assert ( theApplication != NULL ); // Application object must exist
}
XtManageChildren ( head_wl, num_wl );
- delete head_wl;
+ delete [] head_wl;
return(pulldown);
}
list_str = strdup("");
}
- if ((buf = (char *) malloc(strlen(list_str) + 1)) == NULL)
+ if ((buf = (char *) malloc(strlen(list_str) + 1)) == NULL) {
+ free((void *) list_str);
return;
+ }
strcpy(buf, (char *)list_str);
if((token = (char *) strtok(buf, " ")))
_editCmdList = NULL;
_size_selected_label = NULL;
_format_button = NULL;
+ _descriptionDialog = NULL;
+ _no_attachments_label = NULL;
+ _attachments_label = NULL;
+ _size_attachments_label = NULL;
}
if (read(fd, buffer, (unsigned int) s.st_size) < 0) {
SafeClose(fd);
+ delete [] buf;
+ delete [] buffer;
+ delete [] errormsg;
return(NULL);
}
buffer[s.st_size] = 0;
//
// This assumes that a non-null value means that the
// value is set and that a non-null means turn on the CB
- if (strcmp(value, "") == 0)
- options_checkbox_set_value(w, TRUE, this->dirty_bit);
- else if (NULL == value || strcmp(value, "f") == 0)
+ if (NULL == value || strcmp(value, "f") == 0)
options_checkbox_set_value(w, FALSE, this->dirty_bit);
+ else if (strcmp(value, "") == 0)
+ options_checkbox_set_value(w, TRUE, this->dirty_bit);
free((void*) value);
}
addlInfo = NULL;
numBPs = 0;
cachedValues = DTM_FALSE;
+ msgHandle = NULL;
+ msgHeader.header_values = 0;
+ msgHeader.number_of_names = 0;
+ bodyParts = NULL;
+ isNew = DTM_FALSE;
return;
}
_propui_array_iterator = 0;
_parent = parent;
_prop_source = NULL;
+ _hdrftr_frame = NULL;
+ _margin_frame = NULL;
+ _msgsep_iom = NULL;
+ _prthdr_iom = NULL;
+
//
// Create form to hold the printing options
_filename = (char*) malloc(MAXPATHLEN+1);
if (NULL != _filename)
- sprintf(_filename, "%s/dtmail_messages.ps", getenv("HOME"));
+ snprintf(_filename, MAXPATHLEN+1, "%s/dtmail_messages.ps", getenv("HOME"));
_printCB = printCB;
_cancelCB = cancelCB;
}
bp->unlockContents(error);
firstBPHandled = DTM_TRUE;
- if (attr) {
- DtDtsFreeAttributeValue(attr);
- attr = NULL;
- }
+ }
+ if (attr) {
+ DtDtsFreeAttributeValue(attr);
+ attr = NULL;
}
free(type);
value = strdup("24");
}
rows = (int) strtol(value, NULL, 10);
- if (NULL != value)
- free((void*) value);
+ free((void*) value);
set_rows(rows);
// If toolcols is set, overwrite the column width with "toolcols" value.
fprintf(stderr,
"dtmail: getMessageSummary: Couldn't get summary for msg # %d\n", m);
- if ((msg == NULL) || (mbox == NULL))
+ if (msg == NULL)
{
// Error
;
generalDialog = NULL;
_PrintingOptions = NULL;
_MailRetrievalOptions = NULL;
-
+ printing_pane_list = NULL;
}
void
char *tmpdir = new char[MAXPATHLEN+1];
// 1. Get buffer content into file.
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
p = tempnam(tmpdir, "mail");
if (p == NULL)
{
char * buf = new char[25];
- sprintf(buf, "Converted: %3d%", 0);
+ sprintf(buf, "Converted: %3d%%", 0);
_dialog->post ("Mailer",
buf,
// If a string was successfully extracted, call
// unifiedMailboxSelected to handle the file.
*selected = '\0';
- if (NULL != dname) strcat(selected, dname);
+ if (NULL != dname) snprintf(selected, sizeof(selected), "%s", dname);
strcat(selected, fname);
obj->updateUnifiedData();
obj->unifiedMailboxSelected(
DebugPrintf(1, "%s: printit\n", name());
// Create tmp file.
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((p = tempnam(tmpdir, "dtmail")) == NULL) {
delete [] tmpdir;
return;
// Create temp file.
//
char *tmpdir = new char[MAXPATHLEN+1];
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((tmppath = tempnam(tmpdir, "dtmail")) == NULL) {
- sprintf(buf, GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
+ snprintf(buf, sizeof(buf), GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
_genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 52, "Mailer"), buf);
helpId = DTMAILHELPNOCREATE;
_genDialog->post_and_return(helpId);
{
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
// Remove the current .forward file (it has vacation in it)
// Recover and replace the original backup forward file, if
Boolean retval = FALSE;
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
if (SafeAccess(forwardfile, F_OK) != 0) {
delete [] forwardfile;
delete [] messagefile;
delete [] error_buf;
delete [] forwardfile;
+ SafeClose(bkup_fd);
SafeClose(fwd_fd);
return 1;
}
strlen(append_buf2)) {
// error
SafeClose(bkup_fd);
+ SafeClose(fwd_fd);
delete [] buf;
delete [] messagefile;
delete [] error_buf;
return(-1);
}
- if ((fd = SafeOpen(file, O_RDONLY)) == 0) {
+ if ((fd = SafeOpen(file, O_RDONLY)) == -1) {
delete [] buf;
return(-1);
}
size_t map_size = (int) (buf.st_size +
(page_size - (buf.st_size % page_size)));
- if (buf.st_size == 0)
+ if (buf.st_size == 0) {
+ SafeClose(fd);
return;
+ }
int free_buf = 0;
mbuf.size = buf.st_size;
_last_sorted_by = (SortBy) atoi(value);
free((void*) value);
- if (NULL != buffer) XtFree(buffer);
+ XtFree(buffer);
}
RoamMenuWindow * rmw = (RoamMenuWindow *)client_data;
bval = rmw->syncViewAndStore(op, path, args);
+
+ va_end(args);
return(bval);
}
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);
{
DtMailEnv error;
DtMail::Envelope * env;
- int textLen;
+ int textLen = 0;
env = _msgHandle->getEnvelope(error);
storeHeaders();
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.
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;
}
}
// Now cleanup.
- delete messages;
+ delete [] messages;
}
//
if (path_prefix != NULL)
{
char *abs_exe_dir = new char[MAXPATHLEN+1];
- strcpy(abs_exe_dir, path_prefix);
- if (strcmp(buf, ".") != 0)
- {
- strcat(abs_exe_dir, "/");
- strcat(abs_exe_dir, buf);
+ if (strcmp(buf, ".") != 0) {
+ snprintf(abs_exe_dir, MAXPATHLEN+1, "%s/%s", path_prefix, buf);
+ } else {
+ snprintf(abs_exe_dir, MAXPATHLEN+1, "%s", path_prefix);
}
strcpy(buf, abs_exe_dir);
delete [] abs_exe_dir;
break;
case NUMHDRTYPES:
default:
+ delete [] fbuf;
return "";
}
return (fbuf); //need to free this after using it
void freerawlist(char **argv);
char *mt_value(char name[]);
char *expand(char *);
- int getfolderdir(char *);
+ int getfolderdir(char *, size_t);
static int hash(char *name);
static void vfree(char *cp);
// check for problems
if (ret) break;
}
+
+ va_end(va);
return (ret);
}
* Determine the current folder directory name.
*/
int
-DtMail::MailRc::getfolderdir(char *name)
+DtMail::MailRc::getfolderdir(char *name, size_t buffsize)
{
char *folder;
if ((folder = mt_value("folder")) == NOSTR)
return(-1);
if (*folder == '/')
- strcpy(name, folder);
+ snprintf(name, buffsize, "%s", folder);
else
- sprintf(name, "%s/%s", mt_value("HOME"), folder);
+ snprintf(name, buffsize, "%s/%s", mt_value("HOME"), folder);
return(0);
}
struct stat sbuf;
char *retchr = NULL;
- if (name[0] == '+' && getfolderdir(cmdbuf) >= 0) {
+ if (name[0] == '+' && getfolderdir(cmdbuf, LINESIZE) >= 0) {
sprintf(xname, "%s/%s", cmdbuf, name + 1);
str = expand(xname);
delete [] xname;
while (NULL != fgets(uidliststr, DTMAS_POPBUFSIZE, fp))
if (sscanf(uidliststr, "%d %s", &curmsg, curuidstr) == 2)
uidlist->append(strdup(uidliststr));
+
+ fclose(fp);
}
- fclose(fp);
}
void
uidliststr = (*uidlist)[i];
fprintf(fp, "%s\n", uidliststr);
}
+ fclose(fp);
}
- fclose(fp);
-
}
{
DtMailValueSeq value;
- if (mime_type)
- *mime_type = (char *)0;
+ if (mime_type) {
+ *mime_type = (char *)0;
- if (_body_env)
- _body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
+ if (_body_env) {
+ _body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
+ }
- if (_body_env && !error.isSet())
- {
- // Handle "Content-Type: text" problem with /usr/lib/mail.local
- if (strcasecmp(*(value[0]), "text")==0)
- *mime_type = strdup("text/plain");
- else
- *mime_type = strdup(*(value[0]));
- }
- else
- {
- error.clear();
- *mime_type = strdup("text/plain");
+ if (_body_env && !error.isSet()) {
+ // Handle "Content-Type: text" problem with /usr/lib/mail.local
+ if (strcasecmp(*(value[0]), "text")==0) {
+ *mime_type = strdup("text/plain");
+ } else {
+ *mime_type = strdup(*(value[0]));
+ }
+ } else {
+ error.clear();
+ *mime_type = strdup("text/plain");
+ }
}
}
#endif
#define GET_DUMPFILE_NAME(dfn) \
- sprintf(dfn, "%s/%s/dtmail.dump", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY)
+ snprintf(dfn, sizeof(dfn), "%s/%s/dtmail.dump", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY)
/*
* Local Data Definitions
return;
if (pfp_r == (FILE*) NULL) {
- char *dumpfilename = new char [MAXPATHLEN+1];
+ char dumpfilename[MAXPATHLEN+1];
_Xctimeparams ctime_buf;
GET_DUMPFILE_NAME(dumpfilename);
memset((void*) &ctime_buf, 0, sizeof(_Xctimeparams));
fprintf(pfp_r, "--------------------- pid=%ld %s",
(long)getpid(), _XCtime(&clockTime, ctime_buf));
- delete [] dumpfilename;
}
(void) fprintf(pfp_r, "--> %s (%d bytes at %p):\n", pmsg, plen, pbufr);
}
error.setError(DTME_NoMemory);
delete map;
+#if !defined(DO_ANONYMOUS_MAP)
+ SafeClose(fd);
+#endif
return(-1);
}
RFCMailBox::writeToDumpFile(const char *format, ...)
{
DtMailEnv error;
- char *dumpfilename = new char[MAXPATHLEN+1];
+ char dumpfilename[MAXPATHLEN+1];
_Xctimeparams ctime_buf;
GET_DUMPFILE_NAME(dumpfilename);
fprintf(df, "---------------------\n");
fprintf(df, "\n\n");
-
- delete [] dumpfilename;
+
fclose(df);
}
DtMailEnv error;
off_t total_file_size = 0;
struct sigaction sig_act, old_sig_act;
- char *dumpfilename = new char[MAXPATHLEN+1];
+ char dumpfilename[MAXPATHLEN+1];
GET_DUMPFILE_NAME(dumpfilename);
FILE *df = fopen(dumpfilename, "a");
error.logError(
DTM_FALSE,
"dumpMaps(): Cant open dump file %s\n", dumpfilename);
- delete [] dumpfilename;
if (SafeFStat(_fd, &buf) < 0) {
fprintf(df, "dumpMaps(): fstat(%d) failed errno=%d\n", _fd, errno);
default:
// Invalid encoding. Assume a false match.
- if (cs_name != NULL) free(cs_name);
+ free(cs_name);
return (enc_start);
}
MutexLock dt_lib_lock(_DtMutex);
DtMailValueSeq value;
- if (v3_type)
- *v3_type = (char *)0;
-
- _body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
- if (error.isNotSet())
- *v3_type = strdup(*(value[0]));
- else
- {
- error.clear();
- value.clear();
- _body_env->getHeader(error, "X-Sun-Data-Type", DTM_FALSE, value);
- if (error.isNotSet())
- *v3_type = strdup(*(value[0]));
- else
- {
- error.clear();
- *v3_type = strdup("text");
- }
+ if (v3_type) {
+ *v3_type = (char *)0;
+
+ _body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
+ if (error.isNotSet()) {
+ *v3_type = strdup(*(value[0]));
+ } else {
+ error.clear();
+ value.clear();
+ _body_env->getHeader(error, "X-Sun-Data-Type", DTM_FALSE, value);
+ if (error.isNotSet()) {
+ *v3_type = strdup(*(value[0]));
+ } else {
+ error.clear();
+ *v3_type = strdup("text");
+ }
+ }
}
}