From 71a4e66d99306f3708b6fbeb845f9c784c9ea990 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sun, 19 May 2024 14:09:09 +0100 Subject: [PATCH] Update README-maintainer with wip / modernize qpdf --- README-maintainer.md | 10 ++++++++++ TODO.md | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/README-maintainer.md b/README-maintainer.md index e6db10ad..ea619961 100644 --- a/README-maintainer.md +++ b/README-maintainer.md @@ -285,6 +285,16 @@ Building docs from pull requests is also enabled. * Avoid attaching too much metadata to objects and object handles since those have to get copied around a lot. +* Prefer std::string_view to std::string const& and char const*. + + * Where functions rely on strings being null-terminated, std::string_view may not be appropriate. + + * For return values, consider whether returning a string_view is safe or whether it is more appropriate + to return a std::string or std::string const&, especially in the public API. + + * NEVER replace a std::string const& return value with std::string_view in the public API. + + ## ZLIB COMPATIBILITY The qpdf test suite is designed to be independent of the output of any diff --git a/TODO.md b/TODO.md index fdaf5ec9..538f9674 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,7 @@ Contents ======== - [Always](#always) +- [In Progress](#in-progress) - [Next](#next) - [Possible future JSON enhancements](#possible-future-json-enhancements) - [QPDFJob](#qpdfjob) @@ -26,6 +27,28 @@ Always * When close to release, make sure external-libs is building and follow instructions in ../external-libs/README +In Progress +=========== + +Modernize qpdf +-------------- + +Update code to make use of the facilities provided by C++17. In particular, replace early qpdf C-style code +with modern equivalent. Key updates are: + +* use the standard library where appropriate +* replace C-strings with std::string or std::string_view +* replace raw pointer with smart pointers or standard library containers +* replace std::string const& with std::string_view where appropriate +* replace std::shared_ptr with std::unique_ptr or references to the underlying object where appropriate + +Next steps are: + +* review function signatures in the public API +* replace code that uses QUtil::make_shared_cstr etc + +Except for the above, prefer to make modernization changes as part of other updates. + Next ====