nserv->overview_fmt = OverviewFmt;
else
{
- int chunk, cont = 0;
+ int cont = 0;
size_t buflen = 2 * LONG_STRING, off = 0, b = 0;
if (nserv->overview_fmt)
mutt_mem_realloc(&nserv->overview_fmt, buflen);
}
- chunk = mutt_socket_readln(nserv->overview_fmt + off, buflen - off, conn);
+ const int chunk =
+ mutt_socket_readln(nserv->overview_fmt + off, buflen - off, conn);
if (chunk < 0)
{
FREE(&nserv->overview_fmt);
* funct(NULL, *data) if rewind(*data) needs, exits when fail or done:
*/
static int nntp_fetch_lines(struct NntpData *nntp_data, char *query, size_t qlen,
- char *msg, int (*funct)(char *, void *), void *data)
+ const char *msg, int (*funct)(char *, void *), void *data)
{
int done = false;
int rc;
static int nntp_open_message(struct Context *ctx, struct Message *msg, int msgno)
{
struct NntpData *nntp_data = ctx->data;
- struct NntpAcache *acache = NULL;
struct Header *hdr = ctx->hdrs[msgno];
- char buf[_POSIX_PATH_MAX];
char article[16];
- char *fetch_msg = _("Fetching message...");
- int rc;
/* try to get article from cache */
- acache = &nntp_data->acache[hdr->index % NNTP_ACACHE_LEN];
+ struct NntpAcache *acache = &nntp_data->acache[hdr->index % NNTP_ACACHE_LEN];
if (acache->path)
{
if (acache->index == hdr->index)
}
else
{
+ char buf[_POSIX_PATH_MAX];
/* don't try to fetch article from removed newsgroup */
if (nntp_data->deleted)
return -1;
/* create new cache file */
+ const char *fetch_msg = _("Fetching message...");
mutt_message(fetch_msg);
msg->fp = mutt_bcache_put(nntp_data->bcache, article);
if (!msg->fp)
/* fetch message to cache file */
snprintf(buf, sizeof(buf), "ARTICLE %s\r\n",
NHDR(hdr)->article_num ? article : hdr->env->message_id);
- rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), fetch_msg, fetch_tempfile, msg->fp);
+ const int rc = nntp_fetch_lines(nntp_data, buf, sizeof(buf), fetch_msg,
+ fetch_tempfile, msg->fp);
if (rc)
{
mutt_file_fclose(&msg->fp);
int nntp_post(const char *msg)
{
struct NntpData *nntp_data, nntp_tmp;
- FILE *fp = NULL;
char buf[LONG_STRING];
- size_t len;
if (Context && Context->magic == MUTT_NNTP)
nntp_data = Context->data;
nntp_data->group = NULL;
}
- fp = mutt_file_fopen(msg, "r");
+ FILE *fp = mutt_file_fopen(msg, "r");
if (!fp)
{
mutt_perror(msg);
buf[1] = '\0';
while (fgets(buf + 1, sizeof(buf) - 2, fp))
{
- len = strlen(buf);
+ size_t len = strlen(buf);
if (buf[len - 1] == '\n')
{
buf[len - 1] = '\r';
struct NntpData *nntp_data = ctx->data;
struct NntpServer *nserv = nntp_data->nserv;
time_t now = time(NULL);
- int i, j;
int rc, ret = 0;
void *hc = NULL;
/* articles have been renumbered, remove all headers */
if (nntp_data->last_message < nntp_data->last_loaded)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->msgcount; i++)
mutt_free_header(&ctx->hdrs[i]);
ctx->msgcount = 0;
ctx->tagged = 0;
#endif
/* update flags according to .newsrc */
- for (i = j = 0; i < ctx->msgcount; i++)
+ int j = 0;
+ for (int i = 0; i < ctx->msgcount; i++)
{
bool flagged = false;
anum = NHDR(ctx->hdrs[i])->article_num;