Commit 7ede03992a963d56754fc522f4c6f0bf944947cd

Authored by m-holger
1 parent a9b5ebef

Remove 'this->' from QPDFTokenizer.cc and QPDFAcroFormDocumentHelper.cc

libqpdf/QPDFAcroFormDocumentHelper.cc
... ... @@ -34,16 +34,16 @@ QPDFAcroFormDocumentHelper::invalidateCache()
34 34 bool
35 35 QPDFAcroFormDocumentHelper::hasAcroForm()
36 36 {
37   - return this->qpdf.getRoot().hasKey("/AcroForm");
  37 + return qpdf.getRoot().hasKey("/AcroForm");
38 38 }
39 39  
40 40 QPDFObjectHandle
41 41 QPDFAcroFormDocumentHelper::getOrCreateAcroForm()
42 42 {
43   - auto acroform = this->qpdf.getRoot().getKey("/AcroForm");
  43 + auto acroform = qpdf.getRoot().getKey("/AcroForm");
44 44 if (!acroform.isDictionary()) {
45   - acroform = this->qpdf.getRoot().replaceKeyAndGetNew(
46   - "/AcroForm", this->qpdf.makeIndirectObject(QPDFObjectHandle::newDictionary()));
  45 + acroform = qpdf.getRoot().replaceKeyAndGetNew(
  46 + "/AcroForm", qpdf.makeIndirectObject(QPDFObjectHandle::newDictionary()));
47 47 }
48 48 return acroform;
49 49 }
... ... @@ -115,7 +115,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle>
115 115 void
116 116 QPDFAcroFormDocumentHelper::removeFormFields(std::set<QPDFObjGen> const& to_remove)
117 117 {
118   - auto acroform = this->qpdf.getRoot().getKey("/AcroForm");
  118 + auto acroform = qpdf.getRoot().getKey("/AcroForm");
119 119 if (!acroform.isDictionary()) {
120 120 return;
121 121 }
... ... @@ -168,7 +168,7 @@ QPDFAcroFormDocumentHelper::getFormFields()
168 168 analyze();
169 169 std::vector<QPDFFormFieldObjectHelper> result;
170 170 for (auto const& iter: m->field_to_annotations) {
171   - result.emplace_back(this->qpdf.getObject(iter.first));
  171 + result.emplace_back(qpdf.getObject(iter.first));
172 172 }
173 173 return result;
174 174 }
... ... @@ -267,7 +267,7 @@ QPDFAcroFormDocumentHelper::analyze()
267 267 // a file that contains this kind of error will probably not
268 268 // actually work with most viewers.
269 269  
270   - for (auto const& ph: QPDFPageDocumentHelper(this->qpdf).getAllPages()) {
  270 + for (auto const& ph: QPDFPageDocumentHelper(qpdf).getAllPages()) {
271 271 for (auto const& iter: getWidgetAnnotationsForPage(ph)) {
272 272 QPDFObjectHandle annot(iter.getObjectHandle());
273 273 QPDFObjGen og(annot.getObjGen());
... ... @@ -368,7 +368,7 @@ bool
368 368 QPDFAcroFormDocumentHelper::getNeedAppearances()
369 369 {
370 370 bool result = false;
371   - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm");
  371 + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
372 372 if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) {
373 373 result = acroform.getKey("/NeedAppearances").getBoolValue();
374 374 }
... ... @@ -378,9 +378,9 @@ QPDFAcroFormDocumentHelper::getNeedAppearances()
378 378 void
379 379 QPDFAcroFormDocumentHelper::setNeedAppearances(bool val)
380 380 {
381   - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm");
  381 + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
382 382 if (!acroform.isDictionary()) {
383   - this->qpdf.getRoot().warnIfPossible(
  383 + qpdf.getRoot().warnIfPossible(
384 384 "ignoring call to QPDFAcroFormDocumentHelper::setNeedAppearances"
385 385 " on a file that lacks an /AcroForm dictionary");
386 386 return;
... ... @@ -399,7 +399,7 @@ QPDFAcroFormDocumentHelper::generateAppearancesIfNeeded()
399 399 return;
400 400 }
401 401  
402   - for (auto const& page: QPDFPageDocumentHelper(this->qpdf).getAllPages()) {
  402 + for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
403 403 for (auto& aoh: getWidgetAnnotationsForPage(page)) {
404 404 QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh);
405 405 if (ffh.getFieldType() == "/Btn") {
... ... @@ -548,7 +548,7 @@ ResourceReplacer::handleToken(QPDFTokenizer::Token const&amp; token)
548 548 wrote = true;
549 549 }
550 550 }
551   - this->offset += token.getRawValue().length();
  551 + offset += token.getRawValue().length();
552 552 if (!wrote) {
553 553 writeToken(token);
554 554 }
... ... @@ -590,11 +590,11 @@ QPDFAcroFormDocumentHelper::adjustDefaultAppearances(
590 590 // stream out of the string and then filter it. We don't attach the stream to anything, so it
591 591 // will get discarded.
592 592 ResourceFinder rf;
593   - auto da_stream = QPDFObjectHandle::newStream(&this->qpdf, DA.getUTF8Value());
  593 + auto da_stream = QPDFObjectHandle::newStream(&qpdf, DA.getUTF8Value());
594 594 try {
595   - auto nwarnings = this->qpdf.numWarnings();
  595 + auto nwarnings = qpdf.numWarnings();
596 596 da_stream.parseAsContents(&rf);
597   - if (this->qpdf.numWarnings() > nwarnings) {
  597 + if (qpdf.numWarnings() > nwarnings) {
598 598 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper /DA parse error");
599 599 }
600 600 } catch (std::exception& e) {
... ... @@ -632,7 +632,7 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream(
632 632 bool was_indirect = resources.isIndirect();
633 633 resources = resources.shallowCopy();
634 634 if (was_indirect) {
635   - resources = this->qpdf.makeIndirectObject(resources);
  635 + resources = qpdf.makeIndirectObject(resources);
636 636 }
637 637 dict.replaceKey("/Resources", resources);
638 638 // Create a dictionary with top-level keys so we can use mergeResources to force them to be
... ... @@ -683,9 +683,9 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream(
683 683 // Now attach a token filter to replace the actual resources.
684 684 ResourceFinder rf;
685 685 try {
686   - auto nwarnings = this->qpdf.numWarnings();
  686 + auto nwarnings = qpdf.numWarnings();
687 687 stream.parseAsContents(&rf);
688   - if (this->qpdf.numWarnings() > nwarnings) {
  688 + if (qpdf.numWarnings() > nwarnings) {
689 689 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper AP parse error");
690 690 }
691 691 auto rr = new ResourceReplacer(dr_map, rf.getNamesByResourceType());
... ... @@ -711,18 +711,18 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
711 711 std::shared_ptr<QPDFAcroFormDocumentHelper> afdhph;
712 712 if (!from_qpdf) {
713 713 // Assume these are from the same QPDF.
714   - from_qpdf = &this->qpdf;
  714 + from_qpdf = &qpdf;
715 715 from_afdh = this;
716   - } else if ((from_qpdf != &this->qpdf) && (!from_afdh)) {
  716 + } else if ((from_qpdf != &qpdf) && (!from_afdh)) {
717 717 afdhph = std::make_shared<QPDFAcroFormDocumentHelper>(*from_qpdf);
718 718 from_afdh = afdhph.get();
719 719 }
720   - bool foreign = (from_qpdf != &this->qpdf);
  720 + bool foreign = (from_qpdf != &qpdf);
721 721  
722 722 // It's possible that we will transform annotations that don't include any form fields. This
723 723 // code takes care not to muck around with /AcroForm unless we have to.
724 724  
725   - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm");
  725 + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
726 726 QPDFObjectHandle from_acroform = from_qpdf->getRoot().getKey("/AcroForm");
727 727  
728 728 // /DA and /Q may be inherited from the document-level /AcroForm dictionary. If we are copying a
... ... @@ -753,7 +753,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
753 753 if (!from_dr.isIndirect()) {
754 754 from_dr = from_qpdf->makeIndirectObject(from_dr);
755 755 }
756   - from_dr = this->qpdf.copyForeignObject(from_dr);
  756 + from_dr = qpdf.copyForeignObject(from_dr);
757 757 }
758 758 if (from_acroform.getKey("/DA").isString()) {
759 759 from_default_da = from_acroform.getKey("/DA").getUTF8Value();
... ... @@ -787,14 +787,14 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
787 787 if (!dr.isDictionary()) {
788 788 dr = QPDFObjectHandle::newDictionary();
789 789 }
790   - dr.makeResourcesIndirect(this->qpdf);
  790 + dr.makeResourcesIndirect(qpdf);
791 791 if (!dr.isIndirect()) {
792   - dr = acroform.replaceKeyAndGetNew("/DR", this->qpdf.makeIndirectObject(dr));
  792 + dr = acroform.replaceKeyAndGetNew("/DR", qpdf.makeIndirectObject(dr));
793 793 }
794 794 // Merge the other document's /DR, creating a conflict map. mergeResources checks to
795 795 // make sure both objects are dictionaries. By this point, if this is foreign, from_dr
796 796 // has been copied, so we use the target qpdf as the owning qpdf.
797   - from_dr.makeResourcesIndirect(this->qpdf);
  797 + from_dr.makeResourcesIndirect(qpdf);
798 798 dr.mergeResources(from_dr, &dr_map);
799 799  
800 800 if (from_afdh->getNeedAppearances()) {
... ... @@ -811,7 +811,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
811 811 to_copy = orig_to_copy[og];
812 812 return false;
813 813 } else {
814   - to_copy = this->qpdf.makeIndirectObject(to_copy.shallowCopy());
  814 + to_copy = qpdf.makeIndirectObject(to_copy.shallowCopy());
815 815 orig_to_copy[og] = to_copy;
816 816 return true;
817 817 }
... ... @@ -872,8 +872,8 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
872 872 // so we'll get the right object back.
873 873  
874 874 // top_field and ffield_oh are known to be indirect.
875   - top_field = this->qpdf.copyForeignObject(top_field);
876   - ffield_oh = this->qpdf.copyForeignObject(ffield_oh);
  875 + top_field = qpdf.copyForeignObject(top_field);
  876 + ffield_oh = qpdf.copyForeignObject(ffield_oh);
877 877 } else {
878 878 // We don't need to add top_field to old_fields if it's foreign because the new copy
879 879 // of the foreign field won't be referenced anywhere. It's just the starting point
... ... @@ -957,7 +957,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
957 957 if (!annot.isIndirect()) {
958 958 annot = from_qpdf->makeIndirectObject(annot);
959 959 }
960   - annot = this->qpdf.copyForeignObject(annot);
  960 + annot = qpdf.copyForeignObject(annot);
961 961 }
962 962 maybe_copy_object(annot);
963 963  
... ...
libqpdf/QPDFTokenizer.cc
... ... @@ -166,8 +166,8 @@ Tokenizer::presentCharacter(char ch)
166 166 {
167 167 handleCharacter(ch);
168 168  
169   - if (this->in_token) {
170   - this->raw_val += ch;
  169 + if (in_token) {
  170 + raw_val += ch;
171 171 }
172 172 }
173 173  
... ... @@ -177,7 +177,7 @@ Tokenizer::handleCharacter(char ch)
177 177 // In some cases, functions called below may call a second handler. This happens whenever you
178 178 // have to use a character from the next token to detect the end of the current token.
179 179  
180   - switch (this->state) {
  180 + switch (state) {
181 181 case st_top:
182 182 inTop(ch);
183 183 return;
... ... @@ -283,18 +283,18 @@ Tokenizer::inBeforeToken(char ch)
283 283 {
284 284 // Note: we specifically do not use ctype here. It is locale-dependent.
285 285 if (isSpace(ch)) {
286   - this->before_token = !this->include_ignorable;
287   - this->in_token = this->include_ignorable;
288   - if (this->include_ignorable) {
289   - this->state = st_in_space;
  286 + before_token = !include_ignorable;
  287 + in_token = include_ignorable;
  288 + if (include_ignorable) {
  289 + state = st_in_space;
290 290 }
291 291 } else if (ch == '%') {
292   - this->before_token = !this->include_ignorable;
293   - this->in_token = this->include_ignorable;
294   - this->state = st_in_comment;
  292 + before_token = !include_ignorable;
  293 + in_token = include_ignorable;
  294 + state = st_in_comment;
295 295 } else {
296   - this->before_token = false;
297   - this->in_token = true;
  296 + before_token = false;
  297 + in_token = true;
298 298 inTop(ch);
299 299 }
300 300 }
... ... @@ -304,48 +304,48 @@ Tokenizer::inTop(char ch)
304 304 {
305 305 switch (ch) {
306 306 case '(':
307   - this->string_depth = 1;
308   - this->state = st_in_string;
  307 + string_depth = 1;
  308 + state = st_in_string;
309 309 return;
310 310  
311 311 case '<':
312   - this->state = st_lt;
  312 + state = st_lt;
313 313 return;
314 314  
315 315 case '>':
316   - this->state = st_gt;
  316 + state = st_gt;
317 317 return;
318 318  
319 319 case (')'):
320   - this->type = tt::tt_bad;
  320 + type = tt::tt_bad;
321 321 QTC::TC("qpdf", "QPDFTokenizer bad )");
322   - this->error_message = "unexpected )";
323   - this->state = st_token_ready;
  322 + error_message = "unexpected )";
  323 + state = st_token_ready;
324 324 return;
325 325  
326 326 case '[':
327   - this->type = tt::tt_array_open;
328   - this->state = st_token_ready;
  327 + type = tt::tt_array_open;
  328 + state = st_token_ready;
329 329 return;
330 330  
331 331 case ']':
332   - this->type = tt::tt_array_close;
333   - this->state = st_token_ready;
  332 + type = tt::tt_array_close;
  333 + state = st_token_ready;
334 334 return;
335 335  
336 336 case '{':
337   - this->type = tt::tt_brace_open;
338   - this->state = st_token_ready;
  337 + type = tt::tt_brace_open;
  338 + state = st_token_ready;
339 339 return;
340 340  
341 341 case '}':
342   - this->type = tt::tt_brace_close;
343   - this->state = st_token_ready;
  342 + type = tt::tt_brace_close;
  343 + state = st_token_ready;
344 344 return;
345 345  
346 346 case '/':
347   - this->state = st_name;
348   - this->val += ch;
  347 + state = st_name;
  348 + val += ch;
349 349 return;
350 350  
351 351 case '0':
... ... @@ -358,20 +358,20 @@ Tokenizer::inTop(char ch)
358 358 case '7':
359 359 case '8':
360 360 case '9':
361   - this->state = st_number;
  361 + state = st_number;
362 362 return;
363 363  
364 364 case '+':
365 365 case '-':
366   - this->state = st_sign;
  366 + state = st_sign;
367 367 return;
368 368  
369 369 case '.':
370   - this->state = st_decimal;
  370 + state = st_decimal;
371 371 return;
372 372  
373 373 default:
374   - this->state = st_literal;
  374 + state = st_literal;
375 375 return;
376 376 }
377 377 }
... ... @@ -381,10 +381,10 @@ Tokenizer::inSpace(char ch)
381 381 {
382 382 // We only enter this state if include_ignorable is true.
383 383 if (!isSpace(ch)) {
384   - this->type = tt::tt_space;
385   - this->in_token = false;
386   - this->char_to_unread = ch;
387   - this->state = st_token_ready;
  384 + type = tt::tt_space;
  385 + in_token = false;
  386 + char_to_unread = ch;
  387 + state = st_token_ready;
388 388 }
389 389 }
390 390  
... ... @@ -392,13 +392,13 @@ void
392 392 Tokenizer::inComment(char ch)
393 393 {
394 394 if ((ch == '\r') || (ch == '\n')) {
395   - if (this->include_ignorable) {
396   - this->type = tt::tt_comment;
397   - this->in_token = false;
398   - this->char_to_unread = ch;
399   - this->state = st_token_ready;
  395 + if (include_ignorable) {
  396 + type = tt::tt_comment;
  397 + in_token = false;
  398 + char_to_unread = ch;
  399 + state = st_token_ready;
400 400 } else {
401   - this->state = st_before_token;
  401 + state = st_before_token;
402 402 }
403 403 }
404 404 }
... ... @@ -408,36 +408,36 @@ Tokenizer::inString(char ch)
408 408 {
409 409 switch (ch) {
410 410 case '\\':
411   - this->state = st_string_escape;
  411 + state = st_string_escape;
412 412 return;
413 413  
414 414 case '(':
415   - this->val += ch;
416   - ++this->string_depth;
  415 + val += ch;
  416 + ++string_depth;
417 417 return;
418 418  
419 419 case ')':
420   - if (--this->string_depth == 0) {
421   - this->type = tt::tt_string;
422   - this->state = st_token_ready;
  420 + if (--string_depth == 0) {
  421 + type = tt::tt_string;
  422 + state = st_token_ready;
423 423 return;
424 424 }
425 425  
426   - this->val += ch;
  426 + val += ch;
427 427 return;
428 428  
429 429 case '\r':
430 430 // CR by itself is converted to LF
431   - this->val += '\n';
432   - this->state = st_string_after_cr;
  431 + val += '\n';
  432 + state = st_string_after_cr;
433 433 return;
434 434  
435 435 case '\n':
436   - this->val += ch;
  436 + val += ch;
437 437 return;
438 438  
439 439 default:
440   - this->val += ch;
  440 + val += ch;
441 441 return;
442 442 }
443 443 }
... ... @@ -452,32 +452,32 @@ Tokenizer::inName(char ch)
452 452 // though not on any files in the test suite as of this
453 453 // writing.
454 454  
455   - this->type = this->bad ? tt::tt_bad : tt::tt_name;
456   - this->in_token = false;
457   - this->char_to_unread = ch;
458   - this->state = st_token_ready;
  455 + type = bad ? tt::tt_bad : tt::tt_name;
  456 + in_token = false;
  457 + char_to_unread = ch;
  458 + state = st_token_ready;
459 459 } else if (ch == '#') {
460   - this->char_code = 0;
461   - this->state = st_name_hex1;
  460 + char_code = 0;
  461 + state = st_name_hex1;
462 462 } else {
463   - this->val += ch;
  463 + val += ch;
464 464 }
465 465 }
466 466  
467 467 void
468 468 Tokenizer::inNameHex1(char ch)
469 469 {
470   - this->hex_char = ch;
  470 + hex_char = ch;
471 471  
472 472 if (char hval = util::hex_decode_char(ch); hval < '\20') {
473   - this->char_code = int(hval) << 4;
474   - this->state = st_name_hex2;
  473 + char_code = int(hval) << 4;
  474 + state = st_name_hex2;
475 475 } else {
476 476 QTC::TC("qpdf", "QPDFTokenizer bad name 1");
477   - this->error_message = "name with stray # will not work with PDF >= 1.2";
  477 + error_message = "name with stray # will not work with PDF >= 1.2";
478 478 // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
479   - this->val += '\0';
480   - this->state = st_name;
  479 + val += '\0';
  480 + state = st_name;
481 481 inName(ch);
482 482 }
483 483 }
... ... @@ -486,26 +486,26 @@ void
486 486 Tokenizer::inNameHex2(char ch)
487 487 {
488 488 if (char hval = util::hex_decode_char(ch); hval < '\20') {
489   - this->char_code |= int(hval);
  489 + char_code |= int(hval);
490 490 } else {
491 491 QTC::TC("qpdf", "QPDFTokenizer bad name 2");
492   - this->error_message = "name with stray # will not work with PDF >= 1.2";
  492 + error_message = "name with stray # will not work with PDF >= 1.2";
493 493 // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
494   - this->val += '\0';
495   - this->val += this->hex_char;
496   - this->state = st_name;
  494 + val += '\0';
  495 + val += hex_char;
  496 + state = st_name;
497 497 inName(ch);
498 498 return;
499 499 }
500   - if (this->char_code == 0) {
  500 + if (char_code == 0) {
501 501 QTC::TC("qpdf", "QPDFTokenizer null in name");
502   - this->error_message = "null character not allowed in name token";
503   - this->val += "#00";
504   - this->state = st_name;
505   - this->bad = true;
  502 + error_message = "null character not allowed in name token";
  503 + val += "#00";
  504 + state = st_name;
  505 + bad = true;
506 506 } else {
507   - this->val += char(this->char_code);
508   - this->state = st_name;
  507 + val += char(char_code);
  508 + state = st_name;
509 509 }
510 510 }
511 511  
... ... @@ -513,11 +513,11 @@ void
513 513 Tokenizer::inSign(char ch)
514 514 {
515 515 if (util::is_digit(ch)) {
516   - this->state = st_number;
  516 + state = st_number;
517 517 } else if (ch == '.') {
518   - this->state = st_decimal;
  518 + state = st_decimal;
519 519 } else {
520   - this->state = st_literal;
  520 + state = st_literal;
521 521 inLiteral(ch);
522 522 }
523 523 }
... ... @@ -526,9 +526,9 @@ void
526 526 Tokenizer::inDecimal(char ch)
527 527 {
528 528 if (util::is_digit(ch)) {
529   - this->state = st_real;
  529 + state = st_real;
530 530 } else {
531   - this->state = st_literal;
  531 + state = st_literal;
532 532 inLiteral(ch);
533 533 }
534 534 }
... ... @@ -538,14 +538,14 @@ Tokenizer::inNumber(char ch)
538 538 {
539 539 if (util::is_digit(ch)) {
540 540 } else if (ch == '.') {
541   - this->state = st_real;
  541 + state = st_real;
542 542 } else if (isDelimiter(ch)) {
543   - this->type = tt::tt_integer;
544   - this->state = st_token_ready;
545   - this->in_token = false;
546   - this->char_to_unread = ch;
  543 + type = tt::tt_integer;
  544 + state = st_token_ready;
  545 + in_token = false;
  546 + char_to_unread = ch;
547 547 } else {
548   - this->state = st_literal;
  548 + state = st_literal;
549 549 }
550 550 }
551 551  
... ... @@ -554,18 +554,18 @@ Tokenizer::inReal(char ch)
554 554 {
555 555 if (util::is_digit(ch)) {
556 556 } else if (isDelimiter(ch)) {
557   - this->type = tt::tt_real;
558   - this->state = st_token_ready;
559   - this->in_token = false;
560   - this->char_to_unread = ch;
  557 + type = tt::tt_real;
  558 + state = st_token_ready;
  559 + in_token = false;
  560 + char_to_unread = ch;
561 561 } else {
562   - this->state = st_literal;
  562 + state = st_literal;
563 563 }
564 564 }
565 565 void
566 566 Tokenizer::inStringEscape(char ch)
567 567 {
568   - this->state = st_in_string;
  568 + state = st_in_string;
569 569 switch (ch) {
570 570 case '0':
571 571 case '1':
... ... @@ -575,42 +575,42 @@ Tokenizer::inStringEscape(char ch)
575 575 case '5':
576 576 case '6':
577 577 case '7':
578   - this->state = st_char_code;
579   - this->char_code = 0;
580   - this->digit_count = 0;
  578 + state = st_char_code;
  579 + char_code = 0;
  580 + digit_count = 0;
581 581 inCharCode(ch);
582 582 return;
583 583  
584 584 case 'n':
585   - this->val += '\n';
  585 + val += '\n';
586 586 return;
587 587  
588 588 case 'r':
589   - this->val += '\r';
  589 + val += '\r';
590 590 return;
591 591  
592 592 case 't':
593   - this->val += '\t';
  593 + val += '\t';
594 594 return;
595 595  
596 596 case 'b':
597   - this->val += '\b';
  597 + val += '\b';
598 598 return;
599 599  
600 600 case 'f':
601   - this->val += '\f';
  601 + val += '\f';
602 602 return;
603 603  
604 604 case '\n':
605 605 return;
606 606  
607 607 case '\r':
608   - this->state = st_string_after_cr;
  608 + state = st_string_after_cr;
609 609 return;
610 610  
611 611 default:
612 612 // PDF spec says backslash is ignored before anything else
613   - this->val += ch;
  613 + val += ch;
614 614 return;
615 615 }
616 616 }
... ... @@ -618,7 +618,7 @@ Tokenizer::inStringEscape(char ch)
618 618 void
619 619 Tokenizer::inStringAfterCR(char ch)
620 620 {
621   - this->state = st_in_string;
  621 + state = st_in_string;
622 622 if (ch != '\n') {
623 623 inString(ch);
624 624 }
... ... @@ -628,12 +628,12 @@ void
628 628 Tokenizer::inLt(char ch)
629 629 {
630 630 if (ch == '<') {
631   - this->type = tt::tt_dict_open;
632   - this->state = st_token_ready;
  631 + type = tt::tt_dict_open;
  632 + state = st_token_ready;
633 633 return;
634 634 }
635 635  
636   - this->state = st_in_hexstring;
  636 + state = st_in_hexstring;
637 637 inHexstring(ch);
638 638 }
639 639  
... ... @@ -641,15 +641,15 @@ void
641 641 Tokenizer::inGt(char ch)
642 642 {
643 643 if (ch == '>') {
644   - this->type = tt::tt_dict_close;
645   - this->state = st_token_ready;
  644 + type = tt::tt_dict_close;
  645 + state = st_token_ready;
646 646 } else {
647   - this->type = tt::tt_bad;
  647 + type = tt::tt_bad;
648 648 QTC::TC("qpdf", "QPDFTokenizer bad >");
649   - this->error_message = "unexpected >";
650   - this->in_token = false;
651   - this->char_to_unread = ch;
652   - this->state = st_token_ready;
  649 + error_message = "unexpected >";
  650 + in_token = false;
  651 + char_to_unread = ch;
  652 + state = st_token_ready;
653 653 }
654 654 }
655 655  
... ... @@ -662,12 +662,12 @@ Tokenizer::inLiteral(char ch)
662 662 // stream keyword. Removing it here could make the stream-reading code break on some files,
663 663 // though not on any files in the test suite as of this writing.
664 664  
665   - this->in_token = false;
666   - this->char_to_unread = ch;
667   - this->state = st_token_ready;
668   - this->type = (this->raw_val == "true") || (this->raw_val == "false")
  665 + in_token = false;
  666 + char_to_unread = ch;
  667 + state = st_token_ready;
  668 + type = (raw_val == "true") || (raw_val == "false")
669 669 ? tt::tt_bool
670   - : (this->raw_val == "null" ? tt::tt_null : tt::tt_word);
  670 + : (raw_val == "null" ? tt::tt_null : tt::tt_word);
671 671 }
672 672 }
673 673  
... ... @@ -675,21 +675,21 @@ void
675 675 Tokenizer::inHexstring(char ch)
676 676 {
677 677 if (char hval = util::hex_decode_char(ch); hval < '\20') {
678   - this->char_code = int(hval) << 4;
679   - this->state = st_in_hexstring_2nd;
  678 + char_code = int(hval) << 4;
  679 + state = st_in_hexstring_2nd;
680 680  
681 681 } else if (ch == '>') {
682   - this->type = tt::tt_string;
683   - this->state = st_token_ready;
  682 + type = tt::tt_string;
  683 + state = st_token_ready;
684 684  
685 685 } else if (isSpace(ch)) {
686 686 // ignore
687 687  
688 688 } else {
689   - this->type = tt::tt_bad;
  689 + type = tt::tt_bad;
690 690 QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
691   - this->error_message = std::string("invalid character (") + ch + ") in hexstring";
692   - this->state = st_token_ready;
  691 + error_message = std::string("invalid character (") + ch + ") in hexstring";
  692 + state = st_token_ready;
693 693 }
694 694 }
695 695  
... ... @@ -697,23 +697,23 @@ void
697 697 Tokenizer::inHexstring2nd(char ch)
698 698 {
699 699 if (char hval = util::hex_decode_char(ch); hval < '\20') {
700   - this->val += char(this->char_code) | hval;
701   - this->state = st_in_hexstring;
  700 + val += char(char_code) | hval;
  701 + state = st_in_hexstring;
702 702  
703 703 } else if (ch == '>') {
704 704 // PDF spec says odd hexstrings have implicit trailing 0.
705   - this->val += char(this->char_code);
706   - this->type = tt::tt_string;
707   - this->state = st_token_ready;
  705 + val += char(char_code);
  706 + type = tt::tt_string;
  707 + state = st_token_ready;
708 708  
709 709 } else if (isSpace(ch)) {
710 710 // ignore
711 711  
712 712 } else {
713   - this->type = tt::tt_bad;
  713 + type = tt::tt_bad;
714 714 QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
715   - this->error_message = std::string("invalid character (") + ch + ") in hexstring";
716   - this->state = st_token_ready;
  715 + error_message = std::string("invalid character (") + ch + ") in hexstring";
  716 + state = st_token_ready;
717 717 }
718 718 }
719 719  
... ... @@ -722,16 +722,16 @@ Tokenizer::inCharCode(char ch)
722 722 {
723 723 bool handled = false;
724 724 if (('0' <= ch) && (ch <= '7')) {
725   - this->char_code = 8 * this->char_code + (int(ch) - int('0'));
726   - if (++(this->digit_count) < 3) {
  725 + char_code = 8 * char_code + (int(ch) - int('0'));
  726 + if (++(digit_count) < 3) {
727 727 return;
728 728 }
729 729 handled = true;
730 730 }
731 731 // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF
732 732 // Spec says to ignore high-order overflow.
733   - this->val += char(this->char_code % 256);
734   - this->state = st_in_string;
  733 + val += char(char_code % 256);
  734 + state = st_in_string;
735 735 if (!handled) {
736 736 inString(ch);
737 737 }
... ... @@ -740,11 +740,11 @@ Tokenizer::inCharCode(char ch)
740 740 void
741 741 Tokenizer::inInlineImage(char ch)
742 742 {
743   - if ((this->raw_val.length() + 1) == this->inline_image_bytes) {
  743 + if ((raw_val.length() + 1) == inline_image_bytes) {
744 744 QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
745   - this->type = tt::tt_inline_image;
746   - this->inline_image_bytes = 0;
747   - this->state = st_token_ready;
  745 + type = tt::tt_inline_image;
  746 + inline_image_bytes = 0;
  747 + state = st_token_ready;
748 748 }
749 749 }
750 750  
... ... @@ -757,7 +757,7 @@ QPDFTokenizer::presentEOF()
757 757 void
758 758 Tokenizer::presentEOF()
759 759 {
760   - switch (this->state) {
  760 + switch (state) {
761 761 case st_name:
762 762 case st_name_hex1:
763 763 case st_name_hex2:
... ... @@ -769,20 +769,20 @@ Tokenizer::presentEOF()
769 769 QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
770 770 // Push any delimiter to the state machine to finish off the final token.
771 771 presentCharacter('\f');
772   - this->in_token = true;
  772 + in_token = true;
773 773 break;
774 774  
775 775 case st_top:
776 776 case st_before_token:
777   - this->type = tt::tt_eof;
  777 + type = tt::tt_eof;
778 778 break;
779 779  
780 780 case st_in_space:
781   - this->type = this->include_ignorable ? tt::tt_space : tt::tt_eof;
  781 + type = include_ignorable ? tt::tt_space : tt::tt_eof;
782 782 break;
783 783  
784 784 case st_in_comment:
785   - this->type = this->include_ignorable ? tt::tt_comment : tt::tt_bad;
  785 + type = include_ignorable ? tt::tt_comment : tt::tt_bad;
786 786 break;
787 787  
788 788 case st_token_ready:
... ... @@ -790,10 +790,10 @@ Tokenizer::presentEOF()
790 790  
791 791 default:
792 792 QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
793   - this->type = tt::tt_bad;
794   - this->error_message = "EOF while reading token";
  793 + type = tt::tt_bad;
  794 + error_message = "EOF while reading token";
795 795 }
796   - this->state = st_token_ready;
  796 + state = st_token_ready;
797 797 }
798 798  
799 799 void
... ... @@ -811,16 +811,16 @@ QPDFTokenizer::expectInlineImage(InputSource&amp; input)
811 811 void
812 812 Tokenizer::expectInlineImage(InputSource& input)
813 813 {
814   - if (this->state == st_token_ready) {
  814 + if (state == st_token_ready) {
815 815 reset();
816   - } else if (this->state != st_before_token) {
  816 + } else if (state != st_before_token) {
817 817 throw std::logic_error(
818 818 "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
819 819 }
820 820 findEI(input);
821   - this->before_token = false;
822   - this->in_token = true;
823   - this->state = st_inline_image;
  821 + before_token = false;
  822 + in_token = true;
  823 + state = st_inline_image;
824 824 }
825 825  
826 826 void
... ... @@ -913,15 +913,15 @@ QPDFTokenizer::getToken(Token&amp; token, bool&amp; unread_char, char&amp; ch)
913 913 bool
914 914 Tokenizer::getToken(Token& token, bool& unread_char, char& ch)
915 915 {
916   - bool ready = (this->state == st_token_ready);
917   - unread_char = !this->in_token && !this->before_token;
918   - ch = this->char_to_unread;
  916 + bool ready = (state == st_token_ready);
  917 + unread_char = !in_token && !before_token;
  918 + ch = char_to_unread;
919 919 if (ready) {
920   - token = (!(this->type == tt::tt_name || this->type == tt::tt_string))
921   - ? Token(this->type, this->raw_val, this->raw_val, this->error_message)
922   - : Token(this->type, this->val, this->raw_val, this->error_message);
  920 + token = (!(type == tt::tt_name || type == tt::tt_string))
  921 + ? Token(type, raw_val, raw_val, error_message)
  922 + : Token(type, val, raw_val, error_message);
923 923  
924   - this->reset();
  924 + reset();
925 925 }
926 926 return ready;
927 927 }
... ... @@ -980,46 +980,46 @@ Tokenizer::readToken(InputSource&amp; input, std::string const&amp; context, bool allow_
980 980 bool
981 981 Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len)
982 982 {
983   - if (this->state != st_inline_image) {
  983 + if (state != st_inline_image) {
984 984 reset();
985 985 }
986 986 qpdf_offset_t offset = input.fastTell();
987 987  
988   - while (this->state != st_token_ready) {
  988 + while (state != st_token_ready) {
989 989 char ch;
990 990 if (!input.fastRead(ch)) {
991 991 presentEOF();
992 992  
993   - if ((this->type == tt::tt_eof) && (!this->allow_eof)) {
  993 + if ((type == tt::tt_eof) && (!allow_eof)) {
994 994 // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
995 995 // case is not exercised.
996   - this->type = tt::tt_bad;
997   - this->error_message = "unexpected EOF";
  996 + type = tt::tt_bad;
  997 + error_message = "unexpected EOF";
998 998 offset = input.getLastOffset();
999 999 }
1000 1000 } else {
1001 1001 handleCharacter(ch);
1002   - if (this->before_token) {
  1002 + if (before_token) {
1003 1003 ++offset;
1004 1004 }
1005   - if (this->in_token) {
1006   - this->raw_val += ch;
  1005 + if (in_token) {
  1006 + raw_val += ch;
1007 1007 }
1008   - if (max_len && (this->raw_val.length() >= max_len) && (this->state != st_token_ready)) {
  1008 + if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
1009 1009 // terminate this token now
1010 1010 QTC::TC("qpdf", "QPDFTokenizer block long token");
1011   - this->type = tt::tt_bad;
1012   - this->state = st_token_ready;
1013   - this->error_message = "exceeded allowable length while reading token";
  1011 + type = tt::tt_bad;
  1012 + state = st_token_ready;
  1013 + error_message = "exceeded allowable length while reading token";
1014 1014 }
1015 1015 }
1016 1016 }
1017 1017  
1018   - input.fastUnread(!this->in_token && !this->before_token);
  1018 + input.fastUnread(!in_token && !before_token);
1019 1019  
1020   - if (this->type != tt::tt_eof) {
  1020 + if (type != tt::tt_eof) {
1021 1021 input.setLastOffset(offset);
1022 1022 }
1023 1023  
1024   - return this->error_message.empty();
  1024 + return error_message.empty();
1025 1025 }
... ...