From 30027481f7f9e9191f7c8deea51850b7a76b1b1f Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 23 Feb 2013 21:46:21 -0500 Subject: Remove all old-style casts from C++ code --- include/qpdf/QPDF.hh | 2 +- include/qpdf/QUtil.hh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index eab64072..a1644f84 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -931,7 +931,7 @@ class QPDF void readHPageOffset(BitStream); void readHSharedObject(BitStream); void readHGeneric(BitStream, HGeneric&); - int maxEnd(ObjUser const& ou); + qpdf_offset_t maxEnd(ObjUser const& ou); qpdf_offset_t getLinearizationOffset(ObjGen const&); QPDFObjectHandle getUncompressedObject( QPDFObjectHandle&, std::map const& object_stream_data); diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 9639917d..5b71a362 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -27,6 +27,17 @@ namespace QUtil QPDF_DLL long long string_to_ll(char const* str); + // Pipeline's write method wants unsigned char*, but we often have + // some other type of string. These methods do combinations of + // const_cast and reinterpret_cast to give us an unsigned char*. + // They should only be used when it is known that it is safe. + // None of the pipelines in qpdf modify the data passed to them, + // so within qpdf, it should always be safe. + QPDF_DLL + unsigned char* unsigned_char_pointer(std::string const& str); + QPDF_DLL + unsigned char* unsigned_char_pointer(char const* str); + // Throw std::runtime_error with a string formed by appending to // "description: " the standard string corresponding to the // current value of errno. -- cgit v1.2.3-54-g00ecf