Commit 98c0b42096953060b3d1f27a896a5e317b2990bc
1 parent
183e4407
Remove unnecessary `this->` qualifiers for cleaner code
Refactor code to eliminate redundant `this->` qualifiers, enhancing readability and consistency across the codebase. This modification simplifies member variable access and aligns with modern C++ coding practices.
Showing
4 changed files
with
137 additions
and
138 deletions
libqpdf/Pl_Flate.cc
| ... | ... | @@ -29,7 +29,7 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : |
| 29 | 29 | // Indirect through zdata to reach the z_stream so we don't have to include zlib.h in |
| 30 | 30 | // Pl_Flate.hh. This means people using shared library versions of qpdf don't have to have zlib |
| 31 | 31 | // development files available, which particularly helps in a Windows environment. |
| 32 | - this->zdata = new z_stream; | |
| 32 | + zdata = new z_stream; | |
| 33 | 33 | |
| 34 | 34 | if (out_bufsize > UINT_MAX) { |
| 35 | 35 | throw std::runtime_error( |
| ... | ... | @@ -52,8 +52,8 @@ Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : |
| 52 | 52 | |
| 53 | 53 | Pl_Flate::Members::~Members() |
| 54 | 54 | { |
| 55 | - if (this->initialized) { | |
| 56 | - z_stream& zstream = *(static_cast<z_stream*>(this->zdata)); | |
| 55 | + if (initialized) { | |
| 56 | + z_stream& zstream = *(static_cast<z_stream*>(zdata)); | |
| 57 | 57 | if (action == a_deflate) { |
| 58 | 58 | deflateEnd(&zstream); |
| 59 | 59 | } else { |
| ... | ... | @@ -62,7 +62,7 @@ Pl_Flate::Members::~Members() |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | delete static_cast<z_stream*>(this->zdata); |
| 65 | - this->zdata = nullptr; | |
| 65 | + zdata = nullptr; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | Pl_Flate::Pl_Flate( |
| ... | ... | @@ -99,7 +99,7 @@ Pl_Flate::setWarnCallback(std::function<void(char const*, int)> callback) |
| 99 | 99 | void |
| 100 | 100 | Pl_Flate::warn(char const* msg, int code) |
| 101 | 101 | { |
| 102 | - if (m->callback != nullptr) { | |
| 102 | + if (m->callback) { | |
| 103 | 103 | m->callback(msg, code); |
| 104 | 104 | } |
| 105 | 105 | } |
| ... | ... | @@ -107,7 +107,7 @@ Pl_Flate::warn(char const* msg, int code) |
| 107 | 107 | void |
| 108 | 108 | Pl_Flate::write(unsigned char const* data, size_t len) |
| 109 | 109 | { |
| 110 | - if (m->outbuf == nullptr) { | |
| 110 | + if (!m->outbuf) { | |
| 111 | 111 | throw std::logic_error( |
| 112 | 112 | this->identifier + ": Pl_Flate: write() called after finish() called"); |
| 113 | 113 | } |
| ... | ... | @@ -184,7 +184,7 @@ Pl_Flate::handleData(unsigned char const* data, size_t len, int flush) |
| 184 | 184 | // this error (including at least one in qpdf's test suite). In some cases, we want to |
| 185 | 185 | // know about this, because it indicates incorrect compression, so call a callback if |
| 186 | 186 | // provided. |
| 187 | - this->warn("input stream is complete but output may still be valid", err); | |
| 187 | + warn("input stream is complete but output may still be valid", err); | |
| 188 | 188 | done = true; |
| 189 | 189 | break; |
| 190 | 190 | |
| ... | ... | @@ -215,7 +215,7 @@ Pl_Flate::handleData(unsigned char const* data, size_t len, int flush) |
| 215 | 215 | break; |
| 216 | 216 | |
| 217 | 217 | default: |
| 218 | - this->checkError("data", err); | |
| 218 | + checkError("data", err); | |
| 219 | 219 | break; |
| 220 | 220 | } |
| 221 | 221 | } |
| ... | ... | @@ -271,7 +271,7 @@ Pl_Flate::checkError(char const* prefix, int error_code) |
| 271 | 271 | z_stream& zstream = *(static_cast<z_stream*>(m->zdata)); |
| 272 | 272 | if (error_code != Z_OK) { |
| 273 | 273 | char const* action_str = (m->action == a_deflate ? "deflate" : "inflate"); |
| 274 | - std::string msg = this->identifier + ": " + action_str + ": " + prefix + ": "; | |
| 274 | + std::string msg = identifier + ": " + action_str + ": " + prefix + ": "; | |
| 275 | 275 | |
| 276 | 276 | if (zstream.msg) { |
| 277 | 277 | msg += zstream.msg; | ... | ... |
libqpdf/Pl_PNGFilter.cc
| ... | ... | @@ -39,7 +39,7 @@ Pl_PNGFilter::Pl_PNGFilter( |
| 39 | 39 | throw std::runtime_error( |
| 40 | 40 | "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16"); |
| 41 | 41 | } |
| 42 | - this->bytes_per_pixel = ((bits_per_sample * samples_per_pixel) + 7) / 8; | |
| 42 | + bytes_per_pixel = ((bits_per_sample * samples_per_pixel) + 7) / 8; | |
| 43 | 43 | unsigned long long bpr = ((columns * bits_per_sample * samples_per_pixel) + 7) / 8; |
| 44 | 44 | if ((bpr == 0) || (bpr > (UINT_MAX - 1))) { |
| 45 | 45 | throw std::runtime_error("PNGFilter created with invalid columns value"); |
| ... | ... | @@ -47,16 +47,16 @@ Pl_PNGFilter::Pl_PNGFilter( |
| 47 | 47 | if (memory_limit > 0 && bpr > (memory_limit / 2U)) { |
| 48 | 48 | throw std::runtime_error("PNGFilter memory limit exceeded"); |
| 49 | 49 | } |
| 50 | - this->bytes_per_row = bpr & UINT_MAX; | |
| 51 | - this->buf1 = QUtil::make_shared_array<unsigned char>(this->bytes_per_row + 1); | |
| 52 | - this->buf2 = QUtil::make_shared_array<unsigned char>(this->bytes_per_row + 1); | |
| 53 | - memset(this->buf1.get(), 0, this->bytes_per_row + 1); | |
| 54 | - memset(this->buf2.get(), 0, this->bytes_per_row + 1); | |
| 55 | - this->cur_row = this->buf1.get(); | |
| 56 | - this->prev_row = this->buf2.get(); | |
| 50 | + bytes_per_row = bpr & UINT_MAX; | |
| 51 | + buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1); | |
| 52 | + buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1); | |
| 53 | + memset(buf1.get(), 0, bytes_per_row + 1); | |
| 54 | + memset(buf2.get(), 0, bytes_per_row + 1); | |
| 55 | + cur_row = buf1.get(); | |
| 56 | + prev_row = buf2.get(); | |
| 57 | 57 | |
| 58 | 58 | // number of bytes per incoming row |
| 59 | - this->incoming = (action == a_encode ? this->bytes_per_row : this->bytes_per_row + 1); | |
| 59 | + incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | void |
| ... | ... | @@ -68,34 +68,34 @@ Pl_PNGFilter::setMemoryLimit(unsigned long long limit) |
| 68 | 68 | void |
| 69 | 69 | Pl_PNGFilter::write(unsigned char const* data, size_t len) |
| 70 | 70 | { |
| 71 | - size_t left = this->incoming - this->pos; | |
| 71 | + size_t left = incoming - pos; | |
| 72 | 72 | size_t offset = 0; |
| 73 | 73 | while (len >= left) { |
| 74 | 74 | // finish off current row |
| 75 | - memcpy(this->cur_row + this->pos, data + offset, left); | |
| 75 | + memcpy(cur_row + pos, data + offset, left); | |
| 76 | 76 | offset += left; |
| 77 | 77 | len -= left; |
| 78 | 78 | |
| 79 | 79 | processRow(); |
| 80 | 80 | |
| 81 | 81 | // Swap rows |
| 82 | - unsigned char* t = this->prev_row; | |
| 83 | - this->prev_row = this->cur_row; | |
| 84 | - this->cur_row = t ? t : this->buf2.get(); | |
| 85 | - memset(this->cur_row, 0, this->bytes_per_row + 1); | |
| 86 | - left = this->incoming; | |
| 87 | - this->pos = 0; | |
| 82 | + unsigned char* t = prev_row; | |
| 83 | + prev_row = cur_row; | |
| 84 | + cur_row = t ? t : buf2.get(); | |
| 85 | + memset(cur_row, 0, bytes_per_row + 1); | |
| 86 | + left = incoming; | |
| 87 | + pos = 0; | |
| 88 | 88 | } |
| 89 | 89 | if (len) { |
| 90 | - memcpy(this->cur_row + this->pos, data + offset, len); | |
| 90 | + memcpy(cur_row + pos, data + offset, len); | |
| 91 | 91 | } |
| 92 | - this->pos += len; | |
| 92 | + pos += len; | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | void |
| 96 | 96 | Pl_PNGFilter::processRow() |
| 97 | 97 | { |
| 98 | - if (this->action == a_encode) { | |
| 98 | + if (action == a_encode) { | |
| 99 | 99 | encodeRow(); |
| 100 | 100 | } else { |
| 101 | 101 | decodeRow(); |
| ... | ... | @@ -105,22 +105,22 @@ Pl_PNGFilter::processRow() |
| 105 | 105 | void |
| 106 | 106 | Pl_PNGFilter::decodeRow() |
| 107 | 107 | { |
| 108 | - int filter = this->cur_row[0]; | |
| 109 | - if (this->prev_row) { | |
| 108 | + int filter = cur_row[0]; | |
| 109 | + if (prev_row) { | |
| 110 | 110 | switch (filter) { |
| 111 | 111 | case 0: |
| 112 | 112 | break; |
| 113 | 113 | case 1: |
| 114 | - this->decodeSub(); | |
| 114 | + decodeSub(); | |
| 115 | 115 | break; |
| 116 | 116 | case 2: |
| 117 | - this->decodeUp(); | |
| 117 | + decodeUp(); | |
| 118 | 118 | break; |
| 119 | 119 | case 3: |
| 120 | - this->decodeAverage(); | |
| 120 | + decodeAverage(); | |
| 121 | 121 | break; |
| 122 | 122 | case 4: |
| 123 | - this->decodePaeth(); | |
| 123 | + decodePaeth(); | |
| 124 | 124 | break; |
| 125 | 125 | default: |
| 126 | 126 | // ignore |
| ... | ... | @@ -128,17 +128,17 @@ Pl_PNGFilter::decodeRow() |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - next()->write(this->cur_row + 1, this->bytes_per_row); | |
| 131 | + next()->write(cur_row + 1, bytes_per_row); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | void |
| 135 | 135 | Pl_PNGFilter::decodeSub() |
| 136 | 136 | { |
| 137 | 137 | QTC::TC("libtests", "Pl_PNGFilter decodeSub"); |
| 138 | - unsigned char* buffer = this->cur_row + 1; | |
| 139 | - unsigned int bpp = this->bytes_per_pixel; | |
| 138 | + unsigned char* buffer = cur_row + 1; | |
| 139 | + unsigned int bpp = bytes_per_pixel; | |
| 140 | 140 | |
| 141 | - for (unsigned int i = 0; i < this->bytes_per_row; ++i) { | |
| 141 | + for (unsigned int i = 0; i < bytes_per_row; ++i) { | |
| 142 | 142 | unsigned char left = 0; |
| 143 | 143 | |
| 144 | 144 | if (i >= bpp) { |
| ... | ... | @@ -153,10 +153,10 @@ void |
| 153 | 153 | Pl_PNGFilter::decodeUp() |
| 154 | 154 | { |
| 155 | 155 | QTC::TC("libtests", "Pl_PNGFilter decodeUp"); |
| 156 | - unsigned char* buffer = this->cur_row + 1; | |
| 157 | - unsigned char* above_buffer = this->prev_row + 1; | |
| 156 | + unsigned char* buffer = cur_row + 1; | |
| 157 | + unsigned char* above_buffer = prev_row + 1; | |
| 158 | 158 | |
| 159 | - for (unsigned int i = 0; i < this->bytes_per_row; ++i) { | |
| 159 | + for (unsigned int i = 0; i < bytes_per_row; ++i) { | |
| 160 | 160 | unsigned char up = above_buffer[i]; |
| 161 | 161 | buffer[i] = static_cast<unsigned char>(buffer[i] + up); |
| 162 | 162 | } |
| ... | ... | @@ -166,11 +166,11 @@ void |
| 166 | 166 | Pl_PNGFilter::decodeAverage() |
| 167 | 167 | { |
| 168 | 168 | QTC::TC("libtests", "Pl_PNGFilter decodeAverage"); |
| 169 | - unsigned char* buffer = this->cur_row + 1; | |
| 170 | - unsigned char* above_buffer = this->prev_row + 1; | |
| 171 | - unsigned int bpp = this->bytes_per_pixel; | |
| 169 | + unsigned char* buffer = cur_row + 1; | |
| 170 | + unsigned char* above_buffer = prev_row + 1; | |
| 171 | + unsigned int bpp = bytes_per_pixel; | |
| 172 | 172 | |
| 173 | - for (unsigned int i = 0; i < this->bytes_per_row; ++i) { | |
| 173 | + for (unsigned int i = 0; i < bytes_per_row; ++i) { | |
| 174 | 174 | int left = 0; |
| 175 | 175 | int up = 0; |
| 176 | 176 | |
| ... | ... | @@ -187,11 +187,11 @@ void |
| 187 | 187 | Pl_PNGFilter::decodePaeth() |
| 188 | 188 | { |
| 189 | 189 | QTC::TC("libtests", "Pl_PNGFilter decodePaeth"); |
| 190 | - unsigned char* buffer = this->cur_row + 1; | |
| 191 | - unsigned char* above_buffer = this->prev_row + 1; | |
| 192 | - unsigned int bpp = this->bytes_per_pixel; | |
| 190 | + unsigned char* buffer = cur_row + 1; | |
| 191 | + unsigned char* above_buffer = prev_row + 1; | |
| 192 | + unsigned int bpp = bytes_per_pixel; | |
| 193 | 193 | |
| 194 | - for (unsigned int i = 0; i < this->bytes_per_row; ++i) { | |
| 194 | + for (unsigned int i = 0; i < bytes_per_row; ++i) { | |
| 195 | 195 | int left = 0; |
| 196 | 196 | int up = above_buffer[i]; |
| 197 | 197 | int upper_left = 0; |
| ... | ... | @@ -201,8 +201,7 @@ Pl_PNGFilter::decodePaeth() |
| 201 | 201 | upper_left = above_buffer[i - bpp]; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - buffer[i] = | |
| 205 | - static_cast<unsigned char>(buffer[i] + this->PaethPredictor(left, up, upper_left)); | |
| 204 | + buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left)); | |
| 206 | 205 | } |
| 207 | 206 | } |
| 208 | 207 | |
| ... | ... | @@ -229,27 +228,27 @@ Pl_PNGFilter::encodeRow() |
| 229 | 228 | // For now, hard-code to using UP filter. |
| 230 | 229 | unsigned char ch = 2; |
| 231 | 230 | next()->write(&ch, 1); |
| 232 | - if (this->prev_row) { | |
| 233 | - for (unsigned int i = 0; i < this->bytes_per_row; ++i) { | |
| 234 | - ch = static_cast<unsigned char>(this->cur_row[i] - this->prev_row[i]); | |
| 231 | + if (prev_row) { | |
| 232 | + for (unsigned int i = 0; i < bytes_per_row; ++i) { | |
| 233 | + ch = static_cast<unsigned char>(cur_row[i] - prev_row[i]); | |
| 235 | 234 | next()->write(&ch, 1); |
| 236 | 235 | } |
| 237 | 236 | } else { |
| 238 | - next()->write(this->cur_row, this->bytes_per_row); | |
| 237 | + next()->write(cur_row, bytes_per_row); | |
| 239 | 238 | } |
| 240 | 239 | } |
| 241 | 240 | |
| 242 | 241 | void |
| 243 | 242 | Pl_PNGFilter::finish() |
| 244 | 243 | { |
| 245 | - if (this->pos) { | |
| 244 | + if (pos) { | |
| 246 | 245 | // write partial row |
| 247 | 246 | processRow(); |
| 248 | 247 | } |
| 249 | - this->prev_row = nullptr; | |
| 250 | - this->cur_row = buf1.get(); | |
| 251 | - this->pos = 0; | |
| 252 | - memset(this->cur_row, 0, this->bytes_per_row + 1); | |
| 248 | + prev_row = nullptr; | |
| 249 | + cur_row = buf1.get(); | |
| 250 | + pos = 0; | |
| 251 | + memset(cur_row, 0, bytes_per_row + 1); | |
| 253 | 252 | |
| 254 | 253 | next()->finish(); |
| 255 | 254 | } | ... | ... |
libqpdf/QPDFJob_argv.cc
| ... | ... | @@ -58,25 +58,25 @@ void |
| 58 | 58 | ArgParser::initOptionTables() |
| 59 | 59 | { |
| 60 | 60 | #include <qpdf/auto_job_init.hh> |
| 61 | - this->ap.addFinalCheck([this]() { c_main->checkConfiguration(); }); | |
| 61 | + ap.addFinalCheck([this]() { c_main->checkConfiguration(); }); | |
| 62 | 62 | // add_help is defined in auto_job_help.hh |
| 63 | - add_help(this->ap); | |
| 63 | + add_help(ap); | |
| 64 | 64 | // Special case: ignore -- at the top level. This undocumented behavior is for backward |
| 65 | 65 | // compatibility; it was unintentionally the case prior to 10.6, and some users were relying on |
| 66 | 66 | // it. |
| 67 | - this->ap.selectMainOptionTable(); | |
| 68 | - this->ap.addBare("--", []() {}); | |
| 67 | + ap.selectMainOptionTable(); | |
| 68 | + ap.addBare("--", []() {}); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | void |
| 72 | 72 | ArgParser::argPositional(std::string const& arg) |
| 73 | 73 | { |
| 74 | - if (!this->gave_input) { | |
| 74 | + if (!gave_input) { | |
| 75 | 75 | c_main->inputFile(arg); |
| 76 | - this->gave_input = true; | |
| 77 | - } else if (!this->gave_output) { | |
| 76 | + gave_input = true; | |
| 77 | + } else if (!gave_output) { | |
| 78 | 78 | c_main->outputFile(arg); |
| 79 | - this->gave_output = true; | |
| 79 | + gave_output = true; | |
| 80 | 80 | } else { |
| 81 | 81 | usage("unknown argument " + arg); |
| 82 | 82 | } |
| ... | ... | @@ -86,20 +86,20 @@ void |
| 86 | 86 | ArgParser::argEmpty() |
| 87 | 87 | { |
| 88 | 88 | c_main->emptyInput(); |
| 89 | - this->gave_input = true; | |
| 89 | + gave_input = true; | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | void |
| 93 | 93 | ArgParser::argReplaceInput() |
| 94 | 94 | { |
| 95 | 95 | c_main->replaceInput(); |
| 96 | - this->gave_output = true; | |
| 96 | + gave_output = true; | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | void |
| 100 | 100 | ArgParser::argVersion() |
| 101 | 101 | { |
| 102 | - auto whoami = this->ap.getProgname(); | |
| 102 | + auto whoami = ap.getProgname(); | |
| 103 | 103 | *QPDFLogger::defaultLogger()->getInfo() |
| 104 | 104 | << whoami << " version " << QPDF::QPDFVersion() << "\n" |
| 105 | 105 | << "Run " << whoami << " --copyright to see copyright and license information.\n"; |
| ... | ... | @@ -136,7 +136,7 @@ ArgParser::argCopyright() |
| 136 | 136 | // 1 2 3 4 5 6 7 8 |
| 137 | 137 | // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 138 | 138 | *QPDFLogger::defaultLogger()->getInfo() |
| 139 | - << this->ap.getProgname() | |
| 139 | + << ap.getProgname() | |
| 140 | 140 | << " version " << QPDF::QPDFVersion() << "\n" |
| 141 | 141 | << "\n" |
| 142 | 142 | << "Copyright (c) 2005-2021 Jay Berkenbilt\n" |
| ... | ... | @@ -190,9 +190,9 @@ ArgParser::argShowCrypto() |
| 190 | 190 | void |
| 191 | 191 | ArgParser::argEncrypt() |
| 192 | 192 | { |
| 193 | - this->c_enc = c_main->encrypt(0, "", ""); | |
| 194 | - this->accumulated_args.clear(); | |
| 195 | - this->ap.selectOptionTable(O_ENCRYPTION); | |
| 193 | + c_enc = c_main->encrypt(0, "", ""); | |
| 194 | + accumulated_args.clear(); | |
| 195 | + ap.selectOptionTable(O_ENCRYPTION); | |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | void |
| ... | ... | @@ -202,14 +202,14 @@ ArgParser::argEncPositional(std::string const& arg) |
| 202 | 202 | usage("positional and dashed encryption arguments may not be mixed"); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - this->accumulated_args.push_back(arg); | |
| 206 | - if (this->accumulated_args.size() < 3) { | |
| 205 | + accumulated_args.push_back(arg); | |
| 206 | + if (accumulated_args.size() < 3) { | |
| 207 | 207 | return; |
| 208 | 208 | } |
| 209 | - user_password = this->accumulated_args.at(0); | |
| 210 | - owner_password = this->accumulated_args.at(1); | |
| 211 | - auto len_str = this->accumulated_args.at(2); | |
| 212 | - this->accumulated_args.clear(); | |
| 209 | + user_password = accumulated_args.at(0); | |
| 210 | + owner_password = accumulated_args.at(1); | |
| 211 | + auto len_str = accumulated_args.at(2); | |
| 212 | + accumulated_args.clear(); | |
| 213 | 213 | argEncBits(len_str); |
| 214 | 214 | } |
| 215 | 215 | |
| ... | ... | @@ -219,8 +219,8 @@ ArgParser::argEncUserPassword(std::string const& arg) |
| 219 | 219 | if (!accumulated_args.empty()) { |
| 220 | 220 | usage("positional and dashed encryption arguments may not be mixed"); |
| 221 | 221 | } |
| 222 | - this->used_enc_password_args = true; | |
| 223 | - this->user_password = arg; | |
| 222 | + used_enc_password_args = true; | |
| 223 | + user_password = arg; | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | void |
| ... | ... | @@ -229,8 +229,8 @@ ArgParser::argEncOwnerPassword(std::string const& arg) |
| 229 | 229 | if (!accumulated_args.empty()) { |
| 230 | 230 | usage("positional and dashed encryption arguments may not be mixed"); |
| 231 | 231 | } |
| 232 | - this->used_enc_password_args = true; | |
| 233 | - this->owner_password = arg; | |
| 232 | + used_enc_password_args = true; | |
| 233 | + owner_password = arg; | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | void |
| ... | ... | @@ -242,25 +242,25 @@ ArgParser::argEncBits(std::string const& arg) |
| 242 | 242 | int keylen = 0; |
| 243 | 243 | if (arg == "40") { |
| 244 | 244 | keylen = 40; |
| 245 | - this->ap.selectOptionTable(O_40_BIT_ENCRYPTION); | |
| 245 | + ap.selectOptionTable(O_40_BIT_ENCRYPTION); | |
| 246 | 246 | } else if (arg == "128") { |
| 247 | 247 | keylen = 128; |
| 248 | - this->ap.selectOptionTable(O_128_BIT_ENCRYPTION); | |
| 248 | + ap.selectOptionTable(O_128_BIT_ENCRYPTION); | |
| 249 | 249 | } else if (arg == "256") { |
| 250 | 250 | keylen = 256; |
| 251 | - this->ap.selectOptionTable(O_256_BIT_ENCRYPTION); | |
| 251 | + ap.selectOptionTable(O_256_BIT_ENCRYPTION); | |
| 252 | 252 | } else { |
| 253 | 253 | usage("encryption key length must be 40, 128, or 256"); |
| 254 | 254 | } |
| 255 | - this->c_enc = c_main->encrypt(keylen, user_password, owner_password); | |
| 255 | + c_enc = c_main->encrypt(keylen, user_password, owner_password); | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | void |
| 259 | 259 | ArgParser::argPages() |
| 260 | 260 | { |
| 261 | - this->accumulated_args.clear(); | |
| 262 | - this->c_pages = c_main->pages(); | |
| 263 | - this->ap.selectOptionTable(O_PAGES); | |
| 261 | + accumulated_args.clear(); | |
| 262 | + c_pages = c_main->pages(); | |
| 263 | + ap.selectOptionTable(O_PAGES); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | void |
| ... | ... | @@ -308,29 +308,29 @@ ArgParser::argEndPages() |
| 308 | 308 | void |
| 309 | 309 | ArgParser::argUnderlay() |
| 310 | 310 | { |
| 311 | - this->c_uo = c_main->underlay(); | |
| 312 | - this->ap.selectOptionTable(O_UNDERLAY_OVERLAY); | |
| 311 | + c_uo = c_main->underlay(); | |
| 312 | + ap.selectOptionTable(O_UNDERLAY_OVERLAY); | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | void |
| 316 | 316 | ArgParser::argOverlay() |
| 317 | 317 | { |
| 318 | - this->c_uo = c_main->overlay(); | |
| 319 | - this->ap.selectOptionTable(O_UNDERLAY_OVERLAY); | |
| 318 | + c_uo = c_main->overlay(); | |
| 319 | + ap.selectOptionTable(O_UNDERLAY_OVERLAY); | |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | void |
| 323 | 323 | ArgParser::argAddAttachment() |
| 324 | 324 | { |
| 325 | - this->c_att = c_main->addAttachment(); | |
| 326 | - this->ap.selectOptionTable(O_ATTACHMENT); | |
| 325 | + c_att = c_main->addAttachment(); | |
| 326 | + ap.selectOptionTable(O_ATTACHMENT); | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | void |
| 330 | 330 | ArgParser::argCopyAttachmentsFrom() |
| 331 | 331 | { |
| 332 | - this->c_copy_att = c_main->copyAttachmentsFrom(); | |
| 333 | - this->ap.selectOptionTable(O_COPY_ATTACHMENT); | |
| 332 | + c_copy_att = c_main->copyAttachmentsFrom(); | |
| 333 | + ap.selectOptionTable(O_COPY_ATTACHMENT); | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | void |
| ... | ... | @@ -400,7 +400,7 @@ ArgParser::argEndCopyAttachment() |
| 400 | 400 | void |
| 401 | 401 | ArgParser::argSetPageLabels() |
| 402 | 402 | { |
| 403 | - this->ap.selectOptionTable(O_SET_PAGE_LABELS); | |
| 403 | + ap.selectOptionTable(O_SET_PAGE_LABELS); | |
| 404 | 404 | accumulated_args.clear(); |
| 405 | 405 | } |
| 406 | 406 | |
| ... | ... | @@ -427,14 +427,14 @@ ArgParser::argJobJsonHelp() |
| 427 | 427 | void |
| 428 | 428 | ArgParser::usage(std::string const& message) |
| 429 | 429 | { |
| 430 | - this->ap.usage(message); | |
| 430 | + ap.usage(message); | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | void |
| 434 | 434 | ArgParser::parseOptions() |
| 435 | 435 | { |
| 436 | 436 | try { |
| 437 | - this->ap.parseArgs(); | |
| 437 | + ap.parseArgs(); | |
| 438 | 438 | } catch (std::runtime_error& e) { |
| 439 | 439 | usage(e.what()); |
| 440 | 440 | } | ... | ... |
libqpdf/QPDFJob_config.cc
| ... | ... | @@ -701,7 +701,7 @@ QPDFJob::Config::passwordFile(std::string const& parameter) |
| 701 | 701 | |
| 702 | 702 | if (lines.size() > 1) { |
| 703 | 703 | *QPDFLogger::defaultLogger()->getError() |
| 704 | - << this->o.m->message_prefix << ": WARNING: all but the first line of" | |
| 704 | + << o.m->message_prefix << ": WARNING: all but the first line of" | |
| 705 | 705 | << " the password file are ignored\n"; |
| 706 | 706 | } |
| 707 | 707 | } |
| ... | ... | @@ -806,7 +806,7 @@ QPDFJob::Config::jobJsonFile(std::string const& parameter) |
| 806 | 806 | } catch (std::exception& e) { |
| 807 | 807 | throw std::runtime_error( |
| 808 | 808 | "error with job-json file " + std::string(parameter) + ": " + e.what() + "\nRun " + |
| 809 | - this->o.m->message_prefix + " --job-json-help for information on the file format."); | |
| 809 | + o.m->message_prefix + " --job-json-help for information on the file format."); | |
| 810 | 810 | } |
| 811 | 811 | return this; |
| 812 | 812 | } |
| ... | ... | @@ -832,32 +832,32 @@ QPDFJob::CopyAttConfig::CopyAttConfig(Config* c) : |
| 832 | 832 | QPDFJob::CopyAttConfig* |
| 833 | 833 | QPDFJob::CopyAttConfig::file(std::string const& parameter) |
| 834 | 834 | { |
| 835 | - this->caf.path = parameter; | |
| 835 | + caf.path = parameter; | |
| 836 | 836 | return this; |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | QPDFJob::CopyAttConfig* |
| 840 | 840 | QPDFJob::CopyAttConfig::prefix(std::string const& parameter) |
| 841 | 841 | { |
| 842 | - this->caf.prefix = parameter; | |
| 842 | + caf.prefix = parameter; | |
| 843 | 843 | return this; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | QPDFJob::CopyAttConfig* |
| 847 | 847 | QPDFJob::CopyAttConfig::password(std::string const& parameter) |
| 848 | 848 | { |
| 849 | - this->caf.password = parameter; | |
| 849 | + caf.password = parameter; | |
| 850 | 850 | return this; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | QPDFJob::Config* |
| 854 | 854 | QPDFJob::CopyAttConfig::endCopyAttachmentsFrom() |
| 855 | 855 | { |
| 856 | - if (this->caf.path.empty()) { | |
| 856 | + if (caf.path.empty()) { | |
| 857 | 857 | usage("copy attachments: no file specified"); |
| 858 | 858 | } |
| 859 | - this->config->o.m->attachments_to_copy.push_back(this->caf); | |
| 860 | - return this->config; | |
| 859 | + config->o.m->attachments_to_copy.push_back(caf); | |
| 860 | + return config; | |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | QPDFJob::AttConfig::AttConfig(Config* c) : |
| ... | ... | @@ -874,21 +874,21 @@ QPDFJob::Config::addAttachment() |
| 874 | 874 | QPDFJob::AttConfig* |
| 875 | 875 | QPDFJob::AttConfig::file(std::string const& parameter) |
| 876 | 876 | { |
| 877 | - this->att.path = parameter; | |
| 877 | + att.path = parameter; | |
| 878 | 878 | return this; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | QPDFJob::AttConfig* |
| 882 | 882 | QPDFJob::AttConfig::key(std::string const& parameter) |
| 883 | 883 | { |
| 884 | - this->att.key = parameter; | |
| 884 | + att.key = parameter; | |
| 885 | 885 | return this; |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | QPDFJob::AttConfig* |
| 889 | 889 | QPDFJob::AttConfig::filename(std::string const& parameter) |
| 890 | 890 | { |
| 891 | - this->att.filename = parameter; | |
| 891 | + att.filename = parameter; | |
| 892 | 892 | return this; |
| 893 | 893 | } |
| 894 | 894 | |
| ... | ... | @@ -898,7 +898,7 @@ QPDFJob::AttConfig::creationdate(std::string const& parameter) |
| 898 | 898 | if (!QUtil::pdf_time_to_qpdf_time(parameter)) { |
| 899 | 899 | usage(std::string(parameter) + " is not a valid PDF timestamp"); |
| 900 | 900 | } |
| 901 | - this->att.creationdate = parameter; | |
| 901 | + att.creationdate = parameter; | |
| 902 | 902 | return this; |
| 903 | 903 | } |
| 904 | 904 | |
| ... | ... | @@ -908,7 +908,7 @@ QPDFJob::AttConfig::moddate(std::string const& parameter) |
| 908 | 908 | if (!QUtil::pdf_time_to_qpdf_time(parameter)) { |
| 909 | 909 | usage(std::string(parameter) + " is not a valid PDF timestamp"); |
| 910 | 910 | } |
| 911 | - this->att.moddate = parameter; | |
| 911 | + att.moddate = parameter; | |
| 912 | 912 | return this; |
| 913 | 913 | } |
| 914 | 914 | |
| ... | ... | @@ -918,21 +918,21 @@ QPDFJob::AttConfig::mimetype(std::string const& parameter) |
| 918 | 918 | if (parameter.find('/') == std::string::npos) { |
| 919 | 919 | usage("mime type should be specified as type/subtype"); |
| 920 | 920 | } |
| 921 | - this->att.mimetype = parameter; | |
| 921 | + att.mimetype = parameter; | |
| 922 | 922 | return this; |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | QPDFJob::AttConfig* |
| 926 | 926 | QPDFJob::AttConfig::description(std::string const& parameter) |
| 927 | 927 | { |
| 928 | - this->att.description = parameter; | |
| 928 | + att.description = parameter; | |
| 929 | 929 | return this; |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | QPDFJob::AttConfig* |
| 933 | 933 | QPDFJob::AttConfig::replace() |
| 934 | 934 | { |
| 935 | - this->att.replace = true; | |
| 935 | + att.replace = true; | |
| 936 | 936 | return this; |
| 937 | 937 | } |
| 938 | 938 | |
| ... | ... | @@ -940,28 +940,28 @@ QPDFJob::Config* |
| 940 | 940 | QPDFJob::AttConfig::endAddAttachment() |
| 941 | 941 | { |
| 942 | 942 | static std::string now = QUtil::qpdf_time_to_pdf_time(QUtil::get_current_qpdf_time()); |
| 943 | - if (this->att.path.empty()) { | |
| 943 | + if (att.path.empty()) { | |
| 944 | 944 | usage("add attachment: no file specified"); |
| 945 | 945 | } |
| 946 | - std::string last_element = QUtil::path_basename(this->att.path); | |
| 946 | + std::string last_element = QUtil::path_basename(att.path); | |
| 947 | 947 | if (last_element.empty()) { |
| 948 | 948 | usage("file for --add-attachment may not be empty"); |
| 949 | 949 | } |
| 950 | - if (this->att.filename.empty()) { | |
| 951 | - this->att.filename = last_element; | |
| 950 | + if (att.filename.empty()) { | |
| 951 | + att.filename = last_element; | |
| 952 | 952 | } |
| 953 | - if (this->att.key.empty()) { | |
| 954 | - this->att.key = last_element; | |
| 953 | + if (att.key.empty()) { | |
| 954 | + att.key = last_element; | |
| 955 | 955 | } |
| 956 | - if (this->att.creationdate.empty()) { | |
| 957 | - this->att.creationdate = now; | |
| 956 | + if (att.creationdate.empty()) { | |
| 957 | + att.creationdate = now; | |
| 958 | 958 | } |
| 959 | - if (this->att.moddate.empty()) { | |
| 960 | - this->att.moddate = now; | |
| 959 | + if (att.moddate.empty()) { | |
| 960 | + att.moddate = now; | |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | - this->config->o.m->attachments_to_add.push_back(this->att); | |
| 964 | - return this->config; | |
| 963 | + config->o.m->attachments_to_add.push_back(att); | |
| 964 | + return config; | |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | QPDFJob::PagesConfig::PagesConfig(Config* c) : |
| ... | ... | @@ -985,21 +985,21 @@ QPDFJob::PagesConfig::endPages() |
| 985 | 985 | if (n_specs == 0) { |
| 986 | 986 | usage("--pages: no page specifications given"); |
| 987 | 987 | } |
| 988 | - return this->config; | |
| 988 | + return config; | |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | QPDFJob::PagesConfig* |
| 992 | 992 | QPDFJob::PagesConfig::pageSpec( |
| 993 | 993 | std::string const& filename, std::string const& range, char const* password) |
| 994 | 994 | { |
| 995 | - this->config->o.m->page_specs.emplace_back(filename, password, range); | |
| 995 | + config->o.m->page_specs.emplace_back(filename, password, range); | |
| 996 | 996 | return this; |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | QPDFJob::PagesConfig* |
| 1000 | 1000 | QPDFJob::PagesConfig::file(std::string const& arg) |
| 1001 | 1001 | { |
| 1002 | - this->config->o.m->page_specs.emplace_back(arg, "", ""); | |
| 1002 | + config->o.m->page_specs.emplace_back(arg, "", ""); | |
| 1003 | 1003 | return this; |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| ... | ... | @@ -1063,7 +1063,7 @@ QPDFJob::UOConfig::endUnderlayOverlay() |
| 1063 | 1063 | usage(config->o.m->under_overlay->which + " file not specified"); |
| 1064 | 1064 | } |
| 1065 | 1065 | config->o.m->under_overlay = nullptr; |
| 1066 | - return this->config; | |
| 1066 | + return config; | |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | QPDFJob::UOConfig* |
| ... | ... | @@ -1192,7 +1192,7 @@ QPDFJob::EncConfig::endEncrypt() |
| 1192 | 1192 | config->o.m->encrypt = true; |
| 1193 | 1193 | config->o.m->decrypt = false; |
| 1194 | 1194 | config->o.m->copy_encryption = false; |
| 1195 | - return this->config; | |
| 1195 | + return config; | |
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | QPDFJob::EncConfig* |
| ... | ... | @@ -1341,5 +1341,5 @@ QPDFJob::PageLabelsConfig::PageLabelsConfig(Config* c) : |
| 1341 | 1341 | QPDFJob::Config* |
| 1342 | 1342 | QPDFJob::PageLabelsConfig::endSetPageLabels() |
| 1343 | 1343 | { |
| 1344 | - return this->config; | |
| 1344 | + return config; | |
| 1345 | 1345 | } | ... | ... |