diff options
-rw-r--r-- | blaze822.c | 21 | ||||
-rw-r--r-- | rfc2045.c | 2 |
2 files changed, 6 insertions, 17 deletions
diff --git a/blaze822.c b/blaze822.c index ef28383..f8b5812 100644 --- a/blaze822.c +++ b/blaze822.c @@ -24,12 +24,10 @@ parse_posint(char **s, size_t minn, size_t maxn) errno = 0; n = strtol(*s, &end, 10); - if (errno) { -// perror("strtol"); + if (errno) return -1; - } if (n < (long)minn || n > (long)maxn) { -// fprintf(stderr, "number outside %zd <= n < %zd\n", minn, maxn); + errno = ERANGE; return -1; } *s = end; @@ -41,17 +39,6 @@ blaze822_date(char *s) { struct tm tm; int c; -#if 0 -#define i4(m) (s[0] && (s[0]|0x20) == m[0] && \ - s[1] && (s[1]|0x20) == m[1] && \ - s[2] && (s[2]|0x20) == m[2] && \ - s[3] && (s[3]|0x20) == m[3] && (s = s+4) ) - -#define i3(m) (s[0] && (s[0]|0x20) == m[0] && \ - s[1] && (s[1]|0x20) == m[1] && \ - s[2] && (s[2]|0x20) == m[2] && (s = s+3) ) -#endif - #define i4(m) (((uint32_t) m[0]<<24 | m[1]<<16 | m[2]<<8 | m[3]) == \ ((uint32_t) s[0]<<24 | s[1]<<16 | s[2]<<8 | s[3] | 0x20202020) \ && (s += 4)) @@ -87,6 +74,9 @@ blaze822_date(char *s) { else if (i3("dec")) tm.tm_mon = 11; else goto fail; +#undef i3 +#undef i4 + while (iswsp(*s)) s++; @@ -308,7 +298,6 @@ blaze822(char *file) fd = open(file, O_RDONLY); if (fd < 0) { -// perror("open"); free(mesg); return 0; } diff --git a/rfc2045.c b/rfc2045.c index 1d853ab..49743cb 100644 --- a/rfc2045.c +++ b/rfc2045.c @@ -136,7 +136,7 @@ blaze822_multipart(struct message *msg, struct message **imsg) char *part = mymemmem(prevpart, msg->bodyend - prevpart, mboundary, boundarylen); if (!part) return 0; - /// XXX access to stuff before first boundary? + part += boundarylen; if (*part == '\r') part++; |