File: getdict-overrides.patch

package info (click to toggle)
qtwebengine-opensource-src 5.11.3%2Bdfsg-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,551,988 kB
  • sloc: cpp: 10,064,061; ansic: 3,832,841; asm: 590,489; python: 455,759; xml: 261,729; sh: 90,157; objc: 77,089; perl: 71,296; makefile: 27,041; cs: 23,492; yacc: 14,360; tcl: 12,756; php: 4,714; lex: 4,028; pascal: 3,741; ml: 3,543; ruby: 1,497; lisp: 1,490; awk: 183; csh: 117; sed: 54
file content (80 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Description: fix GetDict methods in CPDF_Object descendants
 In commit [1], Qt WebEngine developers backported a change to cpdf_object.h
 that splits GetDict() virtual method into two: const and non-const.
 .
 However, this change was not applied to CPDF_Dictionary and CPDF_Reference
 that are descendant classes of CPDF_Object. So they were missing the non-const
 override, and the method from base class CPDF_Object was used instead (which
 always returns nullptr).
 .
 In upstream PDFium, all files were changed in [2], so the bug was specific to
 Qt WebEngine 5.11 (Chromium 65-based) branch.
 .
 [1]: https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit/?id=bc188914f3ce1d2c
 [2]: https://pdfium.googlesource.com/pdfium/+/7e28208d26764438
Author: Dmitry Shachnev <mitya57@debian.org>
Last-Update: 2019-11-29

--- a/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -42,10 +42,12 @@ CPDF_Object::Type CPDF_Dictionary::GetTy
   return DICTIONARY;
 }
 
-CPDF_Dictionary* CPDF_Dictionary::GetDict() const {
-  // The method should be made non-const if we want to not be const.
-  // See bug #234.
-  return const_cast<CPDF_Dictionary*>(this);
+CPDF_Dictionary* CPDF_Dictionary::GetDict() {
+  return this;
+}
+
+const CPDF_Dictionary* CPDF_Dictionary::GetDict() const {
+  return this;
 }
 
 bool CPDF_Dictionary::IsDictionary() const {
--- a/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_dictionary.h
@@ -33,7 +33,8 @@ class CPDF_Dictionary : public CPDF_Obje
   // CPDF_Object:
   Type GetType() const override;
   std::unique_ptr<CPDF_Object> Clone() const override;
-  CPDF_Dictionary* GetDict() const override;
+  CPDF_Dictionary* GetDict() override;
+  const CPDF_Dictionary* GetDict() const override;
   bool IsDictionary() const override;
   CPDF_Dictionary* AsDictionary() override;
   const CPDF_Dictionary* AsDictionary() const override;
--- a/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.cpp
@@ -35,11 +35,16 @@ int CPDF_Reference::GetInteger() const {
   return obj ? obj->GetInteger() : 0;
 }
 
-CPDF_Dictionary* CPDF_Reference::GetDict() const {
+CPDF_Dictionary* CPDF_Reference::GetDict() {
   CPDF_Object* obj = SafeGetDirect();
   return obj ? obj->GetDict() : nullptr;
 }
 
+const CPDF_Dictionary* CPDF_Reference::GetDict() const {
+  const CPDF_Object* obj = SafeGetDirect();
+  return obj ? obj->GetDict() : nullptr;
+}
+
 bool CPDF_Reference::IsReference() const {
   return true;
 }
--- a/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h
+++ b/src/3rdparty/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_reference.h
@@ -27,7 +27,8 @@ class CPDF_Reference : public CPDF_Objec
   ByteString GetString() const override;
   float GetNumber() const override;
   int GetInteger() const override;
-  CPDF_Dictionary* GetDict() const override;
+  CPDF_Dictionary* GetDict() override;
+  const CPDF_Dictionary* GetDict() const override;
   bool IsReference() const override;
   CPDF_Reference* AsReference() override;
   const CPDF_Reference* AsReference() const override;