1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtmail: Resolve 50 compiler warnings.

This commit is contained in:
Peter Howkins 2015-01-06 15:07:55 +00:00
parent 3fab71345b
commit 0a0e1eebf5
15 changed files with 58 additions and 51 deletions

View file

@ -439,7 +439,7 @@ Attachment::invokeAction(int index)
int answer;
char *buf = new char[2048];
sprintf(buf,
sprintf(buf, "%s",
GETMSG(DT_catd, 3, 81, "This attachment may contain commands that can cause serious\ndamage. It is recommended that you only execute it after you\nare certain it is safe to do so.\n\nPress OK if you are certain it is safe,\nCancel to cancel execution."));
answer = parent()->handleQuestionDialog(
@ -868,7 +868,7 @@ Attachment::action(
/* NL_COMMENT
* Post a dialog explaining that the action was invalid
*/
sprintf(buf,
sprintf(buf, "%s",
GETMSG(
DT_catd, 3, 91, "Cannot execute invalid action."));
@ -883,7 +883,7 @@ Attachment::action(
/* NL_COMMENT
* Post a dialog explaining that the action failed.
*/
sprintf(buf,
sprintf(buf, "%s",
GETMSG(DT_catd, 3, 92, "Executing action failed!"));
answer = parent()->handleErrorDialog(GETMSG(DT_catd, 1, 86, "Mailer"),

View file

@ -317,7 +317,7 @@ DmxPrintOptions::DmxPrintOptions (
_FROM_MAILRC,
margin_keys[j].key,
DmxPrintOptions::isValidMarginSpec,
(void*) margin_keys[j].which);
(void*) (intptr_t) margin_keys[j].which);
_propui_array->append(pui);
}

View file

@ -1334,7 +1334,7 @@ void RoamApp::initialize(int *argcp, char **argv)
DtMailGenDialog *install_errDialog =
new DtMailGenDialog("Dialog", theApplication->baseWidget());
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."));
@ -2008,7 +2008,7 @@ RoamApp::vacation()
return (_vacation);
}
char *formatPropPair(char * key, void * data)
char *formatPropPair(char * key, const void * data)
{
char *formatted_str = NULL;
char *white_space = NULL;
@ -2036,18 +2036,18 @@ char *formatPropPair(char * key, void * data)
+ strlen((char *)data) + strlen(" = ") + 1;
formatted_str = (char *)malloc(m_size);
sprintf(formatted_str, "%s%s = %s",key, white_space, data);
sprintf(formatted_str, "%s%s = %s",key, white_space, (const char *) data);
}
else
{
/* make an alias string */
formatted_str = (char *)malloc(key_len + strlen((char *)data) + 2);
formatted_str = (char *)malloc(key_len + strlen((const char *)data) + 2);
m_size = key_len + strlen((char *)data) + strlen(" = ") + 1;
m_size = key_len + strlen((const char *)data) + strlen(" = ") + 1;
formatted_str = (char *)malloc(m_size);
sprintf(formatted_str, "%s = %s",key, data);
sprintf(formatted_str, "%s = %s",key, (const char *) data);
}

View file

@ -184,7 +184,7 @@ struct PropStringPair {
~PropStringPair(void);
};
char *formatPropPair(char * key, void * data);
char *formatPropPair(char * key, const void * data);
void parsePropString(const char * input, DtVirtArray<PropStringPair *> & result);
char* getPropStringValue(DtVirtArray<PropStringPair *> &result, const char *value);

View file

@ -2427,7 +2427,7 @@ Check file permissions and retry."),
if (NULL == _roam_menu_window)
{
char *text_buf = _text_editor->get_contents();
writeText((XtPointer) fd, text_buf);
writeText((XtPointer) (intptr_t) fd, text_buf);
XtFree((char*) text_buf);
}
else
@ -2492,8 +2492,8 @@ SaveAsTextCmd::writeTextFromScrolledList(int fd)
next_msg->display(
visible_headers,
&SaveAsTextCmd::writeText,
(XtPointer) fd);
writeText((XtPointer) fd, "\n\n");
(XtPointer) (intptr_t) fd);
writeText((XtPointer) (intptr_t) fd, "\n\n");
} while ((next_msg = mailbox->nextMessage()) != (DmxMsg *) NULL);
delete mailbox;
@ -2725,7 +2725,7 @@ void RenameAttachCmd::doit()
renameDialog = aa->getRenameDialog();
sprintf(buf, GETMSG(DT_catd, 3, 57, "Rename attachment as"));
sprintf(buf, "%s", GETMSG(DT_catd, 3, 57, "Rename attachment as"));
message = XmStringCreateLocalized(buf);
@ -3473,7 +3473,7 @@ VacationCmd::handleForwardFile()
else
dialog = theRoamApp.genDialog();
sprintf(error_buf, GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
dialog->setToQuestionDialog(GETMSG(DT_catd, 1, 103, "Mailer"),
error_buf);
@ -3521,7 +3521,7 @@ VacationCmd::handleForwardFile()
else
dialog = theRoamApp.genDialog();
sprintf(error_buf, GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
dialog->setToErrorDialog("Error", error_buf);
helpId = DTMAILHELPREMOVEVACATION;
@ -3791,7 +3791,7 @@ VacationCmd::recoverForwardFile(
char *buf = new char[BUFSIZ+1];
int fd;
sprintf(buf, file);
sprintf(buf, "%s", file);
strcat(buf, _backupSuffix);
if (rename(buf, file) < 0) {
@ -3898,7 +3898,7 @@ VacationCmd::parseVacationMessage()
struct stat buf;
if (SafeFStat(fd, &buf) < 0) {
sprintf(dialog_text,
sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 105, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPNOWRITEVACATION;
@ -4086,7 +4086,7 @@ VacationCmd::handleMessageFile(
}
if (msg_file_exists >= 0 && text_changed) {
sprintf(dialog_text,
sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 106, ".vacation.msg file exists. Replace with new text?"));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPEXISTSVACATION;
@ -4104,7 +4104,7 @@ VacationCmd::handleMessageFile(
fd = SafeOpen(messagefile, O_WRONLY | O_CREAT);
if (fd < 0) {
sprintf(dialog_text,
sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 107, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPERROR;

View file

@ -655,7 +655,7 @@ RoamMenuWindow::initialize()
if (!this->baseWidget())
{
fprintf(
stderr,
stderr, "%s",
GETMSG(DT_catd, 2, 3,
"Unable to initialize windows. Exiting.\n"));
exit(1);
@ -1615,7 +1615,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 +1796,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"),
@ -2240,7 +2240,7 @@ RoamMenuWindow::message( char *text )
}
else {
buf = new char[2];
sprintf(buf, "");
sprintf(buf, "%s", "");
labelStr = XmStringCreateLocalized(buf);
_clear_message_p = FALSE;
}

View file

@ -1062,7 +1062,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 +1076,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 +1091,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 +1153,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 +1197,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 +1330,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\
@ -3409,7 +3409,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(

View file

@ -101,7 +101,7 @@ options_radiobox_init(
XtAddCallback(items[i], XmNvalueChangedCallback,
options_setting_chgCB, (XtPointer)dirty_bit);
XtAddCallback(items[i], XmNvalueChangedCallback,
options_radiobox_itemCB, (XtPointer)item_values[i]);
options_radiobox_itemCB, (XtPointer) (intptr_t) item_values[i]);
/* Ensure Radiobox has a default Value set */
if (i == 0)

View file

@ -49,13 +49,17 @@ gid_t _originalRgid; // startup real gid
void
enableGroupPrivileges(void *)
{
(void) setgid(_originalEgid);
if(-1 == setgid(_originalEgid)) {
fprintf(stderr, "Failed to enable group priviledges\n");
}
}
void
disableGroupPrivileges(void *)
{
(void) setgid(_originalRgid);
if(-1 == setgid(_originalRgid)) {
fprintf(stderr, "Failed to disable group priviledges\n");
}
}
int

View file

@ -417,7 +417,7 @@ DmxMsg::display (void)
name = "(name)";
printf ("[%d] \"%s\"%s, ", i, name, description);
printf ("%s, %d bytes\n", type, length);
printf ("%s, %lu bytes\n", type, length);
if (attbuf != NULL)
delete [] attbuf;

View file

@ -122,7 +122,7 @@ formatHeader (DtMailHeaderLine &info, enum DmxHeaderType htype)
{
case MSGLIST:
sprintf (fbuf,
"%-18.18s %-16.16s %4ld/%-5s %-.25s",
"%-18.18s %-16.16s %4d/%-5s %-.25s",
dispname (header [DMXFROM]),
header [DMXDATE],
atoi (header [DMXCLENGTH]) / 40,

View file

@ -606,7 +606,7 @@ DtMailEnv::logError(DtMailBoolean criticalError, const char *format, ...) const
va_end(var_args);
syslog(criticalError == DTM_TRUE ? LOG_CRIT|LOG_ERR : LOG_ERR,
messageBuffer);
"%s", messageBuffer);
_DtSimpleError("libDtMail", criticalError == DTM_TRUE ? DtError : DtWarning,
NULL, messageBuffer);

View file

@ -1373,7 +1373,7 @@ DtMail::MailRc::nalias(char * key, void * data, void * client_data)
+ strlen((char *)data) + strlen(" = ") + 1;
new_alias = (char *)malloc(m_size);
sprintf(new_alias, "%s%s = %s",key, white_space, data);
sprintf(new_alias, "%s%s = %s",key, white_space, (char *) data);
}
else
@ -1382,7 +1382,7 @@ DtMail::MailRc::nalias(char * key, void * data, void * client_data)
m_size = key_len + strlen((char *)data) + strlen(" = ") + 1;
new_alias = (char *)malloc(m_size);
sprintf(new_alias, "%s = %s",key, data);
sprintf(new_alias, "%s = %s",key, (char *) data);
}

View file

@ -228,7 +228,7 @@ void HexDump(FILE *pfp, char *pmsg, unsigned char *pbufr, int plen, int plimit)
delete [] dumpfilename;
}
(void) fprintf(pfp_r, "--> %s (%d bytes at 0x%08lx):\n", pmsg, plen, pbufr);
(void) fprintf(pfp_r, "--> %s (%d bytes at %p):\n", pmsg, plen, pbufr);
fflush(pfp_r);
memset((char *)save, 0, sizeof(save));
save[0] = ~pbufr[0];
@ -236,7 +236,7 @@ void HexDump(FILE *pfp, char *pmsg, unsigned char *pbufr, int plen, int plimit)
cnt = plen;
for (x = 0; cnt > 0; x++, z += 16)
{
(void) fprintf(pfp_r, "0x%08lx(+%6.6ld) ", pbufr + z, z);
(void) fprintf(pfp_r, "%p(+%6.6ld) ", pbufr + z, z);
for (y = 0; y < 16; y++)
{
save[y] = pbufr[x * 16 + y];
@ -901,7 +901,10 @@ RFCMailBox::open(DtMailEnv & error,
pread(_fd, (void *)inbuf, 5, 0);
#else
lseek(_fd, (off_t) 0L, SEEK_SET);
read(_fd, (void *)inbuf, 5);
if(-1 == read(_fd, (void *)inbuf, 5)) {
error.setError(DTME_NotMailBox);
return;
}
lseek(_fd, (off_t) 0L, SEEK_SET);
#endif
inbuf[5] = (char)0;
@ -4588,21 +4591,21 @@ RFCMailBox::dumpMaps(const char *str)
memset((void*) &ctime_buf, 0, sizeof(_Xctimeparams));
fprintf(df, "--------------------- pid=%ld %s",
(long)getpid(), _XCtime(&clockTime, ctime_buf));
fprintf(df, str);
fprintf(df, "%s", str);
fprintf(df, "---------------------\n");
fprintf(df, "Mappings = %d\n", _mappings.length());
fprintf(df, "Map Entries:\n");
for (int m = 0; m < _mappings.length(); m++) {
MapRegion *map = _mappings[m];
fprintf(df, "map[%d]: map_region = 0x%08lx, map_size = 0x%08lx(%08ld)\n",
fprintf(df, "map[%d]: map_region = %p, map_size = 0x%08lx(%08ld)\n",
m, map->map_region, map->map_size, map->map_size);
if (map->map_size % memoryPageSize()) {
fprintf(df, "ERROR! map->map_size not mod %d\n", memoryPageSize());
fprintf(df, "ERROR! map->map_size not mod %lu\n", memoryPageSize());
}
HexDump(df, "map_region", (unsigned char *)map->map_region,
(int) map->file_size, _errorLogging ? 0 : 10);
fprintf(df,
"map[%d]: file_region = 0x%08lx, file_size = 0x%08lx(%08ld)\n",
"map[%d]: file_region = %p, file_size = 0x%08lx(%08ld)\n",
m, map->file_region, map->file_size, map->file_size);
fprintf(df, "map[%d]: offset = 0x%08lx(%08ld)\n",
m, map->offset, map->offset);
@ -4621,12 +4624,12 @@ RFCMailBox::dumpMaps(const char *str)
total_file_size += (off_t) map->file_size;
if ((total_file_size % 4096) == 0) {
fprintf(df,
"Total file size falls on page boundary, totalsize = %d\n",
"Total file size falls on page boundary, totalsize = %lu\n",
total_file_size);
}
}
fprintf(df, "\nstat buffer entries: st_ino = %d, st_dev = %d, st_nlink = %d, st_size = %ld\n",
fprintf(df, "\nstat buffer entries: st_ino = %lu, st_dev = %lu, st_nlink = %lu, st_size = %ld\n",
buf.st_ino, buf.st_dev, buf.st_nlink, buf.st_size);
fprintf(df, "\n\n");

View file

@ -995,7 +995,7 @@ RFCMessage::findMsgEnd(DtMailEnv & error, const char * eof)
content_length = content_length < 0 ? 0 : content_length;
char buf[20];
sprintf(buf, "%d", content_length);
sprintf(buf, "%lu", content_length);
_envelope->setHeader(error, "Content-Length", DTM_TRUE, buf);
return(real_end);
@ -1607,7 +1607,7 @@ RFCMessage::extractBoundary(const char * content_type)
if (!content_type) {
char * new_bdry = (char *)malloc(78);
sprintf(new_bdry, "%08lx-%08lx-%08lx", new_bdry, (long)time(NULL), &new_bdry);
sprintf(new_bdry, "%p-%08lx-%p", new_bdry, (long)time(NULL), &new_bdry);
}
// We will need the boundary to find the message boundaries.