mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-27 05:48:20 +01:00
Rework CR/LF skip code to be more consistent.
This commit is contained in:
parent
12ef2fe2c3
commit
b0e4646f9d
@ -1737,6 +1737,10 @@ load_xref(
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PDFIO_DEBUG("load_xref: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[0]=0x%02x\n", tb.bufptr, tb.bufend, tb.bufptr[0], tb.bufptr[1]);
|
||||||
|
if (tb.bufptr && tb.bufptr < tb.bufend && (tb.bufptr[0] == 0x0d || tb.bufptr[0] == 0x0a))
|
||||||
|
tb.bufptr ++; // Skip trailing CR or LF after token
|
||||||
|
|
||||||
_pdfioTokenFlush(&tb);
|
_pdfioTokenFlush(&tb);
|
||||||
|
|
||||||
obj->stream_offset = _pdfioFileTell(pdf);
|
obj->stream_offset = _pdfioFileTell(pdf);
|
||||||
|
@ -441,7 +441,8 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb.bufptr && tb.bufptr < tb.bufend && (*(tb.bufptr) == 0x0d || *(tb.bufptr) == 0x0a))
|
PDFIO_DEBUG("_pdfioObjLoad: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[0]=0x%02x\n", tb.bufptr, tb.bufend, tb.bufptr[0], tb.bufptr[1]);
|
||||||
|
if (tb.bufptr && tb.bufptr < tb.bufend && (tb.bufptr[0] == 0x0d || tb.bufptr[0] == 0x0a))
|
||||||
tb.bufptr ++; // Skip trailing CR or LF after token
|
tb.bufptr ++; // Skip trailing CR or LF after token
|
||||||
|
|
||||||
_pdfioTokenFlush(&tb);
|
_pdfioTokenFlush(&tb);
|
||||||
|
@ -579,12 +579,6 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
|
|||||||
st->flate.next_in = (Bytef *)st->cbuffer;
|
st->flate.next_in = (Bytef *)st->cbuffer;
|
||||||
st->flate.avail_in = (uInt)rbytes;
|
st->flate.avail_in = (uInt)rbytes;
|
||||||
|
|
||||||
if (st->cbuffer[0] == 0x0a)
|
|
||||||
{
|
|
||||||
st->flate.next_in ++; // Skip newline
|
|
||||||
st->flate.avail_in --;
|
|
||||||
}
|
|
||||||
|
|
||||||
PDFIO_DEBUG("_pdfioStreamOpen: avail_in=%u, cbuffer=<%02X%02X%02X%02X%02X%02X%02X%02X...>\n", st->flate.avail_in, st->cbuffer[0], st->cbuffer[1], st->cbuffer[2], st->cbuffer[3], st->cbuffer[4], st->cbuffer[5], st->cbuffer[6], st->cbuffer[7]);
|
PDFIO_DEBUG("_pdfioStreamOpen: avail_in=%u, cbuffer=<%02X%02X%02X%02X%02X%02X%02X%02X...>\n", st->flate.avail_in, st->cbuffer[0], st->cbuffer[1], st->cbuffer[2], st->cbuffer[3], st->cbuffer[4], st->cbuffer[5], st->cbuffer[6], st->cbuffer[7]);
|
||||||
|
|
||||||
if ((status = inflateInit(&(st->flate))) != Z_OK)
|
if ((status = inflateInit(&(st->flate))) != Z_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user