aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit9f2b3d601aefb1ab04d42e1b6b1adc6d19e62a91 (patch)
treee5da1ff68fb96e7028eb16b1199c064ef3260a32 /preconv.c
parent1fa93d9309342feabdb39a57539a2492cc3c2b9a (diff)
downloadmandoc-9f2b3d601aefb1ab04d42e1b6b1adc6d19e62a91.tar.gz
mandoc-9f2b3d601aefb1ab04d42e1b6b1adc6d19e62a91.tar.zst
mandoc-9f2b3d601aefb1ab04d42e1b6b1adc6d19e62a91.zip
preconv_encode() can take a const input buffer;
diff from <christos at NetBSD>
Diffstat (limited to 'preconv.c')
-rw-r--r--preconv.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/preconv.c b/preconv.c
index 1fc137a9..08f8df86 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.16 2017/02/18 13:43:52 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;