X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/b6d8272551435098c716c546a5201206517e5da9..9b3bcfda2071ff49dd238b2315b1cc49c09a1552:/preconv.c diff --git a/preconv.c b/preconv.c index 1fc137a9..9ed627d4 100644 --- a/preconv.c +++ b/preconv.c @@ -1,4 +1,4 @@ -/* $Id: preconv.c,v 1.15 2015/10/06 18:32:19 schwarze Exp $ */ +/* $Id: preconv.c,v 1.17 2018/12/13 11:55:47 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -22,18 +22,21 @@ #include #include #include + #include "mandoc.h" +#include "roff.h" +#include "mandoc_parse.h" #include "libmandoc.h" int -preconv_encode(struct buf *ib, size_t *ii, struct buf *ob, size_t *oi, +preconv_encode(const struct buf *ib, size_t *ii, struct buf *ob, size_t *oi, int *filenc) { - unsigned char *cu; - int nby; - unsigned int accum; + const unsigned char *cu; + int nby; + unsigned int accum; - cu = (unsigned char *)ib->buf + *ii; + cu = (const unsigned char *)ib->buf + *ii; assert(*cu & 0x80); if ( ! (*filenc & MPARSE_UTF8)) @@ -90,7 +93,7 @@ preconv_encode(struct buf *ib, size_t *ii, struct buf *ob, size_t *oi, assert(accum < 0xd800 || accum > 0xdfff); *oi += snprintf(ob->buf + *oi, 11, "\\[u%.4X]", accum); - *ii = (char *)cu - ib->buf; + *ii = (const char *)cu - ib->buf; *filenc &= ~MPARSE_LATIN1; return 1;