[BACK]Return to preconv.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/preconv.c between version 1.1 and 1.2

version 1.1, 2014/10/30 00:05:02 version 1.2, 2014/11/01 04:07:25
Line 24 
Line 24 
 #include "libmandoc.h"  #include "libmandoc.h"
   
 int  int
 preconv_encode(struct buf *ib, struct buf *ob, int *filenc)  preconv_encode(struct buf *ib, size_t *ii, struct buf *ob, size_t *oi,
       int *filenc)
 {  {
         size_t           i;          size_t           i;
         const long       one = 1L;          const long       one = 1L;
Line 44 
Line 45 
         if ( ! (*((const char *)(&one))))          if ( ! (*((const char *)(&one))))
                 be = 1;                  be = 1;
   
         for (i = ib->offs; i < ib->sz; i++) {          for (i = *ii; i < ib->sz; i++) {
                 cu = ib->buf[i];                  cu = ib->buf[i];
                 if (state) {                  if (state) {
                         if ( ! (cu & 128) || (cu & 64)) {                          if ( ! (cu & 128) || (cu & 64)) {
Line 78 
Line 79 
                                         (accum << 24);                                          (accum << 24);
   
                         if (accum < 0x80)                          if (accum < 0x80)
                                 ob->buf[ob->offs++] = accum;                                  ob->buf[(*oi)++] = accum;
                         else                          else
                                 ob->offs += snprintf(ob->buf + ob->offs,                                  *oi += snprintf(ob->buf + *oi,
                                     11, "\\[u%.4X]", accum);                                      11, "\\[u%.4X]", accum);
                         ib->offs = i + 1;                          *ii = i + 1;
                         *filenc &= ~MPARSE_LATIN1;                          *filenc &= ~MPARSE_LATIN1;
                         return(1);                          return(1);
                 } else {                  } else {
Line 133 
Line 134 
         if ( ! (*filenc & MPARSE_LATIN1))          if ( ! (*filenc & MPARSE_LATIN1))
                 return(0);                  return(0);
   
         ob->offs += snprintf(ob->buf + ob->offs, 11,          *oi += snprintf(ob->buf + *oi, 11,
             "\\[u%.4X]", (unsigned char)ib->buf[ib->offs++]);              "\\[u%.4X]", (unsigned char)ib->buf[(*ii)++]);
   
         *filenc &= ~MPARSE_UTF8;          *filenc &= ~MPARSE_UTF8;
         return(1);          return(1);
 }  }
   
 int  int
 preconv_cue(const struct buf *b)  preconv_cue(const struct buf *b, size_t offset)
 {  {
         const char      *ln, *eoln, *eoph;          const char      *ln, *eoln, *eoph;
         size_t           sz, phsz;          size_t           sz, phsz;
   
         ln = b->buf + b->offs;          ln = b->buf + offset;
         sz = b->sz - b->offs;          sz = b->sz - offset;
   
         /* Look for the end-of-line. */          /* Look for the end-of-line. */
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2