Module Name: src Committed By: christos Date: Fri Dec 18 14:30:41 UTC 2015
Modified Files: src/external/bsd/mdocml/dist: libmandoc.h mandoc.h preconv.c read.c Log Message: make buffers for parsing functions const. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/mdocml/dist/libmandoc.h cvs rdiff -u -r1.4 -r1.5 src/external/bsd/mdocml/dist/mandoc.h cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/mdocml/dist/preconv.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/mdocml/dist/read.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/mdocml/dist/libmandoc.h diff -u src/external/bsd/mdocml/dist/libmandoc.h:1.5 src/external/bsd/mdocml/dist/libmandoc.h:1.6 --- src/external/bsd/mdocml/dist/libmandoc.h:1.5 Thu Dec 17 17:31:12 2015 +++ src/external/bsd/mdocml/dist/libmandoc.h Fri Dec 18 09:30:41 2015 @@ -1,4 +1,4 @@ -/* $Id: libmandoc.h,v 1.5 2015/12/17 22:31:12 christos Exp $ */ +/* $Id: libmandoc.h,v 1.6 2015/12/18 14:30:41 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <krist...@bsd.lv> * Copyright (c) 2013, 2014 Ingo Schwarze <schwa...@openbsd.org> @@ -74,7 +74,7 @@ void man_addspan(struct man *, const s void man_addeqn(struct man *, const struct eqn *); 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 *); Index: src/external/bsd/mdocml/dist/mandoc.h diff -u src/external/bsd/mdocml/dist/mandoc.h:1.4 src/external/bsd/mdocml/dist/mandoc.h:1.5 --- src/external/bsd/mdocml/dist/mandoc.h:1.4 Thu Dec 17 17:31:12 2015 +++ src/external/bsd/mdocml/dist/mandoc.h Fri Dec 18 09:30:41 2015 @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.4 2015/12/17 22:31:12 christos Exp $ */ +/* $Id: mandoc.h,v 1.5 2015/12/18 14:30:41 christos Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <krist...@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwa...@openbsd.org> @@ -431,7 +431,7 @@ void mparse_free(struct mparse *); void mparse_keep(struct mparse *); enum mandoclevel mparse_open(struct mparse *, int *, const char *); enum mandoclevel mparse_readfd(struct mparse *, int, const char *); -enum mandoclevel mparse_readmem(struct mparse *, void *, size_t, +enum mandoclevel mparse_readmem(struct mparse *, const void *, size_t, const char *); void mparse_reset(struct mparse *); void mparse_result(struct mparse *, Index: src/external/bsd/mdocml/dist/preconv.c diff -u src/external/bsd/mdocml/dist/preconv.c:1.1.1.3 src/external/bsd/mdocml/dist/preconv.c:1.2 --- src/external/bsd/mdocml/dist/preconv.c:1.1.1.3 Thu Dec 17 16:58:48 2015 +++ src/external/bsd/mdocml/dist/preconv.c Fri Dec 18 09:30:41 2015 @@ -1,4 +1,4 @@ -/* $Id: preconv.c,v 1.1.1.3 2015/12/17 21:58:48 christos Exp $ */ +/* $Id: preconv.c,v 1.2 2015/12/18 14:30:41 christos Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwa...@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; + 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 *i 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); Index: src/external/bsd/mdocml/dist/read.c diff -u src/external/bsd/mdocml/dist/read.c:1.11 src/external/bsd/mdocml/dist/read.c:1.12 --- src/external/bsd/mdocml/dist/read.c:1.11 Thu Dec 17 17:31:12 2015 +++ src/external/bsd/mdocml/dist/read.c Fri Dec 18 09:30:41 2015 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.11 2015/12/17 22:31:12 christos Exp $ */ +/* $Id: read.c,v 1.12 2015/12/18 14:30:41 christos Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <krist...@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwa...@openbsd.org> @@ -68,7 +68,7 @@ struct mparse { static void choose_parser(struct mparse *); static void resize_buf(struct buf *, size_t); -static void mparse_buf_r(struct mparse *, struct buf, size_t, int); +static void mparse_buf_r(struct mparse *, const struct buf, size_t, int); static int read_whole_file(struct mparse *, const char *, int, struct buf *, int *); static void mparse_end(struct mparse *); @@ -318,7 +318,7 @@ choose_parser(struct mparse *curp) * and indirectly (for .so file inclusion). */ static void -mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) +mparse_buf_r(struct mparse *curp, const struct buf blk, size_t i, int start) { const struct tbl_span *span; struct buf ln; @@ -748,12 +748,12 @@ mparse_parse_buffer(struct mparse *curp, } enum mandoclevel -mparse_readmem(struct mparse *curp, void *buf, size_t len, +mparse_readmem(struct mparse *curp, const void *buf, size_t len, const char *file) { struct buf blk; - blk.buf = buf; + blk.buf = __UNCONST(buf); blk.sz = len; mparse_parse_buffer(curp, blk, file);