summaryrefslogtreecommitdiffstats
path: root/preconv.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-18 13:43:52 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-18 13:43:52 +0000
commite0f83fe17d6cd87f02accf47e584092ec5126d59 (patch)
tree6a610cd2830da7dbf4f47d545d1a0e7bb3bf0b16 /preconv.c
parente00894fe291a747d5ff4b0d2d18f2dd37183a09e (diff)
downloadmandoc-e0f83fe17d6cd87f02accf47e584092ec5126d59.tar.gz
preconv_encode() can take a const input buffer;
diff from <christos at NetBSD>
Diffstat (limited to 'preconv.c')
-rw-r--r--preconv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/preconv.c b/preconv.c
index 32132817..9a310198 100644
--- a/preconv.c
+++ b/preconv.c
@@ -26,14 +26,14 @@
#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 +90,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;