170
170
u = camel_utf8_getc_limit (&inptr, inend);
173
g_warning("Truncated utf8 buffer");
173
g_warning ("Truncated utf8 buffer");
176
176
outptr = g_stpcpy (outptr, "<");
213
213
if (priv->flags & CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT)
216
outptr += sprintf(outptr, "&#%u;", u);
216
outptr += sprintf (outptr, "&#%u;", u);
290
290
/* FIXME: we could easily support multiple color depths here */
292
292
outptr = check_size (mime_filter, outptr, &outend, 25);
293
outptr += sprintf(outptr, "<font color=\"#%06x\">", (priv->color & 0xffffff));
293
outptr += sprintf (outptr, "<font color=\"#%06x\">", (priv->color & 0xffffff));
295
295
#if FOOLISHLY_UNMUNGE_FROM
296
296
else if (*start == '>') {
315
315
if (camel_url_scanner_scan (priv->scanner, start, len - (len > 0 && start[len - 1] == 0 ? 1 : 0), &match)) {
316
316
/* write out anything before the first regex match */
317
outptr = writeln (mime_filter, (const guchar *) start, (const guchar *) start + match.um_so,
319
(const guchar *) start,
320
(const guchar *) start +
320
324
start += match.um_so;
321
325
len -= match.um_so;
325
329
/* write out the href tag */
326
330
outptr = append_string_verbatim (mime_filter, "<a href=\"", outptr, &outend);
327
331
/* prefix shouldn't need escaping, but let's be safe */
328
outptr = writeln (mime_filter,
329
(const guchar *) match.prefix,
330
(const guchar *) match.prefix + strlen (match.prefix),
332
outptr = writeln (mime_filter,
333
(const guchar *) start,
334
(const guchar *) start + matchlen,
336
outptr = append_string_verbatim (mime_filter, "\">", outptr, &outend);
334
(const guchar *) match.prefix,
335
(const guchar *) match.prefix +
336
strlen (match.prefix),
340
(const guchar *) start,
341
(const guchar *) start +
344
outptr = append_string_verbatim (
338
348
/* now write the matched string */
339
outptr = writeln (mime_filter,
340
(const guchar *) start,
341
(const guchar *) start + matchlen,
351
(const guchar *) start,
352
(const guchar *) start +
343
355
priv->column += matchlen;
344
356
start += matchlen;
347
359
/* close the href tag */
348
outptr = append_string_verbatim (mime_filter, "</a>", outptr, &outend);
360
outptr = append_string_verbatim (
350
364
/* nothing matched so write out the remainder of this line buffer */
351
outptr = writeln (mime_filter, (const guchar *) start, (const guchar *) start + len, outptr, &outend);
367
(const guchar *) start,
368
(const guchar *) start + len,
354
372
} while (len > 0);
356
outptr = writeln (mime_filter, (const guchar *) start, (const guchar *) inptr, outptr, &outend);
376
(const guchar *) start,
377
(const guchar *) inptr,
359
381
if ((priv->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) && depth > 0) {
527
549
filter = camel_mime_filter_tohtml_new (flags, color);
529
camel_mime_filter_complete (filter, (gchar *) in, strlen (in), 0,
530
&outbuf, &outlen, &outpre);
551
camel_mime_filter_complete (
552
filter, (gchar *) in, strlen (in), 0,
553
&outbuf, &outlen, &outpre);
532
555
outbuf = g_strndup (outbuf, outlen);