projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rocco Rutte:
[apps/madmutt.git]
/
handler.c
diff --git
a/handler.c
b/handler.c
index
9a90f6f
..
08d854c
100644
(file)
--- a/
handler.c
+++ b/
handler.c
@@
-28,6
+28,10
@@
#include "mutt_crypt.h"
#include "lib.h"
#include "mutt_crypt.h"
#include "lib.h"
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/debug.h"
#define BUFI_SIZE 1000
#define BUFO_SIZE 2000
#define BUFI_SIZE 1000
#define BUFO_SIZE 2000
@@
-238,7
+242,7
@@
void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd)
if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
break;
if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
break;
- linelen = strlen (line);
+ linelen = s
afe_s
trlen (line);
len -= linelen;
/*
len -= linelen;
/*
@@
-284,8
+288,7
@@
void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd)
buf[i++] = ch;
}
if (i != 4) {
buf[i++] = ch;
}
if (i != 4) {
- dprint (2, (debugfile, "%s:%d [mutt_decode_base64()]: "
- "didn't get a multiple of 4 chars.\n", __FILE__, __LINE__));
+ debug_print (2, ("didn't get a multiple of 4 chars.\n"));
break;
}
break;
}
@@
-366,15
+369,15
@@
void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd)
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
- len -=
mutt
_strlen (tmps);
- if ((!
mutt
_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
+ len -=
safe
_strlen (tmps);
+ if ((!
safe
_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
break;
}
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
break;
}
while (len > 0) {
if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
return;
- len -=
mutt
_strlen (tmps);
- if (!
mutt
_strncmp (tmps, "end", 3))
+ len -=
safe
_strlen (tmps);
+ if (!
safe
_strncmp (tmps, "end", 3))
break;
pt = tmps;
linelen = decode_byte (*pt);
break;
pt = tmps;
linelen = decode_byte (*pt);
@@
-514,7
+517,7
@@
static void enriched_wrap (struct enriched_state *stte)
stte->indent_len = 0;
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
stte->indent_len = 0;
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
- stte->indent_len +=
mutt
_strlen (stte->s->prefix);
+ stte->indent_len +=
safe
_strlen (stte->s->prefix);
}
if (stte->tag_level[RICH_EXCERPT]) {
}
if (stte->tag_level[RICH_EXCERPT]) {
@@
-522,11
+525,11
@@
static void enriched_wrap (struct enriched_state *stte)
while (x) {
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
while (x) {
if (stte->s->prefix) {
state_puts (stte->s->prefix, stte->s);
- stte->indent_len +=
mutt
_strlen (stte->s->prefix);
+ stte->indent_len +=
safe
_strlen (stte->s->prefix);
}
else {
state_puts ("> ", stte->s);
}
else {
state_puts ("> ", stte->s);
- stte->indent_len +=
mutt
_strlen ("> ");
+ stte->indent_len +=
safe
_strlen ("> ");
}
x--;
}
}
x--;
}
@@
-628,7
+631,7
@@
static void enriched_puts (char *s, struct enriched_state *stte)
{
char *c;
{
char *c;
- if (stte->buff_len < stte->buff_used +
mutt
_strlen (s)) {
+ if (stte->buff_len < stte->buff_used +
safe
_strlen (s)) {
stte->buff_len += LONG_STRING;
safe_realloc (&stte->buffer, stte->buff_len + 1);
}
stte->buff_len += LONG_STRING;
safe_realloc (&stte->buffer, stte->buff_len + 1);
}
@@
-732,7
+735,7
@@
void text_enriched_handler (BODY * a, STATE * s)
if (s->prefix) {
state_puts (s->prefix, s);
if (s->prefix) {
state_puts (s->prefix, s);
- stte.indent_len +=
mutt
_strlen (s->prefix);
+ stte.indent_len +=
safe
_strlen (s->prefix);
}
while (state != DONE) {
}
while (state != DONE) {
@@
-862,13
+865,13
@@
static void flowed_stuff (STATE * s, char *cont, int level)
* some text on the line which looks like it's quoted, turn off
* ANSI colors, so quote coloring doesn't affect this line.
*/
* some text on the line which looks like it's quoted, turn off
* ANSI colors, so quote coloring doesn't affect this line.
*/
- if (*cont && !level && !
mutt
_strcmp (Pager, "builtin")
+ if (*cont && !level && !
safe
_strcmp (Pager, "builtin")
&& flowed_maybe_quoted (cont))
state_puts ("\033[0m", s);
}
else if ((!(s->flags & M_PRINTING)) && ((*cont == ' ') || (*cont == '>')
|| (!level
&& flowed_maybe_quoted (cont))
state_puts ("\033[0m", s);
}
else if ((!(s->flags & M_PRINTING)) && ((*cont == ' ') || (*cont == '>')
|| (!level
- && !
mutt
_strncmp (cont, "From ",
+ && !
safe
_strncmp (cont, "From ",
5))))
state_putc (' ', s);
}
5))))
state_putc (' ', s);
}
@@
-940,7
+943,7
@@
static void text_plain_flowed_handler (BODY * a, STATE * s)
fprintf (stderr, "flowed_max = %d\n", flowed_max);
while (bytes > 0 && fgets (line, sizeof (line), s->fpin)) {
fprintf (stderr, "flowed_max = %d\n", flowed_max);
while (bytes > 0 && fgets (line, sizeof (line), s->fpin)) {
- bytes -= strlen (line);
+ bytes -= s
afe_s
trlen (line);
tail = NULL;
last_full = full;
tail = NULL;
last_full = full;
@@
-970,7
+973,7
@@
static void text_plain_flowed_handler (BODY * a, STATE * s)
*/
full = 0;
*/
full = 0;
- l = strlen (t + 1);
+ l = s
afe_s
trlen (t + 1);
t[0] = ' ';
t[1] = '\0';
t[0] = ' ';
t[1] = '\0';
@@
-1029,7
+1032,7
@@
static void text_plain_flowed_handler (BODY * a, STATE * s)
retry_wrap:
l = flowed_visual_strlen (cont, quoted + i_add + add + col);
retry_wrap:
l = flowed_visual_strlen (cont, quoted + i_add + add + col);
- rl =
mutt
_strlen (cont);
+ rl =
safe
_strlen (cont);
if (quoted + i_add + add + col + l > flowed_max) {
actually_wrap = 1;
if (quoted + i_add + add + col + l > flowed_max) {
actually_wrap = 1;
@@
-1123,7
+1126,7
@@
static void print_flowed_line (char *line, STATE * s, int ql)
{
int width;
char *pos, *oldpos;
{
int width;
char *pos, *oldpos;
- int len = strlen (line);
+ int len = s
afe_s
trlen (line);
int i;
if (MaxLineLength > 0) {
int i;
if (MaxLineLength > 0) {
@@
-1147,7
+1150,7
@@
static void print_flowed_line (char *line, STATE * s, int ql)
/* fprintf(stderr,"print_flowed_line will print `%s' with ql = %d\n",line,ql); */
/* fprintf(stderr,"print_flowed_line will print `%s' with ql = %d\n",line,ql); */
- if (strlen (line) == 0) {
+ if (s
afe_s
trlen (line) == 0) {
if (option (OPTQUOTEEMPTY)) {
if (s->prefix)
state_puts(s->prefix,s);
if (option (OPTQUOTEEMPTY)) {
if (s->prefix)
state_puts(s->prefix,s);
@@
-1230,24
+1233,24
@@
static void text_plain_flowed_handler (BODY * a, STATE * s)
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
/* fprintf(stderr,"read `%s'",buf); */
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
/* fprintf(stderr,"read `%s'",buf); */
- bytes -= strlen (buf);
+ bytes -= s
afe_s
trlen (buf);
newql = get_quote_level (buf);
if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) {
*t = '\0';
newql = get_quote_level (buf);
if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) {
*t = '\0';
- if (s
trlen (curline) > 0 && curline[
strlen (curline) - 1] == ' '
+ if (s
afe_strlen (curline) > 0 && curline[safe_
strlen (curline) - 1] == ' '
&& newql == quotelevel
&& strcmp (curline + quotelevel, "-- ") != 0) {
if (buf[newql] == ' ')
&& newql == quotelevel
&& strcmp (curline + quotelevel, "-- ") != 0) {
if (buf[newql] == ' ')
- curline[strlen (curline) - 1] = '\0';
+ curline[s
afe_s
trlen (curline) - 1] = '\0';
- curline = realloc (curline, curline_len + strlen (buf));
+ curline = realloc (curline, curline_len + s
afe_s
trlen (buf));
if (curline_len == 1)
*curline = '\0';
if (curline_len == 1)
*curline = '\0';
- curline_len += strlen (buf);
+ curline_len += s
afe_s
trlen (buf);
safe_strncat (curline, curline_len, buf + newql,
safe_strncat (curline, curline_len, buf + newql,
- strlen (buf + newql));
+ s
afe_s
trlen (buf + newql));
}
else {
if (first_line) {
}
else {
if (first_line) {
@@
-1258,11
+1261,11
@@
static void text_plain_flowed_handler (BODY * a, STATE * s)
}
FREE (&curline);
curline_len = 1;
}
FREE (&curline);
curline_len = 1;
- curline = realloc (curline, curline_len + strlen (buf));
+ curline = realloc (curline, curline_len + s
afe_s
trlen (buf));
if (curline_len == 1)
*curline = '\0';
if (curline_len == 1)
*curline = '\0';
- curline_len += strlen (buf);
- safe_strncat (curline, curline_len, buf, strlen (buf));
+ curline_len += s
afe_s
trlen (buf);
+ safe_strncat (curline, curline_len, buf, s
afe_s
trlen (buf));
quotelevel = newql;
}
}
quotelevel = newql;
}
}
@@
-1326,7
+1329,7
@@
static void alternative_handler (BODY * a, STATE * s)
}
else {
wild = 1;
}
else {
wild = 1;
- btlen =
mutt
_strlen (t->data);
+ btlen =
safe
_strlen (t->data);
}
if (a && a->parts)
}
if (a && a->parts)
@@
-1623,7
+1626,7
@@
void autoview_handler (BODY * a, STATE * s)
}
if (thepid < 0) {
}
if (thepid < 0) {
- mutt_perror
_("Can't create filter"
);
+ mutt_perror
(_("Can't create filter")
);
if (s->flags & M_DISPLAY) {
state_mark_attach (s);
if (s->flags & M_DISPLAY) {
state_mark_attach (s);
@@
-1875,7
+1878,7
@@
void mutt_body_handler (BODY * b, STATE * s)
handler = mutt_signed_handler;
}
else if ((WithCrypto & APPLICATION_PGP)
handler = mutt_signed_handler;
}
else if ((WithCrypto & APPLICATION_PGP)
- &&
mutt
_strcasecmp ("encrypted", b->subtype) == 0) {
+ &&
safe
_strcasecmp ("encrypted", b->subtype) == 0) {
p = mutt_get_parameter ("protocol", b->parameter);
if (!p)
p = mutt_get_parameter ("protocol", b->parameter);
if (!p)