Commit ae17402c52a3a04ae173d6fe5a6e383d5115c88a

Authored by Jay Berkenbilt
1 parent a5314189

Move default values to constexpr

This was mainly to get comments about defaults out of constructor
initializer lists where their fragile when a code formatter is being
used.
Showing 1 changed file with 12 additions and 5 deletions
libqpdf/QPDFJob.cc
... ... @@ -335,6 +335,13 @@ ProgressReporter::reportProgress(int percentage)
335 335 << percentage << "%" << std::endl;
336 336 }
337 337  
  338 +// These default values are duplicated in help and docs.
  339 +static int constexpr DEFAULT_KEEP_FILES_OPEN_THRESHOLD = 200;
  340 +static int constexpr DEFAULT_OI_MIN_WIDTH = 128;
  341 +static int constexpr DEFAULT_OI_MIN_HEIGHT = 128;
  342 +static int constexpr DEFAULT_OI_MIN_AREA = 16384;
  343 +static int constexpr DEFAULT_II_MIN_BYTES = 1024;
  344 +
338 345 QPDFJob::Members::Members() :
339 346 message_prefix("qpdf"),
340 347 warnings(false),
... ... @@ -393,7 +400,7 @@ QPDFJob::Members::Members() :
393 400 remove_unreferenced_page_resources(re_auto),
394 401 keep_files_open(true),
395 402 keep_files_open_set(false),
396   - keep_files_open_threshold(200), // default known in help and docs
  403 + keep_files_open_threshold(DEFAULT_KEEP_FILES_OPEN_THRESHOLD),
397 404 newline_before_endstream(false),
398 405 coalesce_contents(false),
399 406 flatten_annotations(false),
... ... @@ -426,10 +433,10 @@ QPDFJob::Members::Members() :
426 433 externalize_inline_images(false),
427 434 keep_inline_images(false),
428 435 remove_page_labels(false),
429   - oi_min_width(128), // Default values for these
430   - oi_min_height(128), // oi and ii flags are in --help
431   - oi_min_area(16384), // and in the manual.
432   - ii_min_bytes(1024), //
  436 + oi_min_width(DEFAULT_OI_MIN_WIDTH),
  437 + oi_min_height(DEFAULT_OI_MIN_HEIGHT),
  438 + oi_min_area(DEFAULT_OI_MIN_AREA),
  439 + ii_min_bytes(DEFAULT_II_MIN_BYTES),
433 440 underlay("underlay"),
434 441 overlay("overlay"),
435 442 under_overlay(0),
... ...