Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: core/fpdfapi/fpdf_font/ttgsubtable.h

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix a bad merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/fpdfapi/fpdf_font/ttgsubtable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ 7 #ifndef CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_
8 #define CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ 8 #define CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 }; 46 };
47 struct TLangSys { 47 struct TLangSys {
48 uint16_t LookupOrder; 48 uint16_t LookupOrder;
49 uint16_t ReqFeatureIndex; 49 uint16_t ReqFeatureIndex;
50 uint16_t FeatureCount; 50 uint16_t FeatureCount;
51 uint16_t* FeatureIndex; 51 uint16_t* FeatureIndex;
52 TLangSys() 52 TLangSys()
53 : LookupOrder(0), 53 : LookupOrder(0),
54 ReqFeatureIndex(0), 54 ReqFeatureIndex(0),
55 FeatureCount(0), 55 FeatureCount(0),
56 FeatureIndex(NULL) {} 56 FeatureIndex(nullptr) {}
57 ~TLangSys() { delete[] FeatureIndex; } 57 ~TLangSys() { delete[] FeatureIndex; }
58 58
59 private: 59 private:
60 TLangSys(const TLangSys&); 60 TLangSys(const TLangSys&);
61 TLangSys& operator=(const TLangSys&); 61 TLangSys& operator=(const TLangSys&);
62 }; 62 };
63 struct TLangSysRecord { 63 struct TLangSysRecord {
64 uint32_t LangSysTag; 64 uint32_t LangSysTag;
65 struct TLangSys LangSys; 65 struct TLangSys LangSys;
66 TLangSysRecord() : LangSysTag(0) {} 66 TLangSysRecord() : LangSysTag(0) {}
67 67
68 private: 68 private:
69 TLangSysRecord(const TLangSysRecord&); 69 TLangSysRecord(const TLangSysRecord&);
70 TLangSysRecord& operator=(const TLangSysRecord&); 70 TLangSysRecord& operator=(const TLangSysRecord&);
71 }; 71 };
72 struct TScript { 72 struct TScript {
73 uint16_t DefaultLangSys; 73 uint16_t DefaultLangSys;
74 uint16_t LangSysCount; 74 uint16_t LangSysCount;
75 struct TLangSysRecord* LangSysRecord; 75 struct TLangSysRecord* LangSysRecord;
76 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} 76 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(nullptr) {}
77 ~TScript() { delete[] LangSysRecord; } 77 ~TScript() { delete[] LangSysRecord; }
78 78
79 private: 79 private:
80 TScript(const TScript&); 80 TScript(const TScript&);
81 TScript& operator=(const TScript&); 81 TScript& operator=(const TScript&);
82 }; 82 };
83 struct TScriptRecord { 83 struct TScriptRecord {
84 uint32_t ScriptTag; 84 uint32_t ScriptTag;
85 struct TScript Script; 85 struct TScript Script;
86 TScriptRecord() : ScriptTag(0) {} 86 TScriptRecord() : ScriptTag(0) {}
87 87
88 private: 88 private:
89 TScriptRecord(const TScriptRecord&); 89 TScriptRecord(const TScriptRecord&);
90 TScriptRecord& operator=(const TScriptRecord&); 90 TScriptRecord& operator=(const TScriptRecord&);
91 }; 91 };
92 struct TScriptList { 92 struct TScriptList {
93 uint16_t ScriptCount; 93 uint16_t ScriptCount;
94 struct TScriptRecord* ScriptRecord; 94 struct TScriptRecord* ScriptRecord;
95 TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} 95 TScriptList() : ScriptCount(0), ScriptRecord(nullptr) {}
96 ~TScriptList() { delete[] ScriptRecord; } 96 ~TScriptList() { delete[] ScriptRecord; }
97 97
98 private: 98 private:
99 TScriptList(const TScriptList&); 99 TScriptList(const TScriptList&);
100 TScriptList& operator=(const TScriptList&); 100 TScriptList& operator=(const TScriptList&);
101 }; 101 };
102 struct TFeature { 102 struct TFeature {
103 uint16_t FeatureParams; 103 uint16_t FeatureParams;
104 int LookupCount; 104 int LookupCount;
105 uint16_t* LookupListIndex; 105 uint16_t* LookupListIndex;
106 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} 106 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(nullptr) {}
107 ~TFeature() { delete[] LookupListIndex; } 107 ~TFeature() { delete[] LookupListIndex; }
108 108
109 private: 109 private:
110 TFeature(const TFeature&); 110 TFeature(const TFeature&);
111 TFeature& operator=(const TFeature&); 111 TFeature& operator=(const TFeature&);
112 }; 112 };
113 struct TFeatureRecord { 113 struct TFeatureRecord {
114 uint32_t FeatureTag; 114 uint32_t FeatureTag;
115 struct TFeature Feature; 115 struct TFeature Feature;
116 TFeatureRecord() : FeatureTag(0) {} 116 TFeatureRecord() : FeatureTag(0) {}
117 117
118 private: 118 private:
119 TFeatureRecord(const TFeatureRecord&); 119 TFeatureRecord(const TFeatureRecord&);
120 TFeatureRecord& operator=(const TFeatureRecord&); 120 TFeatureRecord& operator=(const TFeatureRecord&);
121 }; 121 };
122 struct TFeatureList { 122 struct TFeatureList {
123 int FeatureCount; 123 int FeatureCount;
124 struct TFeatureRecord* FeatureRecord; 124 struct TFeatureRecord* FeatureRecord;
125 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} 125 TFeatureList() : FeatureCount(0), FeatureRecord(nullptr) {}
126 ~TFeatureList() { delete[] FeatureRecord; } 126 ~TFeatureList() { delete[] FeatureRecord; }
127 127
128 private: 128 private:
129 TFeatureList(const TFeatureList&); 129 TFeatureList(const TFeatureList&);
130 TFeatureList& operator=(const TFeatureList&); 130 TFeatureList& operator=(const TFeatureList&);
131 }; 131 };
132 enum TLookupFlag { 132 enum TLookupFlag {
133 LOOKUPFLAG_RightToLeft = 0x0001, 133 LOOKUPFLAG_RightToLeft = 0x0001,
134 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, 134 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002,
135 LOOKUPFLAG_IgnoreLigatures = 0x0004, 135 LOOKUPFLAG_IgnoreLigatures = 0x0004,
136 LOOKUPFLAG_IgnoreMarks = 0x0008, 136 LOOKUPFLAG_IgnoreMarks = 0x0008,
137 LOOKUPFLAG_Reserved = 0x00F0, 137 LOOKUPFLAG_Reserved = 0x00F0,
138 LOOKUPFLAG_MarkAttachmentType = 0xFF00, 138 LOOKUPFLAG_MarkAttachmentType = 0xFF00,
139 }; 139 };
140 struct TCoverageFormatBase { 140 struct TCoverageFormatBase {
141 uint16_t CoverageFormat; 141 uint16_t CoverageFormat;
142 CFX_GlyphMap m_glyphMap; 142 CFX_GlyphMap m_glyphMap;
143 TCoverageFormatBase() : CoverageFormat(0) {} 143 TCoverageFormatBase() : CoverageFormat(0) {}
144 virtual ~TCoverageFormatBase() {} 144 virtual ~TCoverageFormatBase() {}
145 145
146 private: 146 private:
147 TCoverageFormatBase(const TCoverageFormatBase&); 147 TCoverageFormatBase(const TCoverageFormatBase&);
148 TCoverageFormatBase& operator=(const TCoverageFormatBase&); 148 TCoverageFormatBase& operator=(const TCoverageFormatBase&);
149 }; 149 };
150 struct TCoverageFormat1 : public TCoverageFormatBase { 150 struct TCoverageFormat1 : public TCoverageFormatBase {
151 uint16_t GlyphCount; 151 uint16_t GlyphCount;
152 uint16_t* GlyphArray; 152 uint16_t* GlyphArray;
153 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } 153 TCoverageFormat1() : GlyphCount(0), GlyphArray(nullptr) {
154 CoverageFormat = 1;
155 }
154 ~TCoverageFormat1() override { delete[] GlyphArray; } 156 ~TCoverageFormat1() override { delete[] GlyphArray; }
155 157
156 private: 158 private:
157 TCoverageFormat1(const TCoverageFormat1&); 159 TCoverageFormat1(const TCoverageFormat1&);
158 TCoverageFormat1& operator=(const TCoverageFormat1&); 160 TCoverageFormat1& operator=(const TCoverageFormat1&);
159 }; 161 };
160 struct TRangeRecord { 162 struct TRangeRecord {
161 uint16_t Start; 163 uint16_t Start;
162 uint16_t End; 164 uint16_t End;
163 uint16_t StartCoverageIndex; 165 uint16_t StartCoverageIndex;
164 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} 166 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {}
165 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { 167 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) {
166 return r1.Start > r2.Start; 168 return r1.Start > r2.Start;
167 } 169 }
168 170
169 private: 171 private:
170 TRangeRecord(const TRangeRecord&); 172 TRangeRecord(const TRangeRecord&);
171 }; 173 };
172 struct TCoverageFormat2 : public TCoverageFormatBase { 174 struct TCoverageFormat2 : public TCoverageFormatBase {
173 uint16_t RangeCount; 175 uint16_t RangeCount;
174 struct TRangeRecord* RangeRecord; 176 struct TRangeRecord* RangeRecord;
175 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { 177 TCoverageFormat2() : RangeCount(0), RangeRecord(nullptr) {
176 CoverageFormat = 2; 178 CoverageFormat = 2;
177 } 179 }
178 ~TCoverageFormat2() override { delete[] RangeRecord; } 180 ~TCoverageFormat2() override { delete[] RangeRecord; }
179 181
180 private: 182 private:
181 TCoverageFormat2(const TCoverageFormat2&); 183 TCoverageFormat2(const TCoverageFormat2&);
182 TCoverageFormat2& operator=(const TCoverageFormat2&); 184 TCoverageFormat2& operator=(const TCoverageFormat2&);
183 }; 185 };
184 struct TClassDefFormatBase { 186 struct TClassDefFormatBase {
185 uint16_t ClassFormat; 187 uint16_t ClassFormat;
186 TClassDefFormatBase() : ClassFormat(0) {} 188 TClassDefFormatBase() : ClassFormat(0) {}
187 virtual ~TClassDefFormatBase() {} 189 virtual ~TClassDefFormatBase() {}
188 190
189 private: 191 private:
190 TClassDefFormatBase(const TClassDefFormatBase&); 192 TClassDefFormatBase(const TClassDefFormatBase&);
191 TClassDefFormatBase& operator=(const TClassDefFormatBase&); 193 TClassDefFormatBase& operator=(const TClassDefFormatBase&);
192 }; 194 };
193 struct TClassDefFormat1 : public TClassDefFormatBase { 195 struct TClassDefFormat1 : public TClassDefFormatBase {
194 uint16_t StartGlyph; 196 uint16_t StartGlyph;
195 uint16_t GlyphCount; 197 uint16_t GlyphCount;
196 uint16_t* ClassValueArray; 198 uint16_t* ClassValueArray;
197 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { 199 TClassDefFormat1()
200 : StartGlyph(0), GlyphCount(0), ClassValueArray(nullptr) {
198 ClassFormat = 1; 201 ClassFormat = 1;
199 } 202 }
200 ~TClassDefFormat1() override { delete[] ClassValueArray; } 203 ~TClassDefFormat1() override { delete[] ClassValueArray; }
201 204
202 private: 205 private:
203 TClassDefFormat1(const TClassDefFormat1&); 206 TClassDefFormat1(const TClassDefFormat1&);
204 TClassDefFormat1& operator=(const TClassDefFormat1&); 207 TClassDefFormat1& operator=(const TClassDefFormat1&);
205 }; 208 };
206 struct TClassRangeRecord { 209 struct TClassRangeRecord {
207 uint16_t Start; 210 uint16_t Start;
208 uint16_t End; 211 uint16_t End;
209 uint16_t Class; 212 uint16_t Class;
210 TClassRangeRecord() : Start(0), End(0), Class(0) {} 213 TClassRangeRecord() : Start(0), End(0), Class(0) {}
211 214
212 private: 215 private:
213 TClassRangeRecord(const TClassRangeRecord&); 216 TClassRangeRecord(const TClassRangeRecord&);
214 TClassRangeRecord& operator=(const TClassRangeRecord&); 217 TClassRangeRecord& operator=(const TClassRangeRecord&);
215 }; 218 };
216 struct TClassDefFormat2 : public TClassDefFormatBase { 219 struct TClassDefFormat2 : public TClassDefFormatBase {
217 uint16_t ClassRangeCount; 220 uint16_t ClassRangeCount;
218 struct TClassRangeRecord* ClassRangeRecord; 221 struct TClassRangeRecord* ClassRangeRecord;
219 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { 222 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(nullptr) {
220 ClassFormat = 2; 223 ClassFormat = 2;
221 } 224 }
222 ~TClassDefFormat2() override { delete[] ClassRangeRecord; } 225 ~TClassDefFormat2() override { delete[] ClassRangeRecord; }
223 226
224 private: 227 private:
225 TClassDefFormat2(const TClassDefFormat2&); 228 TClassDefFormat2(const TClassDefFormat2&);
226 TClassDefFormat2& operator=(const TClassDefFormat2&); 229 TClassDefFormat2& operator=(const TClassDefFormat2&);
227 }; 230 };
228 struct TDevice { 231 struct TDevice {
229 uint16_t StartSize; 232 uint16_t StartSize;
(...skipping 10 matching lines...) Expand all
240 TSubTableBase() : SubstFormat(0) {} 243 TSubTableBase() : SubstFormat(0) {}
241 virtual ~TSubTableBase() {} 244 virtual ~TSubTableBase() {}
242 245
243 private: 246 private:
244 TSubTableBase(const TSubTableBase&); 247 TSubTableBase(const TSubTableBase&);
245 TSubTableBase& operator=(const TSubTableBase&); 248 TSubTableBase& operator=(const TSubTableBase&);
246 }; 249 };
247 struct TSingleSubstFormat1 : public TSubTableBase { 250 struct TSingleSubstFormat1 : public TSubTableBase {
248 TCoverageFormatBase* Coverage; 251 TCoverageFormatBase* Coverage;
249 int16_t DeltaGlyphID; 252 int16_t DeltaGlyphID;
250 TSingleSubstFormat1() : Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; } 253 TSingleSubstFormat1() : Coverage(nullptr), DeltaGlyphID(0) {
254 SubstFormat = 1;
255 }
251 ~TSingleSubstFormat1() override { delete Coverage; } 256 ~TSingleSubstFormat1() override { delete Coverage; }
252 257
253 private: 258 private:
254 TSingleSubstFormat1(const TSingleSubstFormat1&); 259 TSingleSubstFormat1(const TSingleSubstFormat1&);
255 TSingleSubstFormat1& operator=(const TSingleSubstFormat1&); 260 TSingleSubstFormat1& operator=(const TSingleSubstFormat1&);
256 }; 261 };
257 struct TSingleSubstFormat2 : public TSubTableBase { 262 struct TSingleSubstFormat2 : public TSubTableBase {
258 TCoverageFormatBase* Coverage; 263 TCoverageFormatBase* Coverage;
259 uint16_t GlyphCount; 264 uint16_t GlyphCount;
260 uint16_t* Substitute; 265 uint16_t* Substitute;
261 TSingleSubstFormat2() : Coverage(NULL), GlyphCount(0), Substitute(NULL) { 266 TSingleSubstFormat2()
267 : Coverage(nullptr), GlyphCount(0), Substitute(nullptr) {
262 SubstFormat = 2; 268 SubstFormat = 2;
263 } 269 }
264 ~TSingleSubstFormat2() override { 270 ~TSingleSubstFormat2() override {
265 delete Coverage; 271 delete Coverage;
266 delete[] Substitute; 272 delete[] Substitute;
267 } 273 }
268 274
269 private: 275 private:
270 TSingleSubstFormat2(const TSingleSubstFormat2&); 276 TSingleSubstFormat2(const TSingleSubstFormat2&);
271 TSingleSubstFormat2& operator=(const TSingleSubstFormat2&); 277 TSingleSubstFormat2& operator=(const TSingleSubstFormat2&);
272 }; 278 };
273 struct TLookup { 279 struct TLookup {
274 uint16_t LookupType; 280 uint16_t LookupType;
275 uint16_t LookupFlag; 281 uint16_t LookupFlag;
276 uint16_t SubTableCount; 282 uint16_t SubTableCount;
277 struct TSubTableBase** SubTable; 283 struct TSubTableBase** SubTable;
278 TLookup() 284 TLookup()
279 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(NULL) {} 285 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(nullptr) {}
280 ~TLookup() { 286 ~TLookup() {
281 if (SubTable) { 287 if (SubTable) {
282 for (int i = 0; i < SubTableCount; ++i) 288 for (int i = 0; i < SubTableCount; ++i)
283 delete SubTable[i]; 289 delete SubTable[i];
284 delete[] SubTable; 290 delete[] SubTable;
285 } 291 }
286 } 292 }
287 293
288 private: 294 private:
289 TLookup(const TLookup&); 295 TLookup(const TLookup&);
290 TLookup& operator=(const TLookup&); 296 TLookup& operator=(const TLookup&);
291 }; 297 };
292 struct TLookupList { 298 struct TLookupList {
293 int LookupCount; 299 int LookupCount;
294 struct TLookup* Lookup; 300 struct TLookup* Lookup;
295 TLookupList() : LookupCount(0), Lookup(NULL) {} 301 TLookupList() : LookupCount(0), Lookup(nullptr) {}
296 ~TLookupList() { delete[] Lookup; } 302 ~TLookupList() { delete[] Lookup; }
297 303
298 private: 304 private:
299 TLookupList(const TLookupList&); 305 TLookupList(const TLookupList&);
300 TLookupList& operator=(const TLookupList&); 306 TLookupList& operator=(const TLookupList&);
301 }; 307 };
302 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist); 308 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist);
303 void ParseScriptList(FT_Bytes raw, TScriptList* rec); 309 void ParseScriptList(FT_Bytes raw, TScriptList* rec);
304 void ParseScript(FT_Bytes raw, TScript* rec); 310 void ParseScript(FT_Bytes raw, TScript* rec);
305 void ParseLangSys(FT_Bytes raw, TLangSys* rec); 311 void ParseLangSys(FT_Bytes raw, TLangSys* rec);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 std::map<uint32_t, uint32_t> m_featureMap; 354 std::map<uint32_t, uint32_t> m_featureMap;
349 FX_BOOL m_bFeautureMapLoad; 355 FX_BOOL m_bFeautureMapLoad;
350 bool loaded; 356 bool loaded;
351 struct tt_gsub_header header; 357 struct tt_gsub_header header;
352 struct TScriptList ScriptList; 358 struct TScriptList ScriptList;
353 struct TFeatureList FeatureList; 359 struct TFeatureList FeatureList;
354 struct TLookupList LookupList; 360 struct TLookupList LookupList;
355 }; 361 };
356 362
357 #endif // CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ 363 #endif // CORE_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/fpdfapi/fpdf_font/ttgsubtable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698