diff options
author | Vincent Sanders <vince@kyllikki.org> | 2018-01-18 00:21:10 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2018-01-18 00:21:10 +0000 |
commit | b1e0e4414ecd3161c0f947daceb8643b5889e51c (patch) | |
tree | ab63f66b3651856f3528bb51e9acf522d0854521 /src/document.c | |
parent | c27eb52f96f8070c4be77a387e603508fc4092ce (diff) | |
download | libnspdf-b1e0e4414ecd3161c0f947daceb8643b5889e51c.tar.gz libnspdf-b1e0e4414ecd3161c0f947daceb8643b5889e51c.tar.bz2 |
start to alter parseing to read from cos_stream object
Diffstat (limited to 'src/document.c')
-rw-r--r-- | src/document.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/document.c b/src/document.c index bbe948d..b7a36d2 100644 --- a/src/document.c +++ b/src/document.c @@ -92,7 +92,7 @@ decode_startxref(struct nspdf_doc *doc, } offset += 9; - res = doc_skip_ws(doc, &offset); + res = nspdf__stream_skip_ws(doc->stream, &offset); if (res != NSPDFERROR_OK) { return res; } @@ -168,7 +168,7 @@ decode_trailer(struct nspdf_doc *doc, return -1; } offset += 7; - doc_skip_ws(doc, &offset); + nspdf__stream_skip_ws(doc->stream, &offset); res = cos_parse_object(doc, &offset, &trailer); if (res != 0) { @@ -422,13 +422,20 @@ static nspdferror check_header(struct nspdf_doc *doc) nspdferror nspdf_document_parse(struct nspdf_doc *doc, const uint8_t *buffer, - uint64_t buffer_length) + unsigned int buffer_length) { nspdferror res; doc->start = buffer; doc->length = buffer_length; + doc->stream = calloc(1, sizeof(struct cos_stream)); + if (doc->stream == NULL) { + return NSPDFERROR_NOMEM; + } + doc->stream->data = buffer; + doc->stream->length = buffer_length; + res = check_header(doc); if (res != 0) { printf("header check failed\n"); |