Commit 5906dd5c1f050af5d6eb2b9e9e5a0099e44b3ae6
1 parent
7bc0f1d8
Code tidy - Clang-Tidy rule modernize-use-default-member-init
Showing
21 changed files
with
131 additions
and
232 deletions
examples/pdf-count-strings.cc
| ... | ... | @@ -26,8 +26,7 @@ usage() |
| 26 | 26 | class StringCounter: public QPDFObjectHandle::TokenFilter |
| 27 | 27 | { |
| 28 | 28 | public: |
| 29 | - StringCounter() : | |
| 30 | - count(0) | |
| 29 | + StringCounter() | |
| 31 | 30 | { |
| 32 | 31 | } |
| 33 | 32 | ~StringCounter() override = default; |
| ... | ... | @@ -36,7 +35,7 @@ class StringCounter: public QPDFObjectHandle::TokenFilter |
| 36 | 35 | int getCount() const; |
| 37 | 36 | |
| 38 | 37 | private: |
| 39 | - int count; | |
| 38 | + int count{0}; | |
| 40 | 39 | }; |
| 41 | 40 | |
| 42 | 41 | void | ... | ... |
examples/pdf-create.cc
| ... | ... | @@ -31,22 +31,18 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider |
| 31 | 31 | size_t getHeight() const; |
| 32 | 32 | |
| 33 | 33 | private: |
| 34 | - size_t width; | |
| 35 | - size_t stripe_height; | |
| 34 | + size_t width{400}; | |
| 35 | + size_t stripe_height{80}; | |
| 36 | 36 | std::string color_space; |
| 37 | 37 | std::string filter; |
| 38 | - size_t n_stripes; | |
| 38 | + size_t n_stripes{6}; | |
| 39 | 39 | std::vector<std::string> stripes; |
| 40 | - J_COLOR_SPACE j_color_space; | |
| 40 | + J_COLOR_SPACE j_color_space{JCS_UNKNOWN}; | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) : |
| 44 | - width(400), | |
| 45 | - stripe_height(80), | |
| 46 | 44 | color_space(color_space), |
| 47 | - filter(filter), | |
| 48 | - n_stripes(6), | |
| 49 | - j_color_space(JCS_UNKNOWN) | |
| 45 | + filter(filter) | |
| 50 | 46 | { |
| 51 | 47 | if (color_space == "/DeviceCMYK") { |
| 52 | 48 | j_color_space = JCS_CMYK; | ... | ... |
include/qpdf/InputSource.hh
| ... | ... | @@ -33,8 +33,7 @@ class QPDF_DLL_CLASS InputSource |
| 33 | 33 | { |
| 34 | 34 | public: |
| 35 | 35 | QPDF_DLL |
| 36 | - InputSource() : | |
| 37 | - last_offset(0) | |
| 36 | + InputSource() | |
| 38 | 37 | { |
| 39 | 38 | } |
| 40 | 39 | QPDF_DLL |
| ... | ... | @@ -86,7 +85,7 @@ class QPDF_DLL_CLASS InputSource |
| 86 | 85 | inline void loadBuffer(); |
| 87 | 86 | |
| 88 | 87 | protected: |
| 89 | - qpdf_offset_t last_offset; | |
| 88 | + qpdf_offset_t last_offset{0}; | |
| 90 | 89 | |
| 91 | 90 | private: |
| 92 | 91 | class QPDF_DLL_PRIVATE Members | ... | ... |
include/qpdf/QPDF.hh
| ... | ... | @@ -1150,58 +1150,40 @@ class QPDF |
| 1150 | 1150 | // PDF 1.4: Table F.4 |
| 1151 | 1151 | struct HPageOffsetEntry |
| 1152 | 1152 | { |
| 1153 | - HPageOffsetEntry() : | |
| 1154 | - delta_nobjects(0), | |
| 1155 | - delta_page_length(0), | |
| 1156 | - nshared_objects(0), | |
| 1157 | - delta_content_offset(0), | |
| 1158 | - delta_content_length(0) | |
| 1153 | + HPageOffsetEntry() | |
| 1159 | 1154 | { |
| 1160 | 1155 | } |
| 1161 | 1156 | |
| 1162 | - int delta_nobjects; // 1 | |
| 1163 | - qpdf_offset_t delta_page_length; // 2 | |
| 1164 | - int nshared_objects; // 3 | |
| 1157 | + int delta_nobjects{0}; // 1 | |
| 1158 | + qpdf_offset_t delta_page_length{0}; // 2 | |
| 1165 | 1159 | // vectors' sizes = nshared_objects |
| 1166 | - std::vector<int> shared_identifiers; // 4 | |
| 1167 | - std::vector<int> shared_numerators; // 5 | |
| 1168 | - qpdf_offset_t delta_content_offset; // 6 | |
| 1169 | - qpdf_offset_t delta_content_length; // 7 | |
| 1160 | + int nshared_objects{0}; // 3 | |
| 1161 | + std::vector<int> shared_identifiers; // 4 | |
| 1162 | + std::vector<int> shared_numerators; // 5 | |
| 1163 | + qpdf_offset_t delta_content_offset{0}; // 6 | |
| 1164 | + qpdf_offset_t delta_content_length{0}; // 7 | |
| 1170 | 1165 | }; |
| 1171 | 1166 | |
| 1172 | 1167 | // PDF 1.4: Table F.3 |
| 1173 | 1168 | struct HPageOffset |
| 1174 | 1169 | { |
| 1175 | - HPageOffset() : | |
| 1176 | - min_nobjects(0), | |
| 1177 | - first_page_offset(0), | |
| 1178 | - nbits_delta_nobjects(0), | |
| 1179 | - min_page_length(0), | |
| 1180 | - nbits_delta_page_length(0), | |
| 1181 | - min_content_offset(0), | |
| 1182 | - nbits_delta_content_offset(0), | |
| 1183 | - min_content_length(0), | |
| 1184 | - nbits_delta_content_length(0), | |
| 1185 | - nbits_nshared_objects(0), | |
| 1186 | - nbits_shared_identifier(0), | |
| 1187 | - nbits_shared_numerator(0), | |
| 1188 | - shared_denominator(0) | |
| 1170 | + HPageOffset() | |
| 1189 | 1171 | { |
| 1190 | 1172 | } |
| 1191 | 1173 | |
| 1192 | - int min_nobjects; // 1 | |
| 1193 | - qpdf_offset_t first_page_offset; // 2 | |
| 1194 | - int nbits_delta_nobjects; // 3 | |
| 1195 | - int min_page_length; // 4 | |
| 1196 | - int nbits_delta_page_length; // 5 | |
| 1197 | - int min_content_offset; // 6 | |
| 1198 | - int nbits_delta_content_offset; // 7 | |
| 1199 | - int min_content_length; // 8 | |
| 1200 | - int nbits_delta_content_length; // 9 | |
| 1201 | - int nbits_nshared_objects; // 10 | |
| 1202 | - int nbits_shared_identifier; // 11 | |
| 1203 | - int nbits_shared_numerator; // 12 | |
| 1204 | - int shared_denominator; // 13 | |
| 1174 | + int min_nobjects{0}; // 1 | |
| 1175 | + qpdf_offset_t first_page_offset{0}; // 2 | |
| 1176 | + int nbits_delta_nobjects{0}; // 3 | |
| 1177 | + int min_page_length{0}; // 4 | |
| 1178 | + int nbits_delta_page_length{0}; // 5 | |
| 1179 | + int min_content_offset{0}; // 6 | |
| 1180 | + int nbits_delta_content_offset{0}; // 7 | |
| 1181 | + int min_content_length{0}; // 8 | |
| 1182 | + int nbits_delta_content_length{0}; // 9 | |
| 1183 | + int nbits_nshared_objects{0}; // 10 | |
| 1184 | + int nbits_shared_identifier{0}; // 11 | |
| 1185 | + int nbits_shared_numerator{0}; // 12 | |
| 1186 | + int shared_denominator{0}; // 13 | |
| 1205 | 1187 | // vector size is npages |
| 1206 | 1188 | std::vector<HPageOffsetEntry> entries; |
| 1207 | 1189 | }; |
| ... | ... | @@ -1209,40 +1191,30 @@ class QPDF |
| 1209 | 1191 | // PDF 1.4: Table F.6 |
| 1210 | 1192 | struct HSharedObjectEntry |
| 1211 | 1193 | { |
| 1212 | - HSharedObjectEntry() : | |
| 1213 | - delta_group_length(0), | |
| 1214 | - signature_present(0), | |
| 1215 | - nobjects_minus_one(0) | |
| 1194 | + HSharedObjectEntry() | |
| 1216 | 1195 | { |
| 1217 | 1196 | } |
| 1218 | 1197 | |
| 1219 | 1198 | // Item 3 is a 128-bit signature (unsupported by Acrobat) |
| 1220 | - int delta_group_length; // 1 | |
| 1221 | - int signature_present; // 2 -- always 0 | |
| 1222 | - int nobjects_minus_one; // 4 -- always 0 | |
| 1199 | + int delta_group_length{0}; // 1 | |
| 1200 | + int signature_present{0}; // 2 -- always 0 | |
| 1201 | + int nobjects_minus_one{0}; // 4 -- always 0 | |
| 1223 | 1202 | }; |
| 1224 | 1203 | |
| 1225 | 1204 | // PDF 1.4: Table F.5 |
| 1226 | 1205 | struct HSharedObject |
| 1227 | 1206 | { |
| 1228 | - HSharedObject() : | |
| 1229 | - first_shared_obj(0), | |
| 1230 | - first_shared_offset(0), | |
| 1231 | - nshared_first_page(0), | |
| 1232 | - nshared_total(0), | |
| 1233 | - nbits_nobjects(0), | |
| 1234 | - min_group_length(0), | |
| 1235 | - nbits_delta_group_length(0) | |
| 1207 | + HSharedObject() | |
| 1236 | 1208 | { |
| 1237 | 1209 | } |
| 1238 | 1210 | |
| 1239 | - int first_shared_obj; // 1 | |
| 1240 | - qpdf_offset_t first_shared_offset; // 2 | |
| 1241 | - int nshared_first_page; // 3 | |
| 1242 | - int nshared_total; // 4 | |
| 1243 | - int nbits_nobjects; // 5 | |
| 1244 | - int min_group_length; // 6 | |
| 1245 | - int nbits_delta_group_length; // 7 | |
| 1211 | + int first_shared_obj{0}; // 1 | |
| 1212 | + qpdf_offset_t first_shared_offset{0}; // 2 | |
| 1213 | + int nshared_first_page{0}; // 3 | |
| 1214 | + int nshared_total{0}; // 4 | |
| 1215 | + int nbits_nobjects{0}; // 5 | |
| 1216 | + int min_group_length{0}; // 6 | |
| 1217 | + int nbits_delta_group_length{0}; // 7 | |
| 1246 | 1218 | // vector size is nshared_total |
| 1247 | 1219 | std::vector<HSharedObjectEntry> entries; |
| 1248 | 1220 | }; |
| ... | ... | @@ -1250,18 +1222,14 @@ class QPDF |
| 1250 | 1222 | // PDF 1.4: Table F.9 |
| 1251 | 1223 | struct HGeneric |
| 1252 | 1224 | { |
| 1253 | - HGeneric() : | |
| 1254 | - first_object(0), | |
| 1255 | - first_object_offset(0), | |
| 1256 | - nobjects(0), | |
| 1257 | - group_length(0) | |
| 1225 | + HGeneric() | |
| 1258 | 1226 | { |
| 1259 | 1227 | } |
| 1260 | 1228 | |
| 1261 | - int first_object; // 1 | |
| 1262 | - qpdf_offset_t first_object_offset; // 2 | |
| 1263 | - int nobjects; // 3 | |
| 1264 | - int group_length; // 4 | |
| 1229 | + int first_object{0}; // 1 | |
| 1230 | + qpdf_offset_t first_object_offset{0}; // 2 | |
| 1231 | + int nobjects{0}; // 3 | |
| 1232 | + int group_length{0}; // 4 | |
| 1265 | 1233 | }; |
| 1266 | 1234 | |
| 1267 | 1235 | // Other linearization data structures |
| ... | ... | @@ -1269,26 +1237,18 @@ class QPDF |
| 1269 | 1237 | // Initialized from Linearization Parameter dictionary |
| 1270 | 1238 | struct LinParameters |
| 1271 | 1239 | { |
| 1272 | - LinParameters() : | |
| 1273 | - file_size(0), | |
| 1274 | - first_page_object(0), | |
| 1275 | - first_page_end(0), | |
| 1276 | - npages(0), | |
| 1277 | - xref_zero_offset(0), | |
| 1278 | - first_page(0), | |
| 1279 | - H_offset(0), | |
| 1280 | - H_length(0) | |
| 1240 | + LinParameters() | |
| 1281 | 1241 | { |
| 1282 | 1242 | } |
| 1283 | 1243 | |
| 1284 | - qpdf_offset_t file_size; // /L | |
| 1285 | - int first_page_object; // /O | |
| 1286 | - qpdf_offset_t first_page_end; // /E | |
| 1287 | - int npages; // /N | |
| 1288 | - qpdf_offset_t xref_zero_offset; // /T | |
| 1289 | - int first_page; // /P | |
| 1290 | - qpdf_offset_t H_offset; // offset of primary hint stream | |
| 1291 | - qpdf_offset_t H_length; // length of primary hint stream | |
| 1244 | + qpdf_offset_t file_size{0}; // /L | |
| 1245 | + int first_page_object{0}; // /O | |
| 1246 | + qpdf_offset_t first_page_end{0}; // /E | |
| 1247 | + int npages{0}; // /N | |
| 1248 | + qpdf_offset_t xref_zero_offset{0}; // /T | |
| 1249 | + int first_page{0}; // /P | |
| 1250 | + qpdf_offset_t H_offset{0}; // offset of primary hint stream | |
| 1251 | + qpdf_offset_t H_length{0}; // length of primary hint stream | |
| 1292 | 1252 | }; |
| 1293 | 1253 | |
| 1294 | 1254 | // Computed hint table value data structures. These tables contain the computed values on which |
| ... | ... | @@ -1304,14 +1264,12 @@ class QPDF |
| 1304 | 1264 | |
| 1305 | 1265 | struct CHPageOffsetEntry |
| 1306 | 1266 | { |
| 1307 | - CHPageOffsetEntry() : | |
| 1308 | - nobjects(0), | |
| 1309 | - nshared_objects(0) | |
| 1267 | + CHPageOffsetEntry() | |
| 1310 | 1268 | { |
| 1311 | 1269 | } |
| 1312 | 1270 | |
| 1313 | - int nobjects; | |
| 1314 | - int nshared_objects; | |
| 1271 | + int nobjects{0}; | |
| 1272 | + int nshared_objects{0}; | |
| 1315 | 1273 | // vectors' sizes = nshared_objects |
| 1316 | 1274 | std::vector<int> shared_identifiers; |
| 1317 | 1275 | }; |
| ... | ... | @@ -1335,16 +1293,13 @@ class QPDF |
| 1335 | 1293 | // PDF 1.4: Table F.5 |
| 1336 | 1294 | struct CHSharedObject |
| 1337 | 1295 | { |
| 1338 | - CHSharedObject() : | |
| 1339 | - first_shared_obj(0), | |
| 1340 | - nshared_first_page(0), | |
| 1341 | - nshared_total(0) | |
| 1296 | + CHSharedObject() | |
| 1342 | 1297 | { |
| 1343 | 1298 | } |
| 1344 | 1299 | |
| 1345 | - int first_shared_obj; | |
| 1346 | - int nshared_first_page; | |
| 1347 | - int nshared_total; | |
| 1300 | + int first_shared_obj{0}; | |
| 1301 | + int nshared_first_page{0}; | |
| 1302 | + int nshared_total{0}; | |
| 1348 | 1303 | // vector size is nshared_total |
| 1349 | 1304 | std::vector<CHSharedObjectEntry> entries; |
| 1350 | 1305 | }; | ... | ... |
include/qpdf/QPDFJob.hh
| ... | ... | @@ -145,8 +145,7 @@ class QPDFJob |
| 145 | 145 | |
| 146 | 146 | struct AddAttachment |
| 147 | 147 | { |
| 148 | - AddAttachment() : | |
| 149 | - replace(false) | |
| 148 | + AddAttachment() | |
| 150 | 149 | { |
| 151 | 150 | } |
| 152 | 151 | |
| ... | ... | @@ -157,7 +156,7 @@ class QPDFJob |
| 157 | 156 | std::string moddate; |
| 158 | 157 | std::string mimetype; |
| 159 | 158 | std::string description; |
| 160 | - bool replace; | |
| 159 | + bool replace{false}; | |
| 161 | 160 | }; |
| 162 | 161 | |
| 163 | 162 | struct PageSpec | ... | ... |
include/qpdf/QPDFObjGen.hh
libqpdf/JSON.cc
| ... | ... | @@ -588,14 +588,7 @@ namespace |
| 588 | 588 | JSONParser(InputSource& is, JSON::Reactor* reactor) : |
| 589 | 589 | is(is), |
| 590 | 590 | reactor(reactor), |
| 591 | - lex_state(ls_top), | |
| 592 | - bytes(0), | |
| 593 | - p(buf), | |
| 594 | - u_count(0), | |
| 595 | - offset(0), | |
| 596 | - done(false), | |
| 597 | - parser_state(ps_top), | |
| 598 | - dict_key_offset(0) | |
| 591 | + p(buf) | |
| 599 | 592 | { |
| 600 | 593 | } |
| 601 | 594 | |
| ... | ... | @@ -665,20 +658,20 @@ namespace |
| 665 | 658 | |
| 666 | 659 | InputSource& is; |
| 667 | 660 | JSON::Reactor* reactor; |
| 668 | - lex_state_e lex_state; | |
| 661 | + lex_state_e lex_state{ls_top}; | |
| 669 | 662 | char buf[16384]; |
| 670 | - size_t bytes; | |
| 663 | + size_t bytes{0}; | |
| 671 | 664 | char const* p; |
| 672 | - qpdf_offset_t u_count; | |
| 665 | + qpdf_offset_t u_count{0}; | |
| 673 | 666 | unsigned long u_value{0}; |
| 674 | - qpdf_offset_t offset; | |
| 675 | - bool done; | |
| 667 | + qpdf_offset_t offset{0}; | |
| 668 | + bool done{false}; | |
| 676 | 669 | std::string token; |
| 677 | 670 | qpdf_offset_t token_start{0}; |
| 678 | - parser_state_e parser_state; | |
| 671 | + parser_state_e parser_state{ps_top}; | |
| 679 | 672 | std::vector<StackFrame> stack; |
| 680 | 673 | std::string dict_key; |
| 681 | - qpdf_offset_t dict_key_offset; | |
| 674 | + qpdf_offset_t dict_key_offset{0}; | |
| 682 | 675 | }; |
| 683 | 676 | } // namespace |
| 684 | 677 | ... | ... |
libqpdf/QPDFAcroFormDocumentHelper.cc
| ... | ... | @@ -473,15 +473,14 @@ namespace |
| 473 | 473 | virtual void handleToken(QPDFTokenizer::Token const&) override; |
| 474 | 474 | |
| 475 | 475 | private: |
| 476 | - size_t offset; | |
| 476 | + size_t offset{0}; | |
| 477 | 477 | std::map<std::string, std::map<size_t, std::string>> to_replace; |
| 478 | 478 | }; |
| 479 | 479 | } // namespace |
| 480 | 480 | |
| 481 | 481 | ResourceReplacer::ResourceReplacer( |
| 482 | 482 | std::map<std::string, std::map<std::string, std::string>> const& dr_map, |
| 483 | - std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames) : | |
| 484 | - offset(0) | |
| 483 | + std::map<std::string, std::map<std::string, std::set<size_t>>> const& rnames) | |
| 485 | 484 | { |
| 486 | 485 | // We have: |
| 487 | 486 | // * dr_map[resource_type][key] == new_key | ... | ... |
libqpdf/QPDFFormFieldObjectHelper.cc
| ... | ... | @@ -481,8 +481,8 @@ namespace |
| 481 | 481 | std::vector<std::string> opt; |
| 482 | 482 | double tf; |
| 483 | 483 | QPDFObjectHandle::Rectangle bbox; |
| 484 | - enum { st_top, st_bmc, st_emc, st_end } state; | |
| 485 | - bool replaced; | |
| 484 | + enum { st_top, st_bmc, st_emc, st_end } state{st_top}; | |
| 485 | + bool replaced{false}; | |
| 486 | 486 | }; |
| 487 | 487 | } // namespace |
| 488 | 488 | |
| ... | ... | @@ -496,9 +496,7 @@ ValueSetter::ValueSetter( |
| 496 | 496 | V(V), |
| 497 | 497 | opt(opt), |
| 498 | 498 | tf(tf), |
| 499 | - bbox(bbox), | |
| 500 | - state(st_top), | |
| 501 | - replaced(false) | |
| 499 | + bbox(bbox) | |
| 502 | 500 | { |
| 503 | 501 | } |
| 504 | 502 | |
| ... | ... | @@ -659,21 +657,17 @@ namespace |
| 659 | 657 | std::string getDA(); |
| 660 | 658 | |
| 661 | 659 | private: |
| 662 | - double tf; | |
| 663 | - int tf_idx; | |
| 660 | + double tf{11.0}; | |
| 661 | + int tf_idx{-1}; | |
| 664 | 662 | std::string font_name; |
| 665 | - double last_num; | |
| 666 | - int last_num_idx; | |
| 663 | + double last_num{0.0}; | |
| 664 | + int last_num_idx{-1}; | |
| 667 | 665 | std::string last_name; |
| 668 | 666 | std::vector<std::string> DA; |
| 669 | 667 | }; |
| 670 | 668 | } // namespace |
| 671 | 669 | |
| 672 | -TfFinder::TfFinder() : | |
| 673 | - tf(11.0), | |
| 674 | - tf_idx(-1), | |
| 675 | - last_num(0.0), | |
| 676 | - last_num_idx(-1) | |
| 670 | +TfFinder::TfFinder() | |
| 677 | 671 | { |
| 678 | 672 | } |
| 679 | 673 | ... | ... |
libqpdf/QPDFJob_argv.cc
| ... | ... | @@ -40,18 +40,15 @@ namespace |
| 40 | 40 | std::shared_ptr<QPDFJob::UOConfig> c_uo; |
| 41 | 41 | std::shared_ptr<QPDFJob::EncConfig> c_enc; |
| 42 | 42 | std::vector<std::string> accumulated_args; |
| 43 | - std::shared_ptr<char> pages_password; | |
| 44 | - bool gave_input; | |
| 45 | - bool gave_output; | |
| 43 | + std::shared_ptr<char> pages_password{nullptr}; | |
| 44 | + bool gave_input{false}; | |
| 45 | + bool gave_output{false}; | |
| 46 | 46 | }; |
| 47 | 47 | } // namespace |
| 48 | 48 | |
| 49 | 49 | ArgParser::ArgParser(QPDFArgParser& ap, std::shared_ptr<QPDFJob::Config> c_main) : |
| 50 | 50 | ap(ap), |
| 51 | - c_main(c_main), | |
| 52 | - pages_password(nullptr), | |
| 53 | - gave_input(false), | |
| 54 | - gave_output(false) | |
| 51 | + c_main(c_main) | |
| 55 | 52 | { |
| 56 | 53 | initOptionTables(); |
| 57 | 54 | } | ... | ... |
libqpdf/QPDFJob_json.cc
| ... | ... | @@ -59,7 +59,7 @@ namespace |
| 59 | 59 | |
| 60 | 60 | std::list<std::shared_ptr<JSONHandler>> json_handlers; |
| 61 | 61 | bool partial; |
| 62 | - JSONHandler* jh; // points to last of json_handlers | |
| 62 | + JSONHandler* jh{nullptr}; // points to last of json_handlers | |
| 63 | 63 | std::shared_ptr<QPDFJob::Config> c_main; |
| 64 | 64 | std::shared_ptr<QPDFJob::CopyAttConfig> c_copy_att; |
| 65 | 65 | std::shared_ptr<QPDFJob::AttConfig> c_att; |
| ... | ... | @@ -71,7 +71,6 @@ namespace |
| 71 | 71 | |
| 72 | 72 | Handlers::Handlers(bool partial, std::shared_ptr<QPDFJob::Config> c_main) : |
| 73 | 73 | partial(partial), |
| 74 | - jh(nullptr), | |
| 75 | 74 | c_main(c_main) |
| 76 | 75 | { |
| 77 | 76 | initHandlers(); | ... | ... |
libqpdf/QPDFLogger.cc
| ... | ... | @@ -12,8 +12,7 @@ namespace |
| 12 | 12 | { |
| 13 | 13 | public: |
| 14 | 14 | Pl_Track(char const* identifier, Pipeline* next) : |
| 15 | - Pipeline(identifier, next), | |
| 16 | - used(false) | |
| 15 | + Pipeline(identifier, next) | |
| 17 | 16 | { |
| 18 | 17 | } |
| 19 | 18 | |
| ... | ... | @@ -37,7 +36,7 @@ namespace |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | 38 | private: |
| 40 | - bool used; | |
| 39 | + bool used{false}; | |
| 41 | 40 | }; |
| 42 | 41 | }; // namespace |
| 43 | 42 | ... | ... |
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -189,13 +189,12 @@ namespace |
| 189 | 189 | unsigned char getLastChar(); |
| 190 | 190 | |
| 191 | 191 | private: |
| 192 | - unsigned char last_char; | |
| 192 | + unsigned char last_char{0}; | |
| 193 | 193 | }; |
| 194 | 194 | } // namespace |
| 195 | 195 | |
| 196 | 196 | LastChar::LastChar(Pipeline* next) : |
| 197 | - Pipeline("lastchar", next), | |
| 198 | - last_char(0) | |
| 197 | + Pipeline("lastchar", next) | |
| 199 | 198 | { |
| 200 | 199 | } |
| 201 | 200 | ... | ... |
libqpdf/QPDFPageObjectHelper.cc
| ... | ... | @@ -53,19 +53,16 @@ namespace |
| 53 | 53 | QPDFObjectHandle resources; |
| 54 | 54 | std::string dict_str; |
| 55 | 55 | std::string bi_str; |
| 56 | - int min_suffix; | |
| 57 | - bool any_images; | |
| 58 | - enum { st_top, st_bi } state; | |
| 56 | + int min_suffix{1}; | |
| 57 | + bool any_images{false}; | |
| 58 | + enum { st_top, st_bi } state{st_top}; | |
| 59 | 59 | }; |
| 60 | 60 | } // namespace |
| 61 | 61 | |
| 62 | 62 | InlineImageTracker::InlineImageTracker(QPDF* qpdf, size_t min_size, QPDFObjectHandle resources) : |
| 63 | 63 | qpdf(qpdf), |
| 64 | 64 | min_size(min_size), |
| 65 | - resources(resources), | |
| 66 | - min_suffix(1), | |
| 67 | - any_images(false), | |
| 68 | - state(st_top) | |
| 65 | + resources(resources) | |
| 69 | 66 | { |
| 70 | 67 | } |
| 71 | 68 | ... | ... |
libqpdf/QUtil.cc
| ... | ... | @@ -1082,13 +1082,12 @@ namespace |
| 1082 | 1082 | |
| 1083 | 1083 | private: |
| 1084 | 1084 | RandomDataProvider* default_provider; |
| 1085 | - RandomDataProvider* current_provider; | |
| 1085 | + RandomDataProvider* current_provider{nullptr}; | |
| 1086 | 1086 | }; |
| 1087 | 1087 | } // namespace |
| 1088 | 1088 | |
| 1089 | 1089 | RandomDataProviderProvider::RandomDataProviderProvider() : |
| 1090 | - default_provider(CryptoRandomDataProvider::getInstance()), | |
| 1091 | - current_provider(nullptr) | |
| 1090 | + default_provider(CryptoRandomDataProvider::getInstance()) | |
| 1092 | 1091 | { |
| 1093 | 1092 | this->current_provider = default_provider; |
| 1094 | 1093 | } | ... | ... |
libqpdf/qpdf/QPDFArgParser.hh
| ... | ... | @@ -145,19 +145,15 @@ class QPDFArgParser |
| 145 | 145 | private: |
| 146 | 146 | struct OptionEntry |
| 147 | 147 | { |
| 148 | - OptionEntry() : | |
| 149 | - parameter_needed(false), | |
| 150 | - bare_arg_handler(nullptr), | |
| 151 | - param_arg_handler(nullptr), | |
| 152 | - invalid_choice_handler(nullptr) | |
| 148 | + OptionEntry() | |
| 153 | 149 | { |
| 154 | 150 | } |
| 155 | - bool parameter_needed; | |
| 151 | + bool parameter_needed{false}; | |
| 156 | 152 | std::string parameter_name; |
| 157 | 153 | std::set<std::string> choices; |
| 158 | - bare_arg_handler_t bare_arg_handler; | |
| 159 | - param_arg_handler_t param_arg_handler; | |
| 160 | - param_arg_handler_t invalid_choice_handler; | |
| 154 | + bare_arg_handler_t bare_arg_handler{nullptr}; | |
| 155 | + param_arg_handler_t param_arg_handler{nullptr}; | |
| 156 | + param_arg_handler_t invalid_choice_handler{nullptr}; | |
| 161 | 157 | }; |
| 162 | 158 | typedef std::map<std::string, OptionEntry> option_table_t; |
| 163 | 159 | ... | ... |
libtests/arg_parser.cc
| ... | ... | @@ -28,12 +28,11 @@ class ArgParser |
| 28 | 28 | void output(std::string const&); |
| 29 | 29 | |
| 30 | 30 | QPDFArgParser ap; |
| 31 | - int quacks; | |
| 31 | + int quacks{0}; | |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | ArgParser::ArgParser(int argc, char* argv[]) : |
| 35 | - ap(QPDFArgParser(argc, argv, "TEST_ARG_PARSER")), | |
| 36 | - quacks(0) | |
| 35 | + ap(QPDFArgParser(argc, argv, "TEST_ARG_PARSER")) | |
| 37 | 36 | { |
| 38 | 37 | initOptions(); |
| 39 | 38 | } | ... | ... |
libtests/dct_compress.cc
| ... | ... | @@ -10,21 +10,19 @@ |
| 10 | 10 | static void |
| 11 | 11 | usage() |
| 12 | 12 | { |
| 13 | - std::cerr << "Usage: dct_compress infile outfile width height" | |
| 14 | - << " {rgb|cmyk|gray}" << std::endl; | |
| 13 | + std::cerr << "Usage: dct_compress infile outfile width height {rgb|cmyk|gray}" << std::endl; | |
| 15 | 14 | exit(2); |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | 17 | class Callback: public Pl_DCT::CompressConfig |
| 19 | 18 | { |
| 20 | 19 | public: |
| 21 | - Callback() : | |
| 22 | - called(false) | |
| 20 | + Callback() | |
| 23 | 21 | { |
| 24 | 22 | } |
| 25 | 23 | ~Callback() override = default; |
| 26 | 24 | void apply(jpeg_compress_struct*) override; |
| 27 | - bool called; | |
| 25 | + bool called{false}; | |
| 28 | 26 | }; |
| 29 | 27 | |
| 30 | 28 | void | ... | ... |
qpdf/fix-qdf.cc
| ... | ... | @@ -46,42 +46,29 @@ class QdfFixer |
| 46 | 46 | st_before_trailer, |
| 47 | 47 | st_in_trailer, |
| 48 | 48 | st_done, |
| 49 | - } state; | |
| 49 | + } state{st_top}; | |
| 50 | 50 | |
| 51 | - size_t lineno; | |
| 52 | - qpdf_offset_t offset; | |
| 53 | - qpdf_offset_t last_offset; | |
| 54 | - int last_obj; | |
| 51 | + size_t lineno{0}; | |
| 52 | + qpdf_offset_t offset{0}; | |
| 53 | + qpdf_offset_t last_offset{0}; | |
| 54 | + int last_obj{0}; | |
| 55 | 55 | std::vector<QPDFXRefEntry> xref; |
| 56 | - qpdf_offset_t stream_start; | |
| 57 | - size_t stream_length; | |
| 58 | - qpdf_offset_t xref_offset; | |
| 59 | - size_t xref_f1_nbytes; | |
| 60 | - size_t xref_f2_nbytes; | |
| 61 | - size_t xref_size; | |
| 56 | + qpdf_offset_t stream_start{0}; | |
| 57 | + size_t stream_length{0}; | |
| 58 | + qpdf_offset_t xref_offset{0}; | |
| 59 | + size_t xref_f1_nbytes{0}; | |
| 60 | + size_t xref_f2_nbytes{0}; | |
| 61 | + size_t xref_size{0}; | |
| 62 | 62 | std::vector<std::string_view> ostream; |
| 63 | 63 | std::vector<qpdf_offset_t> ostream_offsets; |
| 64 | 64 | std::vector<std::string_view> ostream_discarded; |
| 65 | - size_t ostream_idx; | |
| 66 | - int ostream_id; | |
| 65 | + size_t ostream_idx{0}; | |
| 66 | + int ostream_id{0}; | |
| 67 | 67 | std::string ostream_extends; |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | 70 | QdfFixer::QdfFixer(std::string const& filename) : |
| 71 | - filename(filename), | |
| 72 | - state(st_top), | |
| 73 | - lineno(0), | |
| 74 | - offset(0), | |
| 75 | - last_offset(0), | |
| 76 | - last_obj(0), | |
| 77 | - stream_start(0), | |
| 78 | - stream_length(0), | |
| 79 | - xref_offset(0), | |
| 80 | - xref_f1_nbytes(0), | |
| 81 | - xref_f2_nbytes(0), | |
| 82 | - xref_size(0), | |
| 83 | - ostream_idx(0), | |
| 84 | - ostream_id(0) | |
| 71 | + filename(filename) | |
| 85 | 72 | { |
| 86 | 73 | } |
| 87 | 74 | ... | ... |
qpdf/test_driver.cc
| ... | ... | @@ -68,16 +68,15 @@ class Provider: public QPDFObjectHandle::StreamDataProvider |
| 68 | 68 | { |
| 69 | 69 | public: |
| 70 | 70 | Provider(std::shared_ptr<Buffer> b) : |
| 71 | - b(b), | |
| 72 | - bad_length(false) | |
| 71 | + b(b) | |
| 73 | 72 | { |
| 74 | 73 | } |
| 75 | 74 | virtual ~Provider() = default; |
| 76 | 75 | virtual void |
| 77 | 76 | provideStreamData(int objid, int generation, Pipeline* p) |
| 78 | 77 | { |
| 79 | - // Don't change signature to use QPDFObjGen const& to detect | |
| 80 | - // problems forwarding to legacy implementations. | |
| 78 | + // Don't change signature to use QPDFObjGen const& to detect problems forwarding to legacy | |
| 79 | + // implementations. | |
| 81 | 80 | p->write(b->getBuffer(), b->getSize()); |
| 82 | 81 | if (this->bad_length) { |
| 83 | 82 | unsigned char ch = ' '; |
| ... | ... | @@ -93,7 +92,7 @@ class Provider: public QPDFObjectHandle::StreamDataProvider |
| 93 | 92 | |
| 94 | 93 | private: |
| 95 | 94 | std::shared_ptr<Buffer> b; |
| 96 | - bool bad_length; | |
| 95 | + bool bad_length{false}; | |
| 97 | 96 | }; |
| 98 | 97 | |
| 99 | 98 | class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks | ... | ... |
qpdf/test_large_file.cc
| ... | ... | @@ -67,15 +67,13 @@ class ImageChecker: public Pipeline |
| 67 | 67 | |
| 68 | 68 | private: |
| 69 | 69 | size_t n; |
| 70 | - size_t offset; | |
| 71 | - bool okay; | |
| 70 | + size_t offset{0}; | |
| 71 | + bool okay{true}; | |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | ImageChecker::ImageChecker(size_t n) : |
| 75 | 75 | Pipeline("image checker", nullptr), |
| 76 | - n(n), | |
| 77 | - offset(0), | |
| 78 | - okay(true) | |
| 76 | + n(n) | |
| 79 | 77 | { |
| 80 | 78 | } |
| 81 | 79 | ... | ... |