Skip to content

Commit 5d7001a

Browse files
andiwandclaude
andcommitted
PDF: const-qualify by-value scalar params in definitions
Align pdf_page_extractor and pdf_document_parser with the module's prevailing convention (const on by-value scalar definition params). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uqx1dUpDUykRxui8FYwxvM
1 parent 2de4b5f commit 5d7001a

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/odr/internal/pdf/pdf_document_parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ Resources *parse_resources(State &state, const Object &object);
528528
/// Read an integer image-dictionary entry (e.g. `/Width`), resolving an
529529
/// indirect reference, defaulting to `fallback`.
530530
std::int32_t image_int(DocumentParser &parser, const Dictionary &dictionary,
531-
const std::string &key, std::int32_t fallback) {
531+
const std::string &key, const std::int32_t fallback) {
532532
return static_cast<std::int32_t>(
533533
parser.resolve_object_copy(dictionary.get(key))
534534
.as_integer_opt()
@@ -557,9 +557,9 @@ std::vector<double> image_decode(DocumentParser &parser,
557557
/// the base image stays opaque.
558558
std::vector<std::uint8_t> resolve_mask_alpha(DocumentParser &parser,
559559
const Object &mask,
560-
std::int32_t base_width,
561-
std::int32_t base_height,
562-
bool stencil) {
560+
const std::int32_t base_width,
561+
const std::int32_t base_height,
562+
const bool stencil) {
563563
if (!mask.is_reference()) {
564564
return {};
565565
}

src/odr/internal/pdf/pdf_page_extractor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Font *lookup_font(const Resources &resources, const std::string &name,
3939
/// diacritic block (0x18–0x1F), the typographic block (0x80–0x9E), and the
4040
/// euro (0xA0) need overriding; every other byte stands for the code point of
4141
/// the same value. The few undefined slots (0x7F, 0x9F, 0xAD) pass through.
42-
char32_t pdf_doc_encoding_to_unicode(std::uint8_t byte) {
42+
char32_t pdf_doc_encoding_to_unicode(const std::uint8_t byte) {
4343
switch (byte) {
4444
case 0x18:
4545
return U'˘'; // breve
@@ -404,8 +404,9 @@ std::array<double, 3> color_to_rgb(const GraphicsState::Color &color) {
404404
/// Emit a path-painting element from the path accumulated in `state` and the
405405
/// current paint state, then clear the path (as every painting operator does).
406406
/// `close` first closes the current subpath (the `s`/`b`/`b*` variants).
407-
void paint_path(std::vector<PageElement> &out, GraphicsState &state, bool fill,
408-
bool stroke, bool even_odd, bool close) {
407+
void paint_path(std::vector<PageElement> &out, GraphicsState &state,
408+
const bool fill, const bool stroke, const bool even_odd,
409+
const bool close) {
409410
if (close) {
410411
state.path_close();
411412
}

0 commit comments

Comments
 (0)