struct ImapList *list = NULL;
struct ImapList lb;
char delimbuf[5]; /* worst case: "\\"\0 */
- long litlen;
+ unsigned int litlen;
if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST)
list = (struct ImapList *) idata->cmddata;
unsigned int count;
struct ImapStatus *status = NULL;
unsigned int olduv, oldun;
- long litlen;
+ unsigned int litlen;
short new = 0;
short new_msg_count = 0;
* Not explicitly buffered, relies on FILE buffering. NOTE: strips `\r` from
* `\r\n`. Apparently even literals use `\r\n`-terminated strings ?!
*/
-int imap_read_literal(FILE *fp, struct ImapData *idata, long bytes, struct Progress *pbar)
+int imap_read_literal(FILE *fp, struct ImapData *idata, unsigned long bytes,
+ struct Progress *pbar)
{
char c;
bool r = false;
mutt_debug(2, "reading %ld bytes\n", bytes);
- for (long pos = 0; pos < bytes; pos++)
+ for (unsigned long pos = 0; pos < bytes; pos++)
{
if (mutt_socket_readchar(idata->conn, &c) != 1)
{
int imap_open_connection(struct ImapData *idata);
void imap_close_connection(struct ImapData *idata);
struct ImapData *imap_conn_find(const struct Account *account, int flags);
-int imap_read_literal(FILE *fp, struct ImapData *idata, long bytes, struct Progress *pbar);
+int imap_read_literal(FILE *fp, struct ImapData *idata, unsigned long bytes, struct Progress *pbar);
void imap_expunge_mailbox(struct ImapData *idata);
void imap_logout(struct ImapData **idata);
int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, struct Buffer *cmd, int *err_continue);
void imap_free_idata(struct ImapData **idata);
char *imap_fix_path(struct ImapData *idata, const char *mailbox, char *path, size_t plen);
void imap_cachepath(struct ImapData *idata, const char *mailbox, char *dest, size_t dlen);
-int imap_get_literal_count(const char *buf, long *bytes);
+int imap_get_literal_count(const char *buf, unsigned int *bytes);
char *imap_get_qualifier(char *buf);
int imap_mxcmp(const char *mx1, const char *mx2);
char *imap_next_word(char *s);
static int msg_fetch_header(struct Context *ctx, struct ImapHeader *h, char *buf, FILE *fp)
{
struct ImapData *idata = NULL;
- long bytes;
+ unsigned int bytes;
int rc = -1; /* default now is that string isn't FETCH response */
int parse_rc;
char buf[LONG_STRING];
char path[_POSIX_PATH_MAX];
char *pc = NULL;
- long bytes;
+ unsigned int bytes;
struct Progress progressbar;
unsigned int uid;
int cacheno;
* @retval 0 Success
* @retval -1 Failure
*/
-int imap_get_literal_count(const char *buf, long *bytes)
+int imap_get_literal_count(const char *buf, unsigned int *bytes)
{
char *pc = NULL;
char *pn = NULL;
while (isdigit((unsigned char) *pc))
pc++;
*pc = '\0';
- *bytes = atoi(pn);
+ if (mutt_atoui(pn, bytes) < 0)
+ return -1;
return 0;
}