Commit 88891a75a231a108dca2628f06c16b62c58e4311
1 parent
e48bfce9
QPDFJob: convert Under/Overlay ranges to strings
Showing
2 changed files
with
9 additions
and
8 deletions
include/qpdf/QPDFJob.hh
| ... | ... | @@ -159,9 +159,9 @@ class QPDFJob |
| 159 | 159 | std::string which; |
| 160 | 160 | char const* filename; |
| 161 | 161 | char const* password; |
| 162 | - char const* to_nr; | |
| 163 | - char const* from_nr; | |
| 164 | - char const* repeat_nr; | |
| 162 | + std::string to_nr; | |
| 163 | + std::string from_nr; | |
| 164 | + std::string repeat_nr; | |
| 165 | 165 | std::shared_ptr<QPDF> pdf; |
| 166 | 166 | std::vector<int> to_pagenos; |
| 167 | 167 | std::vector<int> from_pagenos; | ... | ... |
libqpdf/QPDFJob.cc
| ... | ... | @@ -1945,7 +1945,7 @@ QPDFJob::validateUnderOverlay(QPDF& pdf, QPDFJob::UnderOverlay* uo) |
| 1945 | 1945 | int uo_npages = QIntC::to_int(uo_pdh.getAllPages().size()); |
| 1946 | 1946 | try |
| 1947 | 1947 | { |
| 1948 | - uo->to_pagenos = QUtil::parse_numrange(uo->to_nr, main_npages); | |
| 1948 | + uo->to_pagenos = QUtil::parse_numrange(uo->to_nr.c_str(), main_npages); | |
| 1949 | 1949 | } |
| 1950 | 1950 | catch (std::runtime_error& e) |
| 1951 | 1951 | { |
| ... | ... | @@ -1955,16 +1955,17 @@ QPDFJob::validateUnderOverlay(QPDF& pdf, QPDFJob::UnderOverlay* uo) |
| 1955 | 1955 | } |
| 1956 | 1956 | try |
| 1957 | 1957 | { |
| 1958 | - if (0 == strlen(uo->from_nr)) | |
| 1958 | + if (uo->from_nr.empty()) | |
| 1959 | 1959 | { |
| 1960 | 1960 | QTC::TC("qpdf", "qpdf from_nr from repeat_nr"); |
| 1961 | 1961 | uo->from_nr = uo->repeat_nr; |
| 1962 | 1962 | } |
| 1963 | - uo->from_pagenos = QUtil::parse_numrange(uo->from_nr, uo_npages); | |
| 1964 | - if (strlen(uo->repeat_nr)) | |
| 1963 | + uo->from_pagenos = | |
| 1964 | + QUtil::parse_numrange(uo->from_nr.c_str(), uo_npages); | |
| 1965 | + if (! uo->repeat_nr.empty()) | |
| 1965 | 1966 | { |
| 1966 | 1967 | uo->repeat_pagenos = |
| 1967 | - QUtil::parse_numrange(uo->repeat_nr, uo_npages); | |
| 1968 | + QUtil::parse_numrange(uo->repeat_nr.c_str(), uo_npages); | |
| 1968 | 1969 | } |
| 1969 | 1970 | } |
| 1970 | 1971 | catch (std::runtime_error& e) | ... | ... |