From 6b06bbe5b3ef921259bddc1fbcc0ea77c9eb444f Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Wed, 18 Jul 2018 23:19:28 +0100 Subject: [PATCH] buf,buflen --- muttlib.c | 18 +++++++++--------- pager.c | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/muttlib.c b/muttlib.c index 84d07cc72..28e832c15 100644 --- a/muttlib.c +++ b/muttlib.c @@ -73,27 +73,27 @@ static const char *xdg_defaults[] = { /** * mutt_adv_mktemp - Advanced mktemp(3) - * @param s Buffer for result - * @param l Length of buffer + * @param buf Buffer for result + * @param buflen Length of buffer * * Modified by blong to accept a "suggestion" for file name. If that file * exists, then construct one with unique name but keep any extension. This * might fail, I guess. */ -void mutt_adv_mktemp(char *s, size_t l) +void mutt_adv_mktemp(char *buf, size_t buflen) { - if (s[0] == '\0') + if (buf[0] == '\0') { - mutt_mktemp(s, l); + mutt_mktemp(buf, buflen); } else { char prefix[PATH_MAX]; - mutt_str_strfcpy(prefix, s, sizeof(prefix)); + mutt_str_strfcpy(prefix, buf, sizeof(prefix)); mutt_file_sanitize_filename(prefix, true); - snprintf(s, l, "%s/%s", NONULL(Tmpdir), prefix); + snprintf(buf, buflen, "%s/%s", NONULL(Tmpdir), prefix); struct stat sb; - if (lstat(s, &sb) == -1 && errno == ENOENT) + if (lstat(buf, &sb) == -1 && errno == ENOENT) return; char *suffix = strrchr(prefix, '.'); @@ -102,7 +102,7 @@ void mutt_adv_mktemp(char *s, size_t l) *suffix = 0; suffix++; } - mutt_mktemp_pfx_sfx(s, l, prefix, suffix); + mutt_mktemp_pfx_sfx(buf, buflen, prefix, suffix); } } diff --git a/pager.c b/pager.c index ead6aa22c..c7ba57057 100644 --- a/pager.c +++ b/pager.c @@ -1147,21 +1147,21 @@ static int grok_ansi(unsigned char *buf, int pos, struct AnsiAttr *a) /** * trim_incomplete_mbyte - Remove an incomplete character - * @param buf Buffer containing string - * @param len Length of buffer + * @param buf Buffer containing string + * @param buflen Length of buffer * @retval num Number of bytes remaining * * trim tail of buf so that it contains complete multibyte characters */ -static int trim_incomplete_mbyte(unsigned char *buf, size_t len) +static int trim_incomplete_mbyte(unsigned char *buf, size_t buflen) { mbstate_t mbstate; size_t k; memset(&mbstate, 0, sizeof(mbstate)); - for (; len > 0; buf += k, len -= k) + for (; buflen > 0; buf += k, buflen -= k) { - k = mbrtowc(NULL, (char *) buf, len, &mbstate); + k = mbrtowc(NULL, (char *) buf, buflen, &mbstate); if (k == (size_t)(-2)) break; else if (k == (size_t)(-1) || k == 0) @@ -1173,7 +1173,7 @@ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) } *buf = '\0'; - return len; + return buflen; } static int fill_buffer(FILE *f, LOFF_T *last_pos, LOFF_T offset, unsigned char **buf, -- 2.50.1