Add const to FPDF_PAGERANGE declaration.
Then make conversion in helper functions return const, too.
Enables significantly easier conversions in subsequent CLs. It is
packaged into a standalone CL since it is a public change.
Change-Id: I10fa98ce3558e15a1ba0fa3fa555743424a43846
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/94672
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_helpers.h b/fpdfsdk/cpdfsdk_helpers.h
index c339b80..429754f 100644
--- a/fpdfsdk/cpdfsdk_helpers.h
+++ b/fpdfsdk/cpdfsdk_helpers.h
@@ -151,11 +151,11 @@
return reinterpret_cast<CPDF_ContentMarkItem*>(mark);
}
-inline FPDF_PAGERANGE FPDFPageRangeFromCPDFArray(CPDF_Array* range) {
+inline FPDF_PAGERANGE FPDFPageRangeFromCPDFArray(const CPDF_Array* range) {
return reinterpret_cast<FPDF_PAGERANGE>(range);
}
-inline CPDF_Array* CPDFArrayFromFPDFPageRange(FPDF_PAGERANGE range) {
- return reinterpret_cast<CPDF_Array*>(range);
+inline const CPDF_Array* CPDFArrayFromFPDFPageRange(FPDF_PAGERANGE range) {
+ return reinterpret_cast<const CPDF_Array*>(range);
}
inline FPDF_PATHSEGMENT FPDFPathSegmentFromFXPathPoint(
diff --git a/public/fpdfview.h b/public/fpdfview.h
index 4ce6f6a..3472f58 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -69,7 +69,7 @@
typedef struct fpdf_pagelink_t__* FPDF_PAGELINK;
typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT; // (text, path, etc.)
typedef struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK;
-typedef struct fpdf_pagerange_t__* FPDF_PAGERANGE;
+typedef const struct fpdf_pagerange_t__* FPDF_PAGERANGE;
typedef const struct fpdf_pathsegment_t* FPDF_PATHSEGMENT;
typedef void* FPDF_RECORDER; // Passed into skia.
typedef struct fpdf_schhandle_t__* FPDF_SCHHANDLE;