summaryrefslogtreecommitdiffstats
path: root/mh.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-01-26 12:58:54 -0800
committerKevin McCarthy <kevin@8t8.us>2021-01-27 13:54:38 -0800
commit5d73e4cf196abcfe2ef2a39ce2233ac080156cdb (patch)
tree74f8a8bec78f73efd66c6b4b041e5f0569ca63b7 /mh.c
parent7737b353357f6d8d6a86d5822d4afb98c4e444ef (diff)
Convert all mutt_atoX functions to behave strictly.
* Remove the automatic conversion of NULL and '\0' to 0. Add a flag for the cases that require lax evaluation. * Make trailing characters generate an error by default for the mutt_atouX functions. Add a flag for that case. Most of the IMAP code parses numbers out of a stream, so add the flag to those calls. * The mutt_atouX functions were also behaving incorrectly with invalid input, e.g. "ABC", returning and setting 0. Fix them to return an error in those cases. * Add a mutt_atoll() function, to be used in the next commit. * Change converters to store 0 on error. atos, atoi, and atoui were already doing this, but the others were not.
Diffstat (limited to 'mh.c')
-rw-r--r--mh.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mh.c b/mh.c
index 67e63824..1cea86ea 100644
--- a/mh.c
+++ b/mh.c
@@ -154,12 +154,12 @@ static int mh_read_token (char *t, int *first, int *last)
if ((p = strchr (t, '-')))
{
*p++ = '\0';
- if (mutt_atoi (t, first) < 0 || mutt_atoi (p, last) < 0)
+ if (mutt_atoi (t, first, 0) < 0 || mutt_atoi (p, last, 0) < 0)
return -1;
}
else
{
- if (mutt_atoi (t, first) < 0)
+ if (mutt_atoi (t, first, 0) < 0)
return -1;
*last = *first;
}
@@ -512,7 +512,7 @@ static void mh_update_sequences (CONTEXT * ctx)
else
p = ctx->hdrs[l]->path;
- if (mutt_atoi (p, &i) < 0)
+ if (mutt_atoi (p, &i, 0) < 0)
continue;
if (!ctx->hdrs[l]->read)
@@ -644,7 +644,7 @@ static void mh_update_maildir (struct maildir *md, struct mh_sequences *mhs)
else
p = md->h->path;
- if (mutt_atoi (p, &i) < 0)
+ if (mutt_atoi (p, &i, 0) < 0)
continue;
f = mhs_check (mhs, i);