From a82e129c58d45c4f6860aca637c89a7eb9729a54 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Mon, 18 Jul 2011 11:21:07 +0200 Subject: [PATCH] poppler_document_new_from_data(): Make the data parameter const. --- glib/poppler-document.cc | 7 +++++-- glib/poppler-document.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 745bc9b..ec2c2e6 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -217,7 +217,7 @@ poppler_document_new_from_file (const char *uri, * Return value: A newly created #PopplerDocument, or %NULL **/ PopplerDocument * -poppler_document_new_from_data (char *data, +poppler_document_new_from_data (const char *data, int length, const char *password, GError **error) @@ -233,7 +233,10 @@ poppler_document_new_from_data (char *data, // create stream obj.initNull(); - str = new MemStream(data, 0, length, &obj); + + // We cast away the const, knowing that this particular MemStream + // instance will not change or free the data. + str = new MemStream(const_cast(data), 0, length, &obj); password_g = NULL; if (password != NULL) diff --git a/glib/poppler-document.h b/glib/poppler-document.h index 69d0871..7cc3072 100644 --- a/glib/poppler-document.h +++ b/glib/poppler-document.h @@ -168,7 +168,7 @@ GType poppler_document_get_type (void) G_GNUC_CONST; PopplerDocument *poppler_document_new_from_file (const char *uri, const char *password, GError **error); -PopplerDocument *poppler_document_new_from_data (char *data, +PopplerDocument *poppler_document_new_from_data (const char *data, int length, const char *password, GError **error); -- 1.7.4.1