Commit 434cbb98 434cbb98532a64c2f6132226b42a61380f93e3d9 by Alain Magloire

Nuking of some useless warnings, and make "char *" --> "const char *"

        when required.

        * mailbox/include/imap0.h: warning: comma at end of enumerator list.
        * mailbox/locker.c (locker_set_expire_time): warning: declaration of `time'
          shadows global declaration
          (locker_get_expire_time): declaration of `time' shadows global declaration
        * mailbox/mbx_default.c (mu_path_maildir): Use "const" to reinforce a constant string.
        * include/mailutils/mailbox.h (mu_path_maildir): constant "const".
        * mailbox/mbx_mbox.c (mbox_append_message): status already declared.
        * mailbox/memory_stream.c (_memory_truncate): Cast before doing the comparison.
        * mailbox/parse822.c (parse822_time): useless ';' outside function definition.
        * mailbox/smtp.c (smtp_send_message): warning: declaration of `from' shadows a parameter
          declaration of `to' shadows a parameter.
1 parent 7e97ebd9
2002-03-15 Alain Magloire
Nuking of some useless warnings, and make "char *" --> "const char *"
when required.
* mailbox/include/imap0.h: warning: comma at end of enumerator list.
* mailbox/locker.c (locker_set_expire_time): warning: declaration of `time'
shadows global declaration
(locker_get_expire_time): declaration of `time' shadows global declaration
* mailbox/mbx_default.c (mu_path_maildir): Use "const" to reinforce a constant string.
* include/mailutils/mailbox.h (mu_path_maildir): constant "const".
* mailbox/mbx_mbox.c (mbox_append_message): status already declared.
* mailbox/memory_stream.c (_memory_truncate): Cast before doing the comparison.
* mailbox/parse822.c (parse822_time): useless ';' outside function definition.
* mailbox/smtp.c (smtp_send_message): warning: declaration of `from' shadows a parameter
declaration of `to' shadows a parameter.
2002-03-14 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* mail/util.c (util_do_command): Coredumped in false branches
......
......@@ -35,7 +35,7 @@
extern "C" {
#endif
extern char *mu_path_maildir;
extern const char *mu_path_maildir;
/* Constructor/destructor and possible types. */
extern int mailbox_create __P ((mailbox_t *, const char *));
......
......@@ -119,8 +119,7 @@ enum imap_auth_state
IMAP_AUTH_ANON_WAIT_CONT,
IMAP_AUTH_ANON_MSG,
IMAP_AUTH_ANON_MSG_SEND,
IMAP_AUTH_ANON_WAIT_RESP,
IMAP_AUTH_ANON_WAIT_RESP
};
struct literal_string
......
......@@ -144,15 +144,15 @@ int locker_set_flags (locker_t locker, int flags)
}
int
locker_set_expire_time (locker_t locker, int time)
locker_set_expire_time (locker_t locker, int etime)
{
if (!locker)
return MU_ERR_LOCKER_NULL;
if(time <= 0)
if(etime <= 0)
return EINVAL;
locker->expire_time = time;
locker->expire_time = etime;
return 0;
}
......@@ -199,15 +199,15 @@ int locker_get_flags (locker_t locker, int *flags)
}
int
locker_get_expire_time (locker_t locker, int *time)
locker_get_expire_time (locker_t locker, int *ptime)
{
if (!locker)
return MU_ERR_LOCKER_NULL;
if(!time)
if(!ptime)
return EINVAL;
*time = locker->expire_time;
*ptime = locker->expire_time;
return 0;
}
......
......@@ -34,7 +34,7 @@
#include <mailutils/mutil.h>
#include <mailutils/error.h>
char *mu_path_maildir = MU_PATH_MAILDIR;
const char *mu_path_maildir = MU_PATH_MAILDIR;
/* Is this a security risk? */
#define USE_ENVIRON 1
......
......@@ -233,7 +233,7 @@ mailbox_imap_open (mailbox_t mailbox, int flags)
m_imap_t m_imap = mailbox->data;
f_imap_t f_imap = m_imap->f_imap;
folder_t folder = f_imap->folder;
struct folder_list folders = { 0 };
struct folder_list folders = { 0, 0 };
/* m_imap must have been created during mailbox initialization. */
assert (mailbox->data);
......
......@@ -1421,7 +1421,6 @@ mbox_append_message (mailbox_t mailbox, message_t msg)
default:
{
off_t size;
int status;
/* Move to the end of the file, not necesary if _APPEND mode. */
if ((status = stream_size (mailbox->stream, &size)) != 0
|| (status = mbox_append_message0 (mailbox, msg, &size, 0, 0)) != 0)
......
......@@ -129,7 +129,7 @@ _memory_truncate (stream_t stream, off_t len)
free (mfs->ptr);
mfs->ptr = NULL;
}
else if (len != mfs->size)
else if (len != (off_t)mfs->size)
{
char *tmp = realloc (mfs->ptr, len);
if (tmp == NULL)
......
......@@ -1411,7 +1411,7 @@ int parse822_time(const char** p, const char* e,
str_free(&zone);
return EOK;
};
}
#if 0
For reference, especially the for the required range and values of the
......
......@@ -439,16 +439,16 @@ smtp_send_message(mailer_t mailer, message_t msg, address_t from, address_t to)
case SMTP_ENV_FROM:
{
size_t len = 0;
char *from;
char *frm;
address_get_email (smtp->mail_from, 1, NULL, 0, &len);
if (len == 0)
CHECK_ERROR (smtp, EINVAL);
from = calloc (len + 1, sizeof (char));
if (from == NULL)
frm = calloc (len + 1, sizeof (char));
if (frm == NULL)
CHECK_ERROR (smtp, ENOMEM);
address_get_email (smtp->mail_from, 1, from, len + 1, NULL);
status = smtp_writeline (smtp, "MAIL FROM: %s\r\n", from);
free (from);
address_get_email (smtp->mail_from, 1, frm, len + 1, NULL);
status = smtp_writeline (smtp, "MAIL FROM: %s\r\n", frm);
free (frm);
address_destroy (&smtp->mail_from);
CHECK_ERROR (smtp, status);
MAILER_DEBUG0 (mailer, MU_DEBUG_PROT, smtp->buffer);
......@@ -482,16 +482,16 @@ smtp_send_message(mailer_t mailer, message_t msg, address_t from, address_t to)
if (smtp->rcpt_index <= i)
{
size_t len = 0;
char *to;
char *To;
address_get_email (smtp->rcpt_to, smtp->rcpt_index, NULL, 0, &len);
if (len == 0)
CHECK_ERROR (smtp, EINVAL);
to = calloc (len + 1, sizeof (char));
if (to == NULL)
To = calloc (len + 1, sizeof (char));
if (To == NULL)
CHECK_ERROR (smtp, ENOMEM);
address_get_email (smtp->rcpt_to, smtp->rcpt_index, to, len + 1, NULL);
status = smtp_writeline (smtp, "RCPT TO: %s\r\n", to);
free (to);
address_get_email (smtp->rcpt_to, smtp->rcpt_index, To, len + 1, NULL);
status = smtp_writeline (smtp, "RCPT TO: %s\r\n", To);
free (To);
CHECK_ERROR (smtp, status);
MAILER_DEBUG0 (mailer, MU_DEBUG_PROT, smtp->buffer);
smtp->state = SMTP_RCPT_TO;
......