summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-02-18 13:43:34 +0000
committerschwarze <schwarze@openbsd.org>2017-02-18 13:43:34 +0000
commit4d57ce78131708c00549e5437942b92cc6ff9969 (patch)
treef9e4044c5633792875790bf5352499f9d1075e9e
parentAdd Elf{32,64}_Nhdr structs with the same member names used by libelf (diff)
downloadwireguard-openbsd-4d57ce78131708c00549e5437942b92cc6ff9969.tar.xz
wireguard-openbsd-4d57ce78131708c00549e5437942b92cc6ff9969.zip
preconv_encode() can take a const input buffer;
diff from <christos at NetBSD>
-rw-r--r--usr.bin/mandoc/libmandoc.h4
-rw-r--r--usr.bin/mandoc/preconv.c14
2 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h
index 3abbdd81022..4f82e71a6fd 100644
--- a/usr.bin/mandoc/libmandoc.h
+++ b/usr.bin/mandoc/libmandoc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: libmandoc.h,v 1.50 2017/02/09 17:19:07 schwarze Exp $ */
+/* $OpenBSD: libmandoc.h,v 1.51 2017/02/18 13:43:34 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -59,7 +59,7 @@ int man_parseln(struct roff_man *, int, char *, int);
void man_endparse(struct roff_man *);
int preconv_cue(const struct buf *, size_t);
-int preconv_encode(struct buf *, size_t *,
+int preconv_encode(const struct buf *, size_t *,
struct buf *, size_t *, int *);
void roff_free(struct roff *);
diff --git a/usr.bin/mandoc/preconv.c b/usr.bin/mandoc/preconv.c
index 5593990d87c..43a1e2d4eae 100644
--- a/usr.bin/mandoc/preconv.c
+++ b/usr.bin/mandoc/preconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: preconv.c,v 1.7 2015/10/06 18:30:44 schwarze Exp $ */
+/* $OpenBSD: preconv.c,v 1.8 2017/02/18 13:43:34 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -24,14 +24,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))
@@ -88,7 +88,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;