Commit a60f8a99f180b575c43148191775567952d71c7a
1 parent
bd47ea9b
Refactor: Eliminate unnecessary `this` qualifiers
Simplified code by removing redundant `this` qualifiers where they are not essential, improving readability and alignment with coding standards. No changes were made to functionality.
Showing
11 changed files
with
166 additions
and
168 deletions
libqpdf/Pipeline.cc
| ... | ... | @@ -14,7 +14,7 @@ Pipeline::getNext(bool allow_null) |
| 14 | 14 | { |
| 15 | 15 | if (!next_ && !allow_null) { |
| 16 | 16 | throw std::logic_error( |
| 17 | - this->identifier + ": Pipeline::getNext() called on pipeline with no next"); | |
| 17 | + identifier + ": Pipeline::getNext() called on pipeline with no next"); | |
| 18 | 18 | } |
| 19 | 19 | return next_; |
| 20 | 20 | } |
| ... | ... | @@ -22,93 +22,93 @@ Pipeline::getNext(bool allow_null) |
| 22 | 22 | std::string |
| 23 | 23 | Pipeline::getIdentifier() const |
| 24 | 24 | { |
| 25 | - return this->identifier; | |
| 25 | + return identifier; | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | void |
| 29 | 29 | Pipeline::writeCStr(char const* cstr) |
| 30 | 30 | { |
| 31 | - this->write(cstr, strlen(cstr)); | |
| 31 | + write(cstr, strlen(cstr)); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | void |
| 35 | 35 | Pipeline::writeString(std::string const& str) |
| 36 | 36 | { |
| 37 | - this->write(str.c_str(), str.length()); | |
| 37 | + write(str.c_str(), str.length()); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | Pipeline& |
| 41 | 41 | Pipeline::operator<<(char const* cstr) |
| 42 | 42 | { |
| 43 | - this->writeCStr(cstr); | |
| 43 | + writeCStr(cstr); | |
| 44 | 44 | return *this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | Pipeline& |
| 48 | 48 | Pipeline::operator<<(std::string const& str) |
| 49 | 49 | { |
| 50 | - this->writeString(str); | |
| 50 | + writeString(str); | |
| 51 | 51 | return *this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | Pipeline& |
| 55 | 55 | Pipeline::operator<<(short i) |
| 56 | 56 | { |
| 57 | - this->writeString(std::to_string(i)); | |
| 57 | + writeString(std::to_string(i)); | |
| 58 | 58 | return *this; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | Pipeline& |
| 62 | 62 | Pipeline::operator<<(int i) |
| 63 | 63 | { |
| 64 | - this->writeString(std::to_string(i)); | |
| 64 | + writeString(std::to_string(i)); | |
| 65 | 65 | return *this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | Pipeline& |
| 69 | 69 | Pipeline::operator<<(long i) |
| 70 | 70 | { |
| 71 | - this->writeString(std::to_string(i)); | |
| 71 | + writeString(std::to_string(i)); | |
| 72 | 72 | return *this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | Pipeline& |
| 76 | 76 | Pipeline::operator<<(long long i) |
| 77 | 77 | { |
| 78 | - this->writeString(std::to_string(i)); | |
| 78 | + writeString(std::to_string(i)); | |
| 79 | 79 | return *this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | Pipeline& |
| 83 | 83 | Pipeline::operator<<(unsigned short i) |
| 84 | 84 | { |
| 85 | - this->writeString(std::to_string(i)); | |
| 85 | + writeString(std::to_string(i)); | |
| 86 | 86 | return *this; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | Pipeline& |
| 90 | 90 | Pipeline::operator<<(unsigned int i) |
| 91 | 91 | { |
| 92 | - this->writeString(std::to_string(i)); | |
| 92 | + writeString(std::to_string(i)); | |
| 93 | 93 | return *this; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | Pipeline& |
| 97 | 97 | Pipeline::operator<<(unsigned long i) |
| 98 | 98 | { |
| 99 | - this->writeString(std::to_string(i)); | |
| 99 | + writeString(std::to_string(i)); | |
| 100 | 100 | return *this; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | Pipeline& |
| 104 | 104 | Pipeline::operator<<(unsigned long long i) |
| 105 | 105 | { |
| 106 | - this->writeString(std::to_string(i)); | |
| 106 | + writeString(std::to_string(i)); | |
| 107 | 107 | return *this; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | void |
| 111 | 111 | Pipeline::write(char const* data, size_t len) |
| 112 | 112 | { |
| 113 | - this->write(reinterpret_cast<unsigned char const*>(data), len); | |
| 113 | + write(reinterpret_cast<unsigned char const*>(data), len); | |
| 114 | 114 | } | ... | ... |
libqpdf/Pl_AES_PDF.cc
| ... | ... | @@ -36,32 +36,32 @@ Pl_AES_PDF::Pl_AES_PDF( |
| 36 | 36 | void |
| 37 | 37 | Pl_AES_PDF::useZeroIV() |
| 38 | 38 | { |
| 39 | - this->use_zero_iv = true; | |
| 39 | + use_zero_iv = true; | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | void |
| 43 | 43 | Pl_AES_PDF::disablePadding() |
| 44 | 44 | { |
| 45 | - this->disable_padding = true; | |
| 45 | + disable_padding = true; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | void |
| 49 | 49 | Pl_AES_PDF::setIV(unsigned char const* iv, size_t bytes) |
| 50 | 50 | { |
| 51 | - if (bytes != this->buf_size) { | |
| 51 | + if (bytes != buf_size) { | |
| 52 | 52 | throw std::logic_error( |
| 53 | 53 | "Pl_AES_PDF: specified initialization vector" |
| 54 | 54 | " size in bytes must be " + |
| 55 | 55 | std::to_string(bytes)); |
| 56 | 56 | } |
| 57 | - this->use_specified_iv = true; | |
| 58 | - memcpy(this->specified_iv, iv, bytes); | |
| 57 | + use_specified_iv = true; | |
| 58 | + memcpy(specified_iv, iv, bytes); | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | void |
| 62 | 62 | Pl_AES_PDF::disableCBC() |
| 63 | 63 | { |
| 64 | - this->cbc_mode = false; | |
| 64 | + cbc_mode = false; | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | void |
| ... | ... | @@ -77,15 +77,15 @@ Pl_AES_PDF::write(unsigned char const* data, size_t len) |
| 77 | 77 | unsigned char const* p = data; |
| 78 | 78 | |
| 79 | 79 | while (bytes_left > 0) { |
| 80 | - if (this->offset == this->buf_size) { | |
| 80 | + if (offset == buf_size) { | |
| 81 | 81 | flush(false); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - size_t available = this->buf_size - this->offset; | |
| 84 | + size_t available = buf_size - offset; | |
| 85 | 85 | size_t bytes = (bytes_left < available ? bytes_left : available); |
| 86 | 86 | bytes_left -= bytes; |
| 87 | - std::memcpy(this->inbuf + this->offset, p, bytes); | |
| 88 | - this->offset += bytes; | |
| 87 | + std::memcpy(inbuf + offset, p, bytes); | |
| 88 | + offset += bytes; | |
| 89 | 89 | p += bytes; |
| 90 | 90 | } |
| 91 | 91 | } |
| ... | ... | @@ -93,32 +93,32 @@ Pl_AES_PDF::write(unsigned char const* data, size_t len) |
| 93 | 93 | void |
| 94 | 94 | Pl_AES_PDF::finish() |
| 95 | 95 | { |
| 96 | - if (this->encrypt) { | |
| 97 | - if (this->offset == this->buf_size) { | |
| 96 | + if (encrypt) { | |
| 97 | + if (offset == buf_size) { | |
| 98 | 98 | flush(false); |
| 99 | 99 | } |
| 100 | - if (!this->disable_padding) { | |
| 100 | + if (!disable_padding) { | |
| 101 | 101 | // Pad as described in section 3.5.1 of version 1.7 of the PDF specification, including |
| 102 | 102 | // providing an entire block of padding if the input was a multiple of 16 bytes. |
| 103 | - unsigned char pad = QIntC::to_uchar(this->buf_size - this->offset); | |
| 104 | - memset(this->inbuf + this->offset, pad, pad); | |
| 105 | - this->offset = this->buf_size; | |
| 103 | + unsigned char pad = QIntC::to_uchar(buf_size - offset); | |
| 104 | + memset(inbuf + offset, pad, pad); | |
| 105 | + offset = buf_size; | |
| 106 | 106 | flush(false); |
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | - if (this->offset != this->buf_size) { | |
| 109 | + if (offset != buf_size) { | |
| 110 | 110 | // This is never supposed to happen as the output is always supposed to be padded. |
| 111 | 111 | // However, we have encountered files for which the output is not a multiple of the |
| 112 | 112 | // block size. In this case, pad with zeroes and hope for the best. |
| 113 | - if (this->offset >= this->buf_size) { | |
| 113 | + if (offset >= buf_size) { | |
| 114 | 114 | throw std::logic_error("buffer overflow in AES encryption pipeline"); |
| 115 | 115 | } |
| 116 | - std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset); | |
| 117 | - this->offset = this->buf_size; | |
| 116 | + std::memset(inbuf + offset, 0, buf_size - offset); | |
| 117 | + offset = buf_size; | |
| 118 | 118 | } |
| 119 | - flush(!this->disable_padding); | |
| 119 | + flush(!disable_padding); | |
| 120 | 120 | } |
| 121 | - this->crypto->rijndael_finalize(); | |
| 121 | + crypto->rijndael_finalize(); | |
| 122 | 122 | next()->finish(); |
| 123 | 123 | } |
| 124 | 124 | |
| ... | ... | @@ -126,65 +126,64 @@ void |
| 126 | 126 | Pl_AES_PDF::initializeVector() |
| 127 | 127 | { |
| 128 | 128 | if (use_zero_iv) { |
| 129 | - for (unsigned int i = 0; i < this->buf_size; ++i) { | |
| 130 | - this->cbc_block[i] = 0; | |
| 129 | + for (unsigned int i = 0; i < buf_size; ++i) { | |
| 130 | + cbc_block[i] = 0; | |
| 131 | 131 | } |
| 132 | 132 | } else if (use_specified_iv) { |
| 133 | - std::memcpy(this->cbc_block, this->specified_iv, this->buf_size); | |
| 133 | + std::memcpy(cbc_block, specified_iv, buf_size); | |
| 134 | 134 | } else if (use_static_iv) { |
| 135 | - for (unsigned int i = 0; i < this->buf_size; ++i) { | |
| 136 | - this->cbc_block[i] = static_cast<unsigned char>(14U * (1U + i)); | |
| 135 | + for (unsigned int i = 0; i < buf_size; ++i) { | |
| 136 | + cbc_block[i] = static_cast<unsigned char>(14U * (1U + i)); | |
| 137 | 137 | } |
| 138 | 138 | } else { |
| 139 | - QUtil::initializeWithRandomBytes(this->cbc_block, this->buf_size); | |
| 139 | + QUtil::initializeWithRandomBytes(cbc_block, buf_size); | |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | void |
| 144 | 144 | Pl_AES_PDF::flush(bool strip_padding) |
| 145 | 145 | { |
| 146 | - if (this->offset != this->buf_size) { | |
| 146 | + if (offset != buf_size) { | |
| 147 | 147 | throw std::logic_error("AES pipeline: flush called when buffer was not full"); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (first) { |
| 151 | 151 | first = false; |
| 152 | 152 | bool return_after_init = false; |
| 153 | - if (this->cbc_mode) { | |
| 153 | + if (cbc_mode) { | |
| 154 | 154 | if (encrypt) { |
| 155 | 155 | // Set cbc_block to the initialization vector, and if not zero, write it to the |
| 156 | 156 | // output stream. |
| 157 | 157 | initializeVector(); |
| 158 | - if (!(this->use_zero_iv || this->use_specified_iv)) { | |
| 159 | - next()->write(this->cbc_block, this->buf_size); | |
| 158 | + if (!(use_zero_iv || use_specified_iv)) { | |
| 159 | + next()->write(cbc_block, buf_size); | |
| 160 | 160 | } |
| 161 | - } else if (this->use_zero_iv || this->use_specified_iv) { | |
| 161 | + } else if (use_zero_iv || use_specified_iv) { | |
| 162 | 162 | // Initialize vector with zeroes; zero vector was not written to the beginning of |
| 163 | 163 | // the input file. |
| 164 | 164 | initializeVector(); |
| 165 | 165 | } else { |
| 166 | 166 | // Take the first block of input as the initialization vector. There's nothing to |
| 167 | 167 | // write at this time. |
| 168 | - memcpy(this->cbc_block, this->inbuf, this->buf_size); | |
| 169 | - this->offset = 0; | |
| 168 | + memcpy(cbc_block, inbuf, buf_size); | |
| 169 | + offset = 0; | |
| 170 | 170 | return_after_init = true; |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | - this->crypto->rijndael_init( | |
| 174 | - encrypt, this->key.get(), key_bytes, this->cbc_mode, this->cbc_block); | |
| 173 | + crypto->rijndael_init(encrypt, key.get(), key_bytes, cbc_mode, cbc_block); | |
| 175 | 174 | if (return_after_init) { |
| 176 | 175 | return; |
| 177 | 176 | } |
| 178 | 177 | } |
| 179 | 178 | |
| 180 | - this->crypto->rijndael_process(this->inbuf, this->outbuf); | |
| 181 | - unsigned int bytes = this->buf_size; | |
| 179 | + crypto->rijndael_process(inbuf, outbuf); | |
| 180 | + unsigned int bytes = buf_size; | |
| 182 | 181 | if (strip_padding) { |
| 183 | - unsigned char last = this->outbuf[this->buf_size - 1]; | |
| 184 | - if (last <= this->buf_size) { | |
| 182 | + unsigned char last = outbuf[buf_size - 1]; | |
| 183 | + if (last <= buf_size) { | |
| 185 | 184 | bool strip = true; |
| 186 | 185 | for (unsigned int i = 1; i <= last; ++i) { |
| 187 | - if (this->outbuf[this->buf_size - i] != last) { | |
| 186 | + if (outbuf[buf_size - i] != last) { | |
| 188 | 187 | strip = false; |
| 189 | 188 | break; |
| 190 | 189 | } |
| ... | ... | @@ -194,6 +193,6 @@ Pl_AES_PDF::flush(bool strip_padding) |
| 194 | 193 | } |
| 195 | 194 | } |
| 196 | 195 | } |
| 197 | - this->offset = 0; | |
| 198 | - next()->write(this->outbuf, bytes); | |
| 196 | + offset = 0; | |
| 197 | + next()->write(outbuf, bytes); | |
| 199 | 198 | } | ... | ... |
libqpdf/Pl_Base64.cc
| ... | ... | @@ -42,7 +42,7 @@ Pl_Base64::write(unsigned char const* data, size_t len) |
| 42 | 42 | if (finished) { |
| 43 | 43 | throw std::logic_error("Pl_Base64 used after finished"); |
| 44 | 44 | } |
| 45 | - if (this->action == a_decode) { | |
| 45 | + if (action == a_decode) { | |
| 46 | 46 | decode(data, len); |
| 47 | 47 | } else { |
| 48 | 48 | encode(data, len); |
| ... | ... | @@ -55,8 +55,8 @@ Pl_Base64::decode(unsigned char const* data, size_t len) |
| 55 | 55 | unsigned char const* p = data; |
| 56 | 56 | while (len > 0) { |
| 57 | 57 | if (!util::is_space(to_c(*p))) { |
| 58 | - this->buf[this->pos++] = *p; | |
| 59 | - if (this->pos == 4) { | |
| 58 | + buf[pos++] = *p; | |
| 59 | + if (pos == 4) { | |
| 60 | 60 | flush(); |
| 61 | 61 | } |
| 62 | 62 | } |
| ... | ... | @@ -70,8 +70,8 @@ Pl_Base64::encode(unsigned char const* data, size_t len) |
| 70 | 70 | { |
| 71 | 71 | unsigned char const* p = data; |
| 72 | 72 | while (len > 0) { |
| 73 | - this->buf[this->pos++] = *p; | |
| 74 | - if (this->pos == 3) { | |
| 73 | + buf[pos++] = *p; | |
| 74 | + if (pos == 3) { | |
| 75 | 75 | flush(); |
| 76 | 76 | } |
| 77 | 77 | ++p; |
| ... | ... | @@ -82,7 +82,7 @@ Pl_Base64::encode(unsigned char const* data, size_t len) |
| 82 | 82 | void |
| 83 | 83 | Pl_Base64::flush() |
| 84 | 84 | { |
| 85 | - if (this->action == a_decode) { | |
| 85 | + if (action == a_decode) { | |
| 86 | 86 | flush_decode(); |
| 87 | 87 | } else { |
| 88 | 88 | flush_encode(); |
| ... | ... | @@ -93,7 +93,7 @@ Pl_Base64::flush() |
| 93 | 93 | void |
| 94 | 94 | Pl_Base64::flush_decode() |
| 95 | 95 | { |
| 96 | - if (this->end_of_data) { | |
| 96 | + if (end_of_data) { | |
| 97 | 97 | throw std::runtime_error(getIdentifier() + ": base64 decode: data follows pad characters"); |
| 98 | 98 | } |
| 99 | 99 | int pad = 0; |
| ... | ... | @@ -101,7 +101,7 @@ Pl_Base64::flush_decode() |
| 101 | 101 | int outval = 0; |
| 102 | 102 | for (size_t i = 0; i < 4; ++i) { |
| 103 | 103 | int v = 0; |
| 104 | - char ch = to_c(this->buf[i]); | |
| 104 | + char ch = to_c(buf[i]); | |
| 105 | 105 | if ((ch >= 'A') && (ch <= 'Z')) { |
| 106 | 106 | v = ch - 'A'; |
| 107 | 107 | } else if ((ch >= 'a') && (ch <= 'z')) { |
| ... | ... | @@ -112,9 +112,9 @@ Pl_Base64::flush_decode() |
| 112 | 112 | v = 62; |
| 113 | 113 | } else if ((ch == '/') || (ch == '_')) { |
| 114 | 114 | v = 63; |
| 115 | - } else if ((ch == '=') && ((i == 3) || ((i == 2) && (this->buf[3] == '=')))) { | |
| 115 | + } else if ((ch == '=') && ((i == 3) || ((i == 2) && (buf[3] == '=')))) { | |
| 116 | 116 | ++pad; |
| 117 | - this->end_of_data = true; | |
| 117 | + end_of_data = true; | |
| 118 | 118 | v = 0; |
| 119 | 119 | } else { |
| 120 | 120 | throw std::runtime_error(getIdentifier() + ": base64 decode: invalid input"); |
| ... | ... | @@ -134,7 +134,7 @@ Pl_Base64::flush_decode() |
| 134 | 134 | void |
| 135 | 135 | Pl_Base64::flush_encode() |
| 136 | 136 | { |
| 137 | - int outval = ((this->buf[0] << 16) | (this->buf[1] << 8) | (this->buf[2])); | |
| 137 | + int outval = ((buf[0] << 16) | (buf[1] << 8) | (buf[2])); | |
| 138 | 138 | unsigned char out[4] = { |
| 139 | 139 | to_uc(outval >> 18), |
| 140 | 140 | to_uc(0x3f & (outval >> 12)), |
| ... | ... | @@ -158,7 +158,7 @@ Pl_Base64::flush_encode() |
| 158 | 158 | } |
| 159 | 159 | out[i] = to_uc(ch); |
| 160 | 160 | } |
| 161 | - for (size_t i = 0; i < 3 - this->pos; ++i) { | |
| 161 | + for (size_t i = 0; i < 3 - pos; ++i) { | |
| 162 | 162 | out[3 - i] = '='; |
| 163 | 163 | } |
| 164 | 164 | next()->write(out, 4); |
| ... | ... | @@ -167,24 +167,24 @@ Pl_Base64::flush_encode() |
| 167 | 167 | void |
| 168 | 168 | Pl_Base64::finish() |
| 169 | 169 | { |
| 170 | - if (this->pos > 0) { | |
| 170 | + if (pos > 0) { | |
| 171 | 171 | if (finished) { |
| 172 | 172 | throw std::logic_error("Pl_Base64 used after finished"); |
| 173 | 173 | } |
| 174 | - if (this->action == a_decode) { | |
| 175 | - for (size_t i = this->pos; i < 4; ++i) { | |
| 176 | - this->buf[i] = '='; | |
| 174 | + if (action == a_decode) { | |
| 175 | + for (size_t i = pos; i < 4; ++i) { | |
| 176 | + buf[i] = '='; | |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | flush(); |
| 180 | 180 | } |
| 181 | - this->finished = true; | |
| 181 | + finished = true; | |
| 182 | 182 | next()->finish(); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | void |
| 186 | 186 | Pl_Base64::reset() |
| 187 | 187 | { |
| 188 | - this->pos = 0; | |
| 188 | + pos = 0; | |
| 189 | 189 | memset(buf, 0, 4); |
| 190 | 190 | } | ... | ... |
libqpdf/QPDFFormFieldObjectHelper.cc
| ... | ... | @@ -553,7 +553,7 @@ ValueSetter::handleToken(QPDFTokenizer::Token const& token) |
| 553 | 553 | void |
| 554 | 554 | ValueSetter::handleEOF() |
| 555 | 555 | { |
| 556 | - if (!this->replaced) { | |
| 556 | + if (!replaced) { | |
| 557 | 557 | QTC::TC("qpdf", "QPDFFormFieldObjectHelper replaced BMC at EOF"); |
| 558 | 558 | write("/Tx BMC\n"); |
| 559 | 559 | writeAppearance(); |
| ... | ... | @@ -563,7 +563,7 @@ ValueSetter::handleEOF() |
| 563 | 563 | void |
| 564 | 564 | ValueSetter::writeAppearance() |
| 565 | 565 | { |
| 566 | - this->replaced = true; | |
| 566 | + replaced = true; | |
| 567 | 567 | |
| 568 | 568 | // This code does not take quadding into consideration because doing so requires font metric |
| 569 | 569 | // information, which we don't have in many cases. |
| ... | ... | @@ -713,18 +713,18 @@ TfFinder::handleToken(QPDFTokenizer::Token const& token) |
| 713 | 713 | double |
| 714 | 714 | TfFinder::getTf() |
| 715 | 715 | { |
| 716 | - return this->tf; | |
| 716 | + return tf; | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | std::string |
| 720 | 720 | TfFinder::getDA() |
| 721 | 721 | { |
| 722 | 722 | std::string result; |
| 723 | - size_t n = this->DA.size(); | |
| 723 | + size_t n = DA.size(); | |
| 724 | 724 | for (size_t i = 0; i < n; ++i) { |
| 725 | - std::string cur = this->DA.at(i); | |
| 725 | + std::string cur = DA.at(i); | |
| 726 | 726 | if (QIntC::to_int(i) == tf_idx) { |
| 727 | - double delta = strtod(cur.c_str(), nullptr) - this->tf; | |
| 727 | + double delta = strtod(cur.c_str(), nullptr) - tf; | |
| 728 | 728 | if ((delta > 0.001) || (delta < -0.001)) { |
| 729 | 729 | // tf doesn't match the font size passed to Tf, so substitute. |
| 730 | 730 | QTC::TC("qpdf", "QPDFFormFieldObjectHelper fallback Tf"); |
| ... | ... | @@ -739,7 +739,7 @@ TfFinder::getDA() |
| 739 | 739 | std::string |
| 740 | 740 | TfFinder::getFontName() |
| 741 | 741 | { |
| 742 | - return this->font_name; | |
| 742 | + return font_name; | |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | QPDFObjectHandle | ... | ... |
libqpdf/QPDFJob.cc
| ... | ... | @@ -191,9 +191,9 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) |
| 191 | 191 | } |
| 192 | 192 | return result; |
| 193 | 193 | } |
| 194 | - if (((this->oi_min_width > 0) && (w <= this->oi_min_width)) || | |
| 195 | - ((this->oi_min_height > 0) && (h <= this->oi_min_height)) || | |
| 196 | - ((this->oi_min_area > 0) && ((w * h) <= this->oi_min_area))) { | |
| 194 | + if (((oi_min_width > 0) && (w <= oi_min_width)) || | |
| 195 | + ((oi_min_height > 0) && (h <= oi_min_height)) || | |
| 196 | + ((oi_min_area > 0) && ((w * h) <= oi_min_area))) { | |
| 197 | 197 | QTC::TC("qpdf", "QPDFJob image optimize too small"); |
| 198 | 198 | if (!description.empty()) { |
| 199 | 199 | o.doIfVerbose([&](Pipeline& v, std::string const& prefix) { |
| ... | ... | @@ -277,8 +277,7 @@ QPDFPageData::QPDFPageData(std::string const& filename, QPDF* qpdf, std::string |
| 277 | 277 | orig_pages(qpdf->getAllPages()) |
| 278 | 278 | { |
| 279 | 279 | try { |
| 280 | - this->selected_pages = | |
| 281 | - QUtil::parse_numrange(range.c_str(), QIntC::to_int(this->orig_pages.size())); | |
| 280 | + selected_pages = QUtil::parse_numrange(range.c_str(), QIntC::to_int(orig_pages.size())); | |
| 282 | 281 | } catch (std::runtime_error& e) { |
| 283 | 282 | throw std::runtime_error("parsing numeric range for " + filename + ": " + e.what()); |
| 284 | 283 | } |
| ... | ... | @@ -289,13 +288,13 @@ QPDFPageData::QPDFPageData(QPDFPageData const& other, int page) : |
| 289 | 288 | qpdf(other.qpdf), |
| 290 | 289 | orig_pages(other.orig_pages) |
| 291 | 290 | { |
| 292 | - this->selected_pages.push_back(page); | |
| 291 | + selected_pages.push_back(page); | |
| 293 | 292 | } |
| 294 | 293 | |
| 295 | 294 | void |
| 296 | 295 | ProgressReporter::reportProgress(int percentage) |
| 297 | 296 | { |
| 298 | - this->p << prefix << ": " << filename << ": write progress: " << percentage << "%\n"; | |
| 297 | + p << prefix << ": " << filename << ": write progress: " << percentage << "%\n"; | |
| 299 | 298 | } |
| 300 | 299 | |
| 301 | 300 | QPDFJob::Members::Members() : | ... | ... |
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -82,7 +82,7 @@ QPDFObjectHandle::StreamDataProvider::provideStreamData( |
| 82 | 82 | bool |
| 83 | 83 | QPDFObjectHandle::StreamDataProvider::supportsRetry() |
| 84 | 84 | { |
| 85 | - return this->supports_retry; | |
| 85 | + return supports_retry; | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | namespace |
| ... | ... | @@ -121,17 +121,17 @@ QPDFObjectHandle::TokenFilter::handleEOF() |
| 121 | 121 | void |
| 122 | 122 | QPDFObjectHandle::TokenFilter::setPipeline(Pipeline* p) |
| 123 | 123 | { |
| 124 | - this->pipeline = p; | |
| 124 | + pipeline = p; | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | void |
| 128 | 128 | QPDFObjectHandle::TokenFilter::write(char const* data, size_t len) |
| 129 | 129 | { |
| 130 | - if (!this->pipeline) { | |
| 130 | + if (!pipeline) { | |
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | if (len) { |
| 134 | - this->pipeline->write(data, len); | |
| 134 | + pipeline->write(data, len); | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| ... | ... | @@ -199,7 +199,7 @@ void |
| 199 | 199 | LastChar::write(unsigned char const* data, size_t len) |
| 200 | 200 | { |
| 201 | 201 | if (len > 0) { |
| 202 | - this->last_char = data[len - 1]; | |
| 202 | + last_char = data[len - 1]; | |
| 203 | 203 | } |
| 204 | 204 | next()->write(data, len); |
| 205 | 205 | } |
| ... | ... | @@ -213,7 +213,7 @@ LastChar::finish() |
| 213 | 213 | unsigned char |
| 214 | 214 | LastChar::getLastChar() |
| 215 | 215 | { |
| 216 | - return this->last_char; | |
| 216 | + return last_char; | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | std::pair<bool, bool> |
| ... | ... | @@ -648,7 +648,7 @@ QPDFObject::getStringValue() const |
| 648 | 648 | bool |
| 649 | 649 | QPDFObjectHandle::isSameObjectAs(QPDFObjectHandle const& rhs) const |
| 650 | 650 | { |
| 651 | - return this->obj == rhs.obj; | |
| 651 | + return obj == rhs.obj; | |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | qpdf_object_type_e |
| ... | ... | @@ -1326,7 +1326,7 @@ QPDFObjectHandle::getPageContents() |
| 1326 | 1326 | { |
| 1327 | 1327 | std::string description = "page object " + getObjGen().unparse(' '); |
| 1328 | 1328 | std::string all_description; |
| 1329 | - return this->getKey("/Contents").arrayOrStreamToStreamArray(description, all_description); | |
| 1329 | + return getKey("/Contents").arrayOrStreamToStreamArray(description, all_description); | |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | void |
| ... | ... | @@ -1347,7 +1347,7 @@ QPDFObjectHandle::addPageContents(QPDFObjectHandle new_contents, bool first) |
| 1347 | 1347 | content_streams.push_back(new_contents); |
| 1348 | 1348 | } |
| 1349 | 1349 | |
| 1350 | - this->replaceKey("/Contents", newArray(content_streams)); | |
| 1350 | + replaceKey("/Contents", newArray(content_streams)); | |
| 1351 | 1351 | } |
| 1352 | 1352 | |
| 1353 | 1353 | void |
| ... | ... | @@ -1386,7 +1386,7 @@ QPDFObjectHandle::rotatePage(int angle, bool relative) |
| 1386 | 1386 | void |
| 1387 | 1387 | QPDFObjectHandle::coalesceContentStreams() |
| 1388 | 1388 | { |
| 1389 | - QPDFObjectHandle contents = this->getKey("/Contents"); | |
| 1389 | + QPDFObjectHandle contents = getKey("/Contents"); | |
| 1390 | 1390 | if (contents.isStream()) { |
| 1391 | 1391 | QTC::TC("qpdf", "QPDFObjectHandle coalesce called on stream"); |
| 1392 | 1392 | return; |
| ... | ... | @@ -1402,7 +1402,7 @@ QPDFObjectHandle::coalesceContentStreams() |
| 1402 | 1402 | QPDF& qpdf = getQPDF("coalesceContentStreams called on object with no associated PDF file"); |
| 1403 | 1403 | |
| 1404 | 1404 | QPDFObjectHandle new_contents = newStream(&qpdf); |
| 1405 | - this->replaceKey("/Contents", new_contents); | |
| 1405 | + replaceKey("/Contents", new_contents); | |
| 1406 | 1406 | |
| 1407 | 1407 | auto provider = std::shared_ptr<StreamDataProvider>(new CoalesceProvider(*this, contents)); |
| 1408 | 1408 | new_contents.replaceStreamData(provider, newNull(), newNull()); |
| ... | ... | @@ -1411,7 +1411,7 @@ QPDFObjectHandle::coalesceContentStreams() |
| 1411 | 1411 | std::string |
| 1412 | 1412 | QPDFObjectHandle::unparse() const |
| 1413 | 1413 | { |
| 1414 | - if (this->isIndirect()) { | |
| 1414 | + if (isIndirect()) { | |
| 1415 | 1415 | return getObjGen().unparse(' ') + " R"; |
| 1416 | 1416 | } else { |
| 1417 | 1417 | return unparseResolved(); |
| ... | ... | @@ -1520,7 +1520,7 @@ QPDFObjectHandle::pipePageContents(Pipeline* p) |
| 1520 | 1520 | { |
| 1521 | 1521 | std::string description = "page object " + getObjGen().unparse(' '); |
| 1522 | 1522 | std::string all_description; |
| 1523 | - this->getKey("/Contents").pipeContentStreams(p, description, all_description); | |
| 1523 | + getKey("/Contents").pipeContentStreams(p, description, all_description); | |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | void |
| ... | ... | @@ -1557,14 +1557,14 @@ void |
| 1557 | 1557 | QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) |
| 1558 | 1558 | { |
| 1559 | 1559 | std::string description = "page object " + getObjGen().unparse(' '); |
| 1560 | - this->getKey("/Contents").parseContentStream_internal(description, callbacks); | |
| 1560 | + getKey("/Contents").parseContentStream_internal(description, callbacks); | |
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | 1563 | void |
| 1564 | 1564 | QPDFObjectHandle::parseAsContents(ParserCallbacks* callbacks) |
| 1565 | 1565 | { |
| 1566 | 1566 | std::string description = "object " + getObjGen().unparse(' '); |
| 1567 | - this->parseContentStream_internal(description, callbacks); | |
| 1567 | + parseContentStream_internal(description, callbacks); | |
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | void |
| ... | ... | @@ -1572,7 +1572,7 @@ QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) |
| 1572 | 1572 | { |
| 1573 | 1573 | auto description = "token filter for page object " + getObjGen().unparse(' '); |
| 1574 | 1574 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1575 | - this->pipePageContents(&token_pipeline); | |
| 1575 | + pipePageContents(&token_pipeline); | |
| 1576 | 1576 | } |
| 1577 | 1577 | |
| 1578 | 1578 | void |
| ... | ... | @@ -1580,7 +1580,7 @@ QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next) |
| 1580 | 1580 | { |
| 1581 | 1581 | auto description = "token filter for object " + getObjGen().unparse(' '); |
| 1582 | 1582 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1583 | - this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); | |
| 1583 | + pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); | |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | void |
| ... | ... | @@ -1667,7 +1667,7 @@ void |
| 1667 | 1667 | QPDFObjectHandle::addContentTokenFilter(std::shared_ptr<TokenFilter> filter) |
| 1668 | 1668 | { |
| 1669 | 1669 | coalesceContentStreams(); |
| 1670 | - this->getKey("/Contents").addTokenFilter(filter); | |
| 1670 | + getKey("/Contents").addTokenFilter(filter); | |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | void |
| ... | ... | @@ -1910,14 +1910,14 @@ QPDFObjectHandle::makeDirect(QPDFObjGen::set& visited, bool stop_at_streams) |
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | if (isBool() || isInteger() || isName() || isNull() || isReal() || isString()) { |
| 1913 | - this->obj = copy(true); | |
| 1913 | + obj = copy(true); | |
| 1914 | 1914 | } else if (auto a = as_array(strict)) { |
| 1915 | 1915 | std::vector<QPDFObjectHandle> items; |
| 1916 | 1916 | for (auto const& item: a) { |
| 1917 | 1917 | items.emplace_back(item); |
| 1918 | 1918 | items.back().makeDirect(visited, stop_at_streams); |
| 1919 | 1919 | } |
| 1920 | - this->obj = QPDFObject::create<QPDF_Array>(items); | |
| 1920 | + obj = QPDFObject::create<QPDF_Array>(items); | |
| 1921 | 1921 | } else if (isDictionary()) { |
| 1922 | 1922 | std::map<std::string, QPDFObjectHandle> items; |
| 1923 | 1923 | for (auto const& [key, value]: as_dictionary(strict)) { |
| ... | ... | @@ -1926,7 +1926,7 @@ QPDFObjectHandle::makeDirect(QPDFObjGen::set& visited, bool stop_at_streams) |
| 1926 | 1926 | items[key].makeDirect(visited, stop_at_streams); |
| 1927 | 1927 | } |
| 1928 | 1928 | } |
| 1929 | - this->obj = QPDFObject::create<QPDF_Dictionary>(items); | |
| 1929 | + obj = QPDFObject::create<QPDF_Dictionary>(items); | |
| 1930 | 1930 | } else if (isStream()) { |
| 1931 | 1931 | QTC::TC("qpdf", "QPDFObjectHandle copy stream", stop_at_streams ? 0 : 1); |
| 1932 | 1932 | if (!stop_at_streams) { |
| ... | ... | @@ -1946,7 +1946,7 @@ QPDFObjectHandle |
| 1946 | 1946 | QPDFObjectHandle::copyStream() |
| 1947 | 1947 | { |
| 1948 | 1948 | assertStream(); |
| 1949 | - QPDFObjectHandle result = newStream(this->getOwningQPDF()); | |
| 1949 | + QPDFObjectHandle result = newStream(getOwningQPDF()); | |
| 1950 | 1950 | QPDFObjectHandle dict = result.getDict(); |
| 1951 | 1951 | QPDFObjectHandle old_dict = getDict(); |
| 1952 | 1952 | for (auto& iter: QPDFDictItems(old_dict)) { |
| ... | ... | @@ -2208,14 +2208,14 @@ QPDFObjectHandle::QPDFDictItems::iterator::reference |
| 2208 | 2208 | QPDFObjectHandle::QPDFDictItems::iterator::operator*() |
| 2209 | 2209 | { |
| 2210 | 2210 | updateIValue(); |
| 2211 | - return this->ivalue; | |
| 2211 | + return ivalue; | |
| 2212 | 2212 | } |
| 2213 | 2213 | |
| 2214 | 2214 | QPDFObjectHandle::QPDFDictItems::iterator::pointer |
| 2215 | 2215 | QPDFObjectHandle::QPDFDictItems::iterator::operator->() |
| 2216 | 2216 | { |
| 2217 | 2217 | updateIValue(); |
| 2218 | - return &this->ivalue; | |
| 2218 | + return &ivalue; | |
| 2219 | 2219 | } |
| 2220 | 2220 | |
| 2221 | 2221 | bool |
| ... | ... | @@ -2227,7 +2227,7 @@ QPDFObjectHandle::QPDFDictItems::iterator::operator==(iterator const& other) con |
| 2227 | 2227 | if (m->is_end || other.m->is_end) { |
| 2228 | 2228 | return false; |
| 2229 | 2229 | } |
| 2230 | - return (this->ivalue.first == other.ivalue.first); | |
| 2230 | + return (ivalue.first == other.ivalue.first); | |
| 2231 | 2231 | } |
| 2232 | 2232 | |
| 2233 | 2233 | QPDFObjectHandle::QPDFDictItems::iterator::iterator(QPDFObjectHandle& oh, bool for_begin) : |
| ... | ... | @@ -2241,19 +2241,19 @@ QPDFObjectHandle::QPDFDictItems::iterator::updateIValue() |
| 2241 | 2241 | { |
| 2242 | 2242 | m->is_end = (m->iter == m->keys.end()); |
| 2243 | 2243 | if (m->is_end) { |
| 2244 | - this->ivalue.first = ""; | |
| 2245 | - this->ivalue.second = QPDFObjectHandle(); | |
| 2244 | + ivalue.first = ""; | |
| 2245 | + ivalue.second = QPDFObjectHandle(); | |
| 2246 | 2246 | } else { |
| 2247 | - this->ivalue.first = *(m->iter); | |
| 2248 | - this->ivalue.second = m->oh.getKey(this->ivalue.first); | |
| 2247 | + ivalue.first = *(m->iter); | |
| 2248 | + ivalue.second = m->oh.getKey(ivalue.first); | |
| 2249 | 2249 | } |
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | QPDFObjectHandle::QPDFDictItems::iterator::Members::Members(QPDFObjectHandle& oh, bool for_begin) : |
| 2253 | 2253 | oh(oh) |
| 2254 | 2254 | { |
| 2255 | - this->keys = oh.getKeys(); | |
| 2256 | - this->iter = for_begin ? this->keys.begin() : this->keys.end(); | |
| 2255 | + keys = oh.getKeys(); | |
| 2256 | + iter = for_begin ? keys.begin() : keys.end(); | |
| 2257 | 2257 | } |
| 2258 | 2258 | |
| 2259 | 2259 | QPDFObjectHandle::QPDFDictItems::iterator |
| ... | ... | @@ -2297,14 +2297,14 @@ QPDFObjectHandle::QPDFArrayItems::iterator::reference |
| 2297 | 2297 | QPDFObjectHandle::QPDFArrayItems::iterator::operator*() |
| 2298 | 2298 | { |
| 2299 | 2299 | updateIValue(); |
| 2300 | - return this->ivalue; | |
| 2300 | + return ivalue; | |
| 2301 | 2301 | } |
| 2302 | 2302 | |
| 2303 | 2303 | QPDFObjectHandle::QPDFArrayItems::iterator::pointer |
| 2304 | 2304 | QPDFObjectHandle::QPDFArrayItems::iterator::operator->() |
| 2305 | 2305 | { |
| 2306 | 2306 | updateIValue(); |
| 2307 | - return &this->ivalue; | |
| 2307 | + return &ivalue; | |
| 2308 | 2308 | } |
| 2309 | 2309 | |
| 2310 | 2310 | bool |
| ... | ... | @@ -2324,16 +2324,16 @@ QPDFObjectHandle::QPDFArrayItems::iterator::updateIValue() |
| 2324 | 2324 | { |
| 2325 | 2325 | m->is_end = (m->item_number >= m->oh.getArrayNItems()); |
| 2326 | 2326 | if (m->is_end) { |
| 2327 | - this->ivalue = QPDFObjectHandle(); | |
| 2327 | + ivalue = QPDFObjectHandle(); | |
| 2328 | 2328 | } else { |
| 2329 | - this->ivalue = m->oh.getArrayItem(m->item_number); | |
| 2329 | + ivalue = m->oh.getArrayItem(m->item_number); | |
| 2330 | 2330 | } |
| 2331 | 2331 | } |
| 2332 | 2332 | |
| 2333 | 2333 | QPDFObjectHandle::QPDFArrayItems::iterator::Members::Members(QPDFObjectHandle& oh, bool for_begin) : |
| 2334 | 2334 | oh(oh) |
| 2335 | 2335 | { |
| 2336 | - this->item_number = for_begin ? 0 : oh.getArrayNItems(); | |
| 2336 | + item_number = for_begin ? 0 : oh.getArrayNItems(); | |
| 2337 | 2337 | } |
| 2338 | 2338 | |
| 2339 | 2339 | QPDFObjectHandle::QPDFArrayItems::iterator | ... | ... |
libqpdf/QPDFPageDocumentHelper.cc
| ... | ... | @@ -13,7 +13,7 @@ std::vector<QPDFPageObjectHelper> |
| 13 | 13 | QPDFPageDocumentHelper::getAllPages() |
| 14 | 14 | { |
| 15 | 15 | std::vector<QPDFPageObjectHelper> pages; |
| 16 | - for (auto const& iter: this->qpdf.getAllPages()) { | |
| 16 | + for (auto const& iter: qpdf.getAllPages()) { | |
| 17 | 17 | pages.emplace_back(iter); |
| 18 | 18 | } |
| 19 | 19 | return pages; |
| ... | ... | @@ -22,7 +22,7 @@ QPDFPageDocumentHelper::getAllPages() |
| 22 | 22 | void |
| 23 | 23 | QPDFPageDocumentHelper::pushInheritedAttributesToPage() |
| 24 | 24 | { |
| 25 | - this->qpdf.pushInheritedAttributesToPage(); | |
| 25 | + qpdf.pushInheritedAttributesToPage(); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | void |
| ... | ... | @@ -36,28 +36,28 @@ QPDFPageDocumentHelper::removeUnreferencedResources() |
| 36 | 36 | void |
| 37 | 37 | QPDFPageDocumentHelper::addPage(QPDFPageObjectHelper newpage, bool first) |
| 38 | 38 | { |
| 39 | - this->qpdf.addPage(newpage.getObjectHandle(), first); | |
| 39 | + qpdf.addPage(newpage.getObjectHandle(), first); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | void |
| 43 | 43 | QPDFPageDocumentHelper::addPageAt( |
| 44 | 44 | QPDFPageObjectHelper newpage, bool before, QPDFPageObjectHelper refpage) |
| 45 | 45 | { |
| 46 | - this->qpdf.addPageAt(newpage.getObjectHandle(), before, refpage.getObjectHandle()); | |
| 46 | + qpdf.addPageAt(newpage.getObjectHandle(), before, refpage.getObjectHandle()); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | void |
| 50 | 50 | QPDFPageDocumentHelper::removePage(QPDFPageObjectHelper page) |
| 51 | 51 | { |
| 52 | - this->qpdf.removePage(page.getObjectHandle()); | |
| 52 | + qpdf.removePage(page.getObjectHandle()); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | void |
| 56 | 56 | QPDFPageDocumentHelper::flattenAnnotations(int required_flags, int forbidden_flags) |
| 57 | 57 | { |
| 58 | - QPDFAcroFormDocumentHelper afdh(this->qpdf); | |
| 58 | + QPDFAcroFormDocumentHelper afdh(qpdf); | |
| 59 | 59 | if (afdh.getNeedAppearances()) { |
| 60 | - this->qpdf.getRoot() | |
| 60 | + qpdf.getRoot() | |
| 61 | 61 | .getKey("/AcroForm") |
| 62 | 62 | .warnIfPossible( |
| 63 | 63 | "document does not have updated appearance streams, so form fields " |
| ... | ... | @@ -73,7 +73,7 @@ QPDFPageDocumentHelper::flattenAnnotations(int required_flags, int forbidden_fla |
| 73 | 73 | flattenAnnotationsForPage(ph, resources, afdh, required_flags, forbidden_flags); |
| 74 | 74 | } |
| 75 | 75 | if (!afdh.getNeedAppearances()) { |
| 76 | - this->qpdf.getRoot().removeKey("/AcroForm"); | |
| 76 | + qpdf.getRoot().removeKey("/AcroForm"); | |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| ... | ... | @@ -147,7 +147,7 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage( |
| 147 | 147 | QPDFObjectHandle new_annots_oh = QPDFObjectHandle::newArray(new_annots); |
| 148 | 148 | if (old_annots.isIndirect()) { |
| 149 | 149 | QTC::TC("qpdf", "QPDFPageDocumentHelper replace indirect annots"); |
| 150 | - this->qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh); | |
| 150 | + qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh); | |
| 151 | 151 | } else { |
| 152 | 152 | QTC::TC("qpdf", "QPDFPageDocumentHelper replace direct annots"); |
| 153 | 153 | page_oh.replaceKey("/Annots", new_annots_oh); | ... | ... |
libqpdf/QPDFPageObjectHelper.cc
| ... | ... | @@ -177,13 +177,13 @@ InlineImageTracker::handleToken(QPDFTokenizer::Token const& token) |
| 177 | 177 | if (token.getType() == QPDFTokenizer::tt_inline_image) { |
| 178 | 178 | std::string image_data(token.getValue()); |
| 179 | 179 | size_t len = image_data.length(); |
| 180 | - if (len >= this->min_size) { | |
| 180 | + if (len >= min_size) { | |
| 181 | 181 | QTC::TC("qpdf", "QPDFPageObjectHelper externalize inline image"); |
| 182 | 182 | QPDFObjectHandle dict = convertIIDict(QPDFObjectHandle::parse(dict_str)); |
| 183 | 183 | dict.replaceKey("/Length", QPDFObjectHandle::newInteger(QIntC::to_longlong(len))); |
| 184 | - std::string name = resources.getUniqueResourceName("/IIm", this->min_suffix); | |
| 184 | + std::string name = resources.getUniqueResourceName("/IIm", min_suffix); | |
| 185 | 185 | QPDFObjectHandle image = QPDFObjectHandle::newStream( |
| 186 | - this->qpdf, std::make_shared<Buffer>(std::move(image_data))); | |
| 186 | + qpdf, std::make_shared<Buffer>(std::move(image_data))); | |
| 187 | 187 | image.replaceDict(dict); |
| 188 | 188 | resources.getKey("/XObject").replaceKey(name, image); |
| 189 | 189 | write(name); |
| ... | ... | @@ -278,7 +278,7 @@ QPDFPageObjectHelper::getCropBox(bool copy_if_shared, bool copy_if_fallback) |
| 278 | 278 | return getAttribute( |
| 279 | 279 | "/CropBox", |
| 280 | 280 | copy_if_shared, |
| 281 | - [this, copy_if_shared]() { return this->getMediaBox(copy_if_shared); }, | |
| 281 | + [this, copy_if_shared]() { return getMediaBox(copy_if_shared); }, | |
| 282 | 282 | copy_if_fallback); |
| 283 | 283 | } |
| 284 | 284 | |
| ... | ... | @@ -289,7 +289,7 @@ QPDFPageObjectHelper::getTrimBox(bool copy_if_shared, bool copy_if_fallback) |
| 289 | 289 | "/TrimBox", |
| 290 | 290 | copy_if_shared, |
| 291 | 291 | [this, copy_if_shared, copy_if_fallback]() { |
| 292 | - return this->getCropBox(copy_if_shared, copy_if_fallback); | |
| 292 | + return getCropBox(copy_if_shared, copy_if_fallback); | |
| 293 | 293 | }, |
| 294 | 294 | copy_if_fallback); |
| 295 | 295 | } |
| ... | ... | @@ -301,7 +301,7 @@ QPDFPageObjectHelper::getArtBox(bool copy_if_shared, bool copy_if_fallback) |
| 301 | 301 | "/ArtBox", |
| 302 | 302 | copy_if_shared, |
| 303 | 303 | [this, copy_if_shared, copy_if_fallback]() { |
| 304 | - return this->getCropBox(copy_if_shared, copy_if_fallback); | |
| 304 | + return getCropBox(copy_if_shared, copy_if_fallback); | |
| 305 | 305 | }, |
| 306 | 306 | copy_if_fallback); |
| 307 | 307 | } |
| ... | ... | @@ -313,7 +313,7 @@ QPDFPageObjectHelper::getBleedBox(bool copy_if_shared, bool copy_if_fallback) |
| 313 | 313 | "/BleedBox", |
| 314 | 314 | copy_if_shared, |
| 315 | 315 | [this, copy_if_shared, copy_if_fallback]() { |
| 316 | - return this->getCropBox(copy_if_shared, copy_if_fallback); | |
| 316 | + return getCropBox(copy_if_shared, copy_if_fallback); | |
| 317 | 317 | }, |
| 318 | 318 | copy_if_fallback); |
| 319 | 319 | } | ... | ... |
libqpdf/QPDF_Name.cc deleted
libqpdf/QPDF_String.cc
| ... | ... | @@ -30,12 +30,12 @@ QPDF_String::writeJSON(int json_version, JSON::Writer& p) |
| 30 | 30 | p << "\"" << JSON::Writer::encode_string(candidate) << "\""; |
| 31 | 31 | } else { |
| 32 | 32 | // See if we can unambiguously represent as Unicode. |
| 33 | - if (QUtil::is_utf16(this->val) || QUtil::is_explicit_utf8(this->val)) { | |
| 33 | + if (QUtil::is_utf16(val) || QUtil::is_explicit_utf8(val)) { | |
| 34 | 34 | p << "\"u:" << JSON::Writer::encode_string(candidate) << "\""; |
| 35 | 35 | return; |
| 36 | 36 | } else if (!useHexString()) { |
| 37 | 37 | std::string test; |
| 38 | - if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) { | |
| 38 | + if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == val)) { | |
| 39 | 39 | // This is a PDF-doc string that can be losslessly encoded as Unicode. |
| 40 | 40 | p << "\"u:" << JSON::Writer::encode_string(candidate) << "\""; |
| 41 | 41 | return; |
| ... | ... | @@ -52,7 +52,7 @@ QPDF_String::useHexString() const |
| 52 | 52 | // PDF Doc encoding) characters or if too large of a proportion of the string consists of |
| 53 | 53 | // non-ASCII characters. |
| 54 | 54 | unsigned int non_ascii = 0; |
| 55 | - for (auto const ch: this->val) { | |
| 55 | + for (auto const ch: val) { | |
| 56 | 56 | if (ch > 126) { |
| 57 | 57 | ++non_ascii; |
| 58 | 58 | } else if (ch >= 32) { |
| ... | ... | @@ -73,17 +73,17 @@ QPDF_String::unparse(bool force_binary) |
| 73 | 73 | std::string result; |
| 74 | 74 | if (use_hexstring) { |
| 75 | 75 | static auto constexpr hexchars = "0123456789abcdef"; |
| 76 | - result.reserve(2 * this->val.length() + 2); | |
| 76 | + result.reserve(2 * val.length() + 2); | |
| 77 | 77 | result += '<'; |
| 78 | - for (const char c: this->val) { | |
| 78 | + for (const char c: val) { | |
| 79 | 79 | result += hexchars[static_cast<unsigned char>(c) >> 4]; |
| 80 | 80 | result += hexchars[c & 0x0f]; |
| 81 | 81 | } |
| 82 | 82 | result += '>'; |
| 83 | 83 | } else { |
| 84 | 84 | result += "("; |
| 85 | - for (unsigned int i = 0; i < this->val.length(); ++i) { | |
| 86 | - char ch = this->val.at(i); | |
| 85 | + for (unsigned int i = 0; i < val.length(); ++i) { | |
| 86 | + char ch = val.at(i); | |
| 87 | 87 | switch (ch) { |
| 88 | 88 | case '\n': |
| 89 | 89 | result += "\\n"; |
| ... | ... | @@ -119,7 +119,7 @@ QPDF_String::unparse(bool force_binary) |
| 119 | 119 | |
| 120 | 120 | default: |
| 121 | 121 | if (is_iso_latin1_printable(ch)) { |
| 122 | - result += this->val.at(i); | |
| 122 | + result += val.at(i); | |
| 123 | 123 | } else { |
| 124 | 124 | result += "\\" + |
| 125 | 125 | QUtil::int_to_string_base( |
| ... | ... | @@ -137,13 +137,13 @@ QPDF_String::unparse(bool force_binary) |
| 137 | 137 | std::string |
| 138 | 138 | QPDF_String::getUTF8Val() const |
| 139 | 139 | { |
| 140 | - if (QUtil::is_utf16(this->val)) { | |
| 141 | - return QUtil::utf16_to_utf8(this->val); | |
| 142 | - } else if (QUtil::is_explicit_utf8(this->val)) { | |
| 140 | + if (QUtil::is_utf16(val)) { | |
| 141 | + return QUtil::utf16_to_utf8(val); | |
| 142 | + } else if (QUtil::is_explicit_utf8(val)) { | |
| 143 | 143 | // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation |
| 144 | 144 | // of U+FEFF. |
| 145 | - return this->val.substr(3); | |
| 145 | + return val.substr(3); | |
| 146 | 146 | } else { |
| 147 | - return QUtil::pdf_doc_to_utf8(this->val); | |
| 147 | + return QUtil::pdf_doc_to_utf8(val); | |
| 148 | 148 | } |
| 149 | 149 | } | ... | ... |
libqpdf/SHA2_native.cc
| ... | ... | @@ -9,13 +9,13 @@ SHA2_native::SHA2_native(int bits) : |
| 9 | 9 | { |
| 10 | 10 | switch (bits) { |
| 11 | 11 | case 256: |
| 12 | - sph_sha256_init(&this->ctx256); | |
| 12 | + sph_sha256_init(&ctx256); | |
| 13 | 13 | break; |
| 14 | 14 | case 384: |
| 15 | - sph_sha384_init(&this->ctx384); | |
| 15 | + sph_sha384_init(&ctx384); | |
| 16 | 16 | break; |
| 17 | 17 | case 512: |
| 18 | - sph_sha512_init(&this->ctx512); | |
| 18 | + sph_sha512_init(&ctx512); | |
| 19 | 19 | break; |
| 20 | 20 | default: |
| 21 | 21 | badBits(); |
| ... | ... | @@ -34,13 +34,13 @@ SHA2_native::update(unsigned char const* buf, size_t len) |
| 34 | 34 | { |
| 35 | 35 | switch (bits) { |
| 36 | 36 | case 256: |
| 37 | - sph_sha256(&this->ctx256, buf, len); | |
| 37 | + sph_sha256(&ctx256, buf, len); | |
| 38 | 38 | break; |
| 39 | 39 | case 384: |
| 40 | - sph_sha384(&this->ctx384, buf, len); | |
| 40 | + sph_sha384(&ctx384, buf, len); | |
| 41 | 41 | break; |
| 42 | 42 | case 512: |
| 43 | - sph_sha512(&this->ctx512, buf, len); | |
| 43 | + sph_sha512(&ctx512, buf, len); | |
| 44 | 44 | break; |
| 45 | 45 | default: |
| 46 | 46 | badBits(); |
| ... | ... | @@ -53,13 +53,13 @@ SHA2_native::finalize() |
| 53 | 53 | { |
| 54 | 54 | switch (bits) { |
| 55 | 55 | case 256: |
| 56 | - sph_sha256_close(&this->ctx256, sha256sum); | |
| 56 | + sph_sha256_close(&ctx256, sha256sum); | |
| 57 | 57 | break; |
| 58 | 58 | case 384: |
| 59 | - sph_sha384_close(&this->ctx384, sha384sum); | |
| 59 | + sph_sha384_close(&ctx384, sha384sum); | |
| 60 | 60 | break; |
| 61 | 61 | case 512: |
| 62 | - sph_sha512_close(&this->ctx512, sha512sum); | |
| 62 | + sph_sha512_close(&ctx512, sha512sum); | |
| 63 | 63 | break; |
| 64 | 64 | default: |
| 65 | 65 | badBits(); |
| ... | ... | @@ -73,13 +73,13 @@ SHA2_native::getRawDigest() |
| 73 | 73 | std::string result; |
| 74 | 74 | switch (bits) { |
| 75 | 75 | case 256: |
| 76 | - result = std::string(reinterpret_cast<char*>(this->sha256sum), sizeof(this->sha256sum)); | |
| 76 | + result = std::string(reinterpret_cast<char*>(sha256sum), sizeof(sha256sum)); | |
| 77 | 77 | break; |
| 78 | 78 | case 384: |
| 79 | - result = std::string(reinterpret_cast<char*>(this->sha384sum), sizeof(this->sha384sum)); | |
| 79 | + result = std::string(reinterpret_cast<char*>(sha384sum), sizeof(sha384sum)); | |
| 80 | 80 | break; |
| 81 | 81 | case 512: |
| 82 | - result = std::string(reinterpret_cast<char*>(this->sha512sum), sizeof(this->sha512sum)); | |
| 82 | + result = std::string(reinterpret_cast<char*>(sha512sum), sizeof(sha512sum)); | |
| 83 | 83 | break; |
| 84 | 84 | default: |
| 85 | 85 | badBits(); | ... | ... |