Skip to content

Commit

Permalink
rename parameters bufsz -> buflen
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Jan 17, 2018
1 parent 934c8d1 commit a22061a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions curs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,17 @@ void update_index(struct Menu *menu, struct Context *ctx, int check, int oldcoun
}

static int main_change_folder(struct Menu *menu, int op, char *buf,
size_t bufsz, int *oldcount, int *index_hint)
size_t buflen, int *oldcount, int *index_hint)
{
#ifdef USE_NNTP
if (OPT_NEWS)
{
OPT_NEWS = false;
nntp_expand_path(buf, bufsz, &CurrentNewsSrv->conn->account);
nntp_expand_path(buf, buflen, &CurrentNewsSrv->conn->account);
}
else
#endif
mutt_expand_path(buf, bufsz);
mutt_expand_path(buf, buflen);
if (mx_get_magic(buf) <= 0)
{
mutt_error(_("%s is not a mailbox."), buf);
Expand Down
26 changes: 13 additions & 13 deletions mutt_notmuch.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ static char *header_get_id(struct Header *h)
return (h && h->data) ? ((struct NmHdrData *) h->data)->virtual_id : NULL;
}

static char *header_get_fullpath(struct Header *h, char *buf, size_t bufsz)
static char *header_get_fullpath(struct Header *h, char *buf, size_t buflen)
{
snprintf(buf, bufsz, "%s/%s", nm_header_get_folder(h), h->path);
snprintf(buf, buflen, "%s/%s", nm_header_get_folder(h), h->path);
return buf;
}

Expand Down Expand Up @@ -308,7 +308,7 @@ static void query_window_reset(void)
* windowed_query_from_query - transforms a vfolder search query into a windowed one
* @param[in] query vfolder search string
* @param[out] buf allocated string buffer to receive the modified search query
* @param[in] bufsz allocated maximum size of the buf string buffer
* @param[in] buflen allocated maximum size of the buf string buffer
* @retval true Transformed search query is available as a string in buf
* @retval false Search query shall not be transformed
*
Expand Down Expand Up @@ -342,7 +342,7 @@ static void query_window_reset(void)
* If there's no search registered in `nm_query_window_current_search` or this is
* a new search, it will reset the window and do the search.
*/
static bool windowed_query_from_query(const char *query, char *buf, size_t bufsz)
static bool windowed_query_from_query(const char *query, char *buf, size_t buflen)
{
mutt_debug(2, "nm: %s\n", query);

Expand All @@ -369,10 +369,10 @@ static bool windowed_query_from_query(const char *query, char *buf, size_t bufsz
}

if (end == 0)
snprintf(buf, bufsz, "date:%d%s..now and %s", beg, NmQueryWindowTimebase,
snprintf(buf, buflen, "date:%d%s..now and %s", beg, NmQueryWindowTimebase,
NmQueryWindowCurrentSearch);
else
snprintf(buf, bufsz, "date:%d%s..%d%s and %s", beg, NmQueryWindowTimebase,
snprintf(buf, buflen, "date:%d%s..%d%s and %s", beg, NmQueryWindowTimebase,
end, NmQueryWindowTimebase, NmQueryWindowCurrentSearch);

mutt_debug(2, "nm: %s -> %s\n", query, buf);
Expand Down Expand Up @@ -1584,7 +1584,7 @@ int nm_read_entire_thread(struct Context *ctx, struct Header *h)
return rc;
}

char *nm_uri_from_query(struct Context *ctx, char *buf, size_t bufsz)
char *nm_uri_from_query(struct Context *ctx, char *buf, size_t buflen)
{
mutt_debug(2, "(%s)\n", buf);
struct NmCtxData *data = get_ctxdata(ctx);
Expand Down Expand Up @@ -1623,8 +1623,8 @@ char *nm_uri_from_query(struct Context *ctx, char *buf, size_t bufsz)

url_pct_encode(&uri[added], sizeof(uri) - added, buf);

strncpy(buf, uri, bufsz);
buf[bufsz - 1] = '\0';
strncpy(buf, uri, buflen);
buf[buflen - 1] = '\0';

mutt_debug(1, "nm: uri from query '%s'\n", buf);
return buf;
Expand Down Expand Up @@ -1950,17 +1950,17 @@ char *nm_get_description(struct Context *ctx)
return NULL;
}

int nm_description_to_path(const char *desc, char *buf, size_t bufsz)
int nm_description_to_path(const char *desc, char *buf, size_t buflen)
{
if (!desc || !buf || !bufsz)
if (!desc || !buf || (buflen == 0))
return -EINVAL;

for (struct Buffy *b = Incoming; b; b = b->next)
{
if ((b->magic == MUTT_NOTMUCH) && b->desc && (strcmp(desc, b->desc) == 0))
{
strncpy(buf, b->path, bufsz);
buf[bufsz - 1] = '\0';
strncpy(buf, b->path, buflen);
buf[buflen - 1] = '\0';
return 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions mutt_notmuch.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int nm_read_entire_thread(struct Context *ctx, struct Header *h);
char *nm_header_get_folder(struct Header *h);
int nm_update_filename(struct Context *ctx, const char *old, const char *new, struct Header *h);
bool nm_normalize_uri(char *new_uri, const char *orig_uri, size_t new_uri_sz);
char *nm_uri_from_query(struct Context *ctx, char *buf, size_t bufsz);
char *nm_uri_from_query(struct Context *ctx, char *buf, size_t buflen);
bool nm_message_is_still_queried(struct Context *ctx, struct Header *hdr);

void nm_query_window_backward(void);
Expand All @@ -45,7 +45,7 @@ void nm_longrun_init(struct Context *ctx, bool writable);
void nm_longrun_done(struct Context *ctx);

char *nm_get_description(struct Context *ctx);
int nm_description_to_path(const char *desc, char *buf, size_t bufsz);
int nm_description_to_path(const char *desc, char *buf, size_t buflen);

int nm_record_message(struct Context *ctx, char *path, struct Header *h);

Expand Down

0 comments on commit a22061a

Please sign in to comment.