mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-26 13:28:22 +01:00
Save work (debug printfs, etc.)
This commit is contained in:
parent
efe7c01015
commit
ddd984215a
@ -375,9 +375,9 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
|
|||||||
if (whence != SEEK_END && offset >= pdf->bufpos && offset < (pdf->bufpos + pdf->bufend - pdf->buffer))
|
if (whence != SEEK_END && offset >= pdf->bufpos && offset < (pdf->bufpos + pdf->bufend - pdf->buffer))
|
||||||
{
|
{
|
||||||
// Yes, seek within existing buffer...
|
// Yes, seek within existing buffer...
|
||||||
pdf->bufptr = pdf->buffer + offset - pdf->bufpos;
|
pdf->bufptr = pdf->buffer + (offset - pdf->bufpos);
|
||||||
PDFIO_DEBUG("_pdfioFileSeek: Seek within buffer, bufpos=%ld.\n", (long)pdf->bufpos);
|
PDFIO_DEBUG("_pdfioFileSeek: Seek within buffer, bufpos=%ld.\n", (long)pdf->bufpos);
|
||||||
PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p, bufend=%p\n", pdf->buffer, pdf->bufptr, pdf->bufend);
|
PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p(<%02X%02X...>), bufend=%p\n", pdf->buffer, pdf->bufptr, pdf->bufptr[0] & 255, pdf->bufptr[1] & 255, pdf->bufend);
|
||||||
return (offset);
|
return (offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
pdfio-file.c
15
pdfio-file.c
@ -1514,6 +1514,7 @@ load_obj_stream(pdfio_obj_t *obj) // I - Object to load
|
|||||||
|
|
||||||
// Skip offset
|
// Skip offset
|
||||||
_pdfioTokenGet(&tb, buffer, sizeof(buffer));
|
_pdfioTokenGet(&tb, buffer, sizeof(buffer));
|
||||||
|
PDFIO_DEBUG("load_obj_stream: %ld at offset %s\n", (long)number, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer[0])
|
if (!buffer[0])
|
||||||
@ -1865,8 +1866,18 @@ load_xref(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= num_sobjs && num_sobjs < (sizeof(sobjs) / sizeof(sobjs[0])))
|
if (i >= num_sobjs)
|
||||||
sobjs[num_sobjs ++] = (size_t)offset;
|
{
|
||||||
|
if (num_sobjs < (sizeof(sobjs) / sizeof(sobjs[0])))
|
||||||
|
{
|
||||||
|
sobjs[num_sobjs ++] = (size_t)offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_pdfioFileError(pdf, "Too many object streams.");
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!current)
|
else if (!current)
|
||||||
{
|
{
|
||||||
|
@ -452,6 +452,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PDFIO_DEBUG("_pdfioStreamOpen: ivlen=%d\n", (int)ivlen);
|
||||||
if (ivlen > 0)
|
if (ivlen > 0)
|
||||||
_pdfioFileConsume(st->pdf, ivlen);
|
_pdfioFileConsume(st->pdf, ivlen);
|
||||||
|
|
||||||
@ -567,6 +568,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
|
|||||||
else
|
else
|
||||||
st->predictor = _PDFIO_PREDICTOR_NONE;
|
st->predictor = _PDFIO_PREDICTOR_NONE;
|
||||||
|
|
||||||
|
PDFIO_DEBUG("_pdfioStreamOpen: pos=%ld\n", (long)_pdfioFileTell(st->pdf));
|
||||||
if (sizeof(st->cbuffer) > st->remaining)
|
if (sizeof(st->cbuffer) > st->remaining)
|
||||||
rbytes = _pdfioFileRead(st->pdf, st->cbuffer, st->remaining);
|
rbytes = _pdfioFileRead(st->pdf, st->cbuffer, st->remaining);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user