mutt_buffer_addstr(env->spam, C_SpamSeparator);
mutt_buffer_addstr(env->spam, buf);
}
-
- /* else overwrite */
- else
+ else /* overwrite */
{
- env->spam->dptr = env->spam->data;
- *env->spam->dptr = '\0';
+ mutt_buffer_reset(env->spam);
mutt_buffer_addstr(env->spam, buf);
}
}
if (flags & IMAP_CMD_QUEUE)
return 0;
- if (adata->cmdbuf->dptr == adata->cmdbuf->data)
+ if (mutt_buffer_len(adata->cmdbuf) == 0)
return IMAP_CMD_BAD;
rc = mutt_socket_send_d(adata->conn, adata->cmdbuf->data,
(flags & IMAP_CMD_PASS) ? IMAP_LOG_PASS : IMAP_LOG_CMD);
- adata->cmdbuf->dptr = adata->cmdbuf->data;
+ mutt_buffer_reset(adata->cmdbuf);
/* unidle when command queue is flushed */
if (adata->state == IMAP_IDLE)
struct Email **emails = m->emails;
- for (n = *pos; (n < m->msg_count) && ((buf->dptr - buf->data) < IMAP_MAX_CMDLEN); n++)
+ for (n = *pos; (n < m->msg_count) && (mutt_buffer_len(buf) < IMAP_MAX_CMDLEN); n++)
{
bool match = false; /* whether current message matches flag condition */
/* don't include pending expunged messages.
do
{
- cmd->dptr = cmd->data;
+ mutt_buffer_reset(cmd);
mutt_buffer_add_printf(cmd, "%s ", pre);
rc = make_msg_set(m, cmd, flag, changed, invert, &pos);
if (rc > 0)
}
snprintf(uid, sizeof(uid), "%u", imap_edata_get(e)->uid);
- cmd->dptr = cmd->data;
+ mutt_buffer_reset(cmd);
mutt_buffer_addstr(cmd, "UID STORE ");
mutt_buffer_addstr(cmd, uid);
/* Too big. Just query the whole range then. */
if ((chunks == 150) || (mutt_str_strlen(b->data) > 500))
{
- b->dptr = b->data;
+ mutt_buffer_reset(b);
mutt_buffer_add_printf(b, "%u:%u", msn_begin, msn_end);
}
}
char qc = 0; /* quote char */
char *pc = NULL;
- /* reset the destination pointer to the beginning of the buffer */
- dest->dptr = dest->data;
+ mutt_buffer_reset(dest);
SKIPWS(tok->dptr);
while ((ch = *tok->dptr))
struct Buffer err;
mutt_buffer_init(&err);
- err.dsize = 256;
- err.data = mutt_mem_malloc(err.dsize);
- err.dptr = err.data;
+ mutt_buffer_increase_size(&err, 256);
mutt_grouplist_init();
/* reverse alias keys need to be strdup'ed because of idna conversions */
{
mutt_buffer_increase_size(buf, mutt_str_strlen(in));
int olen = mutt_b64_decode(in, buf->data, buf->dsize);
+ /* mutt_from_base64 returns raw bytes, so don't terminate the buffer either */
if (olen > 0)
buf->dptr = buf->data + olen;
else
strncpy(srccopy, src, n);
srccopy[n - 1] = '\0';
- /* prepare BUFFERs */
+ /* prepare Buffers */
struct Buffer *srcbuf = mutt_buffer_from(srccopy);
+ /* note: we are resetting dptr and *reading* from the buffer, so we don't
+ * want to use mutt_buffer_reset(). */
srcbuf->dptr = srcbuf->data;
struct Buffer *word = mutt_buffer_new();
struct Buffer *cmd = mutt_buffer_new();