summaryrefslogtreecommitdiff
path: root/src/cos_object.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-01-06 23:44:17 +0000
committerVincent Sanders <vince@kyllikki.org>2018-01-06 23:44:17 +0000
commite8dbf1fa8049169e6918cce20e98e309a793cffe (patch)
tree7f52336e2291186726538903de90e16389507474 /src/cos_object.h
parentad6da4a71f2b837a791401e658a16bf6903fd3b5 (diff)
downloadlibnspdf-e8dbf1fa8049169e6918cce20e98e309a793cffe.tar.gz
libnspdf-e8dbf1fa8049169e6918cce20e98e309a793cffe.tar.bz2
split out cross reference table handling to separate module
Diffstat (limited to 'src/cos_object.h')
-rw-r--r--src/cos_object.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/cos_object.h b/src/cos_object.h
index d0bd5ea..077be3b 100644
--- a/src/cos_object.h
+++ b/src/cos_object.h
@@ -50,6 +50,12 @@ struct cos_reference {
uint64_t generation;
};
+struct cos_stream {
+ uint8_t *data;
+ size_t length;
+};
+
+
struct cos_object {
int type;
union {
@@ -69,7 +75,7 @@ struct cos_object {
struct cos_string *s;
/** stream data */
- uint8_t *stream;
+ struct cos_stream *stream;
/* dictionary */
struct cos_dictionary_entry *dictionary;
@@ -221,3 +227,18 @@ nspdferror cos_get_dictionary(struct nspdf_doc *doc, struct cos_object *cobj, st
* NSERROR_TYPE if the \p cobj is not a array
*/
nspdferror cos_get_array(struct nspdf_doc *doc, struct cos_object *cobj, struct cos_object **value_out);
+
+/**
+ * get the stream value of a cos object.
+ *
+ * Get the value from a cos object, if the object is an object reference it
+ * will be dereferenced first. The dereferencing will parse any previously
+ * unreferenced indirect objects as required.
+ *
+ * \param doc The document the cos object belongs to.
+ * \param cobj A cos object of stream type.
+ * \param stream_out The result value.
+ * \return NSERROR_OK and \p stream_out updated,
+ * NSERROR_TYPE if the \p cobj is not a array
+ */
+nspdferror cos_get_stream(struct nspdf_doc *doc, struct cos_object *cobj, struct cos_stream **stream_out);