OLD | NEW |
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 #include "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fxcrt/fx_string.h" | 8 #include "../../../include/fxcrt/fx_string.h" |
9 | 9 |
10 // static | 10 // static |
11 int CPDF_Object::s_nCurRefDepth = 0; | 11 int CPDF_Object::s_nCurRefDepth = 0; |
12 | 12 |
13 void CPDF_Object::Release() { | 13 void CPDF_Object::Release() { |
14 if (m_ObjNum) { | 14 if (m_ObjNum) { |
15 return; | 15 return; |
16 } | 16 } |
17 Destroy(); | 17 Destroy(); |
18 } | 18 } |
19 void CPDF_Object::Destroy() { | 19 void CPDF_Object::Destroy() { |
20 switch (m_Type) { | 20 switch (m_Type) { |
21 case PDFOBJ_STRING: | 21 case PDFOBJ_STRING: |
22 delete AsString(); | 22 delete AsString(); |
23 break; | 23 break; |
24 case PDFOBJ_NAME: | 24 case PDFOBJ_NAME: |
25 delete AsName(); | 25 delete AsName(); |
26 break; | 26 break; |
27 case PDFOBJ_ARRAY: | 27 case PDFOBJ_ARRAY: |
28 delete (CPDF_Array*)this; | 28 delete AsArray(); |
29 break; | 29 break; |
30 case PDFOBJ_DICTIONARY: | 30 case PDFOBJ_DICTIONARY: |
31 delete AsDictionary(); | 31 delete AsDictionary(); |
32 break; | 32 break; |
33 case PDFOBJ_STREAM: | 33 case PDFOBJ_STREAM: |
34 delete (CPDF_Stream*)this; | 34 delete (CPDF_Stream*)this; |
35 break; | 35 break; |
36 default: | 36 default: |
37 delete this; | 37 delete this; |
38 } | 38 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (!pObj || (pObj == this)) | 154 if (!pObj || (pObj == this)) |
155 return nullptr; | 155 return nullptr; |
156 return pObj->GetDict(); | 156 return pObj->GetDict(); |
157 } | 157 } |
158 default: | 158 default: |
159 return nullptr; | 159 return nullptr; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 CPDF_Array* CPDF_Object::GetArray() const { | 163 CPDF_Array* CPDF_Object::GetArray() const { |
164 if (m_Type == PDFOBJ_ARRAY) | 164 // The method should be made non-const if we want to not be const. |
165 return (CPDF_Array*)this; | 165 // See bug #234. |
166 | 166 return const_cast<CPDF_Array*>(AsArray()); |
167 return NULL; | |
168 } | 167 } |
169 void CPDF_Object::SetString(const CFX_ByteString& str) { | 168 void CPDF_Object::SetString(const CFX_ByteString& str) { |
170 ASSERT(this != NULL); | 169 ASSERT(this != NULL); |
171 switch (m_Type) { | 170 switch (m_Type) { |
172 case PDFOBJ_BOOLEAN: | 171 case PDFOBJ_BOOLEAN: |
173 AsBoolean()->m_bValue = (str == FX_BSTRC("true")); | 172 AsBoolean()->m_bValue = (str == FX_BSTRC("true")); |
174 return; | 173 return; |
175 case PDFOBJ_NUMBER: | 174 case PDFOBJ_NUMBER: |
176 AsNumber()->SetString(str); | 175 AsNumber()->SetString(str); |
177 return; | 176 return; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 switch (m_Type) { | 209 switch (m_Type) { |
211 case PDFOBJ_BOOLEAN: | 210 case PDFOBJ_BOOLEAN: |
212 return AsBoolean()->Identical(pOther->AsBoolean()); | 211 return AsBoolean()->Identical(pOther->AsBoolean()); |
213 case PDFOBJ_NUMBER: | 212 case PDFOBJ_NUMBER: |
214 return AsNumber()->Identical(pOther->AsNumber()); | 213 return AsNumber()->Identical(pOther->AsNumber()); |
215 case PDFOBJ_STRING: | 214 case PDFOBJ_STRING: |
216 return AsString()->Identical(pOther->AsString()); | 215 return AsString()->Identical(pOther->AsString()); |
217 case PDFOBJ_NAME: | 216 case PDFOBJ_NAME: |
218 return AsName()->Identical(pOther->AsName()); | 217 return AsName()->Identical(pOther->AsName()); |
219 case PDFOBJ_ARRAY: | 218 case PDFOBJ_ARRAY: |
220 return (((CPDF_Array*)this)->Identical((CPDF_Array*)pOther)); | 219 return AsArray()->Identical(pOther->AsArray()); |
221 case PDFOBJ_DICTIONARY: | 220 case PDFOBJ_DICTIONARY: |
222 return AsDictionary()->Identical(pOther->AsDictionary()); | 221 return AsDictionary()->Identical(pOther->AsDictionary()); |
223 case PDFOBJ_NULL: | 222 case PDFOBJ_NULL: |
224 return TRUE; | 223 return TRUE; |
225 case PDFOBJ_STREAM: | 224 case PDFOBJ_STREAM: |
226 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); | 225 return (((CPDF_Stream*)this)->Identical((CPDF_Stream*)pOther)); |
227 case PDFOBJ_REFERENCE: | 226 case PDFOBJ_REFERENCE: |
228 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther)); | 227 return (((CPDF_Reference*)this)->Identical((CPDF_Reference*)pOther)); |
229 } | 228 } |
230 return FALSE; | 229 return FALSE; |
(...skipping 23 matching lines...) Expand all Loading... |
254 : pThis->m_Float); | 253 : pThis->m_Float); |
255 } | 254 } |
256 case PDFOBJ_STRING: { | 255 case PDFOBJ_STRING: { |
257 const CPDF_String* pString = AsString(); | 256 const CPDF_String* pString = AsString(); |
258 return new CPDF_String(pString->m_String, pString->IsHex()); | 257 return new CPDF_String(pString->m_String, pString->IsHex()); |
259 } | 258 } |
260 case PDFOBJ_NAME: | 259 case PDFOBJ_NAME: |
261 return new CPDF_Name(AsName()->m_Name); | 260 return new CPDF_Name(AsName()->m_Name); |
262 case PDFOBJ_ARRAY: { | 261 case PDFOBJ_ARRAY: { |
263 CPDF_Array* pCopy = new CPDF_Array(); | 262 CPDF_Array* pCopy = new CPDF_Array(); |
264 CPDF_Array* pThis = (CPDF_Array*)this; | 263 const CPDF_Array* pThis = AsArray(); |
265 int n = pThis->GetCount(); | 264 int n = pThis->GetCount(); |
266 for (int i = 0; i < n; i++) { | 265 for (int i = 0; i < n; i++) { |
267 CPDF_Object* value = (CPDF_Object*)pThis->m_Objects.GetAt(i); | 266 CPDF_Object* value = (CPDF_Object*)pThis->m_Objects.GetAt(i); |
268 pCopy->m_Objects.Add(value->CloneInternal(bDirect, visited)); | 267 pCopy->m_Objects.Add(value->CloneInternal(bDirect, visited)); |
269 } | 268 } |
270 return pCopy; | 269 return pCopy; |
271 } | 270 } |
272 case PDFOBJ_DICTIONARY: { | 271 case PDFOBJ_DICTIONARY: { |
273 CPDF_Dictionary* pCopy = new CPDF_Dictionary(); | 272 CPDF_Dictionary* pCopy = new CPDF_Dictionary(); |
274 const CPDF_Dictionary* pThis = AsDictionary(); | 273 const CPDF_Dictionary* pThis = AsDictionary(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) { | 333 void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len) { |
335 if (CPDF_String* pString = AsString()) { | 334 if (CPDF_String* pString = AsString()) { |
336 pString->m_String = PDF_EncodeText(pUnicodes, len); | 335 pString->m_String = PDF_EncodeText(pUnicodes, len); |
337 } else if (m_Type == PDFOBJ_STREAM) { | 336 } else if (m_Type == PDFOBJ_STREAM) { |
338 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); | 337 CFX_ByteString result = PDF_EncodeText(pUnicodes, len); |
339 ((CPDF_Stream*)this) | 338 ((CPDF_Stream*)this) |
340 ->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE); | 339 ->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE); |
341 } | 340 } |
342 } | 341 } |
343 | 342 |
| 343 CPDF_Array* CPDF_Object::AsArray() { |
| 344 return IsArray() ? static_cast<CPDF_Array*>(this) : nullptr; |
| 345 } |
| 346 |
| 347 const CPDF_Array* CPDF_Object::AsArray() const { |
| 348 return IsArray() ? static_cast<const CPDF_Array*>(this) : nullptr; |
| 349 } |
| 350 |
344 CPDF_Boolean* CPDF_Object::AsBoolean() { | 351 CPDF_Boolean* CPDF_Object::AsBoolean() { |
345 return IsBoolean() ? static_cast<CPDF_Boolean*>(this) : nullptr; | 352 return IsBoolean() ? static_cast<CPDF_Boolean*>(this) : nullptr; |
346 } | 353 } |
347 | 354 |
348 const CPDF_Boolean* CPDF_Object::AsBoolean() const { | 355 const CPDF_Boolean* CPDF_Object::AsBoolean() const { |
349 return IsBoolean() ? static_cast<const CPDF_Boolean*>(this) : nullptr; | 356 return IsBoolean() ? static_cast<const CPDF_Boolean*>(this) : nullptr; |
350 } | 357 } |
351 | 358 |
352 CPDF_Dictionary* CPDF_Object::AsDictionary() { | 359 CPDF_Dictionary* CPDF_Object::AsDictionary() { |
353 return IsDictionary() ? static_cast<CPDF_Dictionary*>(this) : nullptr; | 360 return IsDictionary() ? static_cast<CPDF_Dictionary*>(this) : nullptr; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 CPDF_Array::~CPDF_Array() { | 420 CPDF_Array::~CPDF_Array() { |
414 int size = m_Objects.GetSize(); | 421 int size = m_Objects.GetSize(); |
415 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); | 422 CPDF_Object** pList = (CPDF_Object**)m_Objects.GetData(); |
416 for (int i = 0; i < size; i++) { | 423 for (int i = 0; i < size; i++) { |
417 if (pList[i]) | 424 if (pList[i]) |
418 pList[i]->Release(); | 425 pList[i]->Release(); |
419 } | 426 } |
420 } | 427 } |
421 CFX_FloatRect CPDF_Array::GetRect() { | 428 CFX_FloatRect CPDF_Array::GetRect() { |
422 CFX_FloatRect rect; | 429 CFX_FloatRect rect; |
423 if (m_Type != PDFOBJ_ARRAY || m_Objects.GetSize() != 4) { | 430 if (!IsArray() || m_Objects.GetSize() != 4) |
424 return rect; | 431 return rect; |
425 } | 432 |
426 rect.left = GetNumber(0); | 433 rect.left = GetNumber(0); |
427 rect.bottom = GetNumber(1); | 434 rect.bottom = GetNumber(1); |
428 rect.right = GetNumber(2); | 435 rect.right = GetNumber(2); |
429 rect.top = GetNumber(3); | 436 rect.top = GetNumber(3); |
430 return rect; | 437 return rect; |
431 } | 438 } |
432 CFX_AffineMatrix CPDF_Array::GetMatrix() { | 439 CFX_AffineMatrix CPDF_Array::GetMatrix() { |
433 CFX_AffineMatrix matrix; | 440 CFX_AffineMatrix matrix; |
434 if (m_Type != PDFOBJ_ARRAY || m_Objects.GetSize() != 6) { | 441 if (!IsArray() || m_Objects.GetSize() != 6) |
435 return matrix; | 442 return matrix; |
436 } | 443 |
437 matrix.Set(GetNumber(0), GetNumber(1), GetNumber(2), GetNumber(3), | 444 matrix.Set(GetNumber(0), GetNumber(1), GetNumber(2), GetNumber(3), |
438 GetNumber(4), GetNumber(5)); | 445 GetNumber(4), GetNumber(5)); |
439 return matrix; | 446 return matrix; |
440 } | 447 } |
441 CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { | 448 CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { |
442 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 449 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
443 return NULL; | 450 return NULL; |
444 } | 451 } |
445 return (CPDF_Object*)m_Objects.GetAt(i); | 452 return (CPDF_Object*)m_Objects.GetAt(i); |
446 } | 453 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 return NULL; | 499 return NULL; |
493 } | 500 } |
494 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const { | 501 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const { |
495 CPDF_Object* p = GetElementValue(i); | 502 CPDF_Object* p = GetElementValue(i); |
496 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { | 503 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { |
497 return NULL; | 504 return NULL; |
498 } | 505 } |
499 return (CPDF_Stream*)p; | 506 return (CPDF_Stream*)p; |
500 } | 507 } |
501 CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const { | 508 CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const { |
502 CPDF_Object* p = GetElementValue(i); | 509 return ToArray(GetElementValue(i)); |
503 if (p == NULL || p->GetType() != PDFOBJ_ARRAY) { | |
504 return NULL; | |
505 } | |
506 return (CPDF_Array*)p; | |
507 } | 510 } |
508 void CPDF_Array::RemoveAt(FX_DWORD i) { | 511 void CPDF_Array::RemoveAt(FX_DWORD i) { |
509 ASSERT(m_Type == PDFOBJ_ARRAY); | 512 ASSERT(IsArray()); |
510 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 513 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
511 return; | 514 return; |
512 } | 515 } |
513 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); | 516 CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i); |
514 if (p) | 517 if (p) |
515 p->Release(); | 518 p->Release(); |
516 m_Objects.RemoveAt(i); | 519 m_Objects.RemoveAt(i); |
517 } | 520 } |
518 void CPDF_Array::SetAt(FX_DWORD i, | 521 void CPDF_Array::SetAt(FX_DWORD i, |
519 CPDF_Object* pObj, | 522 CPDF_Object* pObj, |
520 CPDF_IndirectObjects* pObjs) { | 523 CPDF_IndirectObjects* pObjs) { |
521 ASSERT(m_Type == PDFOBJ_ARRAY); | 524 ASSERT(IsArray()); |
522 ASSERT(i < (FX_DWORD)m_Objects.GetSize()); | 525 ASSERT(i < (FX_DWORD)m_Objects.GetSize()); |
523 if (i >= (FX_DWORD)m_Objects.GetSize()) { | 526 if (i >= (FX_DWORD)m_Objects.GetSize()) { |
524 return; | 527 return; |
525 } | 528 } |
526 CPDF_Object* pOld = (CPDF_Object*)m_Objects.GetAt(i); | 529 CPDF_Object* pOld = (CPDF_Object*)m_Objects.GetAt(i); |
527 if (pOld) | 530 if (pOld) |
528 pOld->Release(); | 531 pOld->Release(); |
529 if (pObj->GetObjNum()) { | 532 if (pObj->GetObjNum()) { |
530 ASSERT(pObjs != NULL); | 533 ASSERT(pObjs != NULL); |
531 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); | 534 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); |
(...skipping 12 matching lines...) Expand all Loading... |
544 } | 547 } |
545 void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) { | 548 void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) { |
546 ASSERT(pObj != NULL); | 549 ASSERT(pObj != NULL); |
547 if (pObj->GetObjNum()) { | 550 if (pObj->GetObjNum()) { |
548 ASSERT(pObjs != NULL); | 551 ASSERT(pObjs != NULL); |
549 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); | 552 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); |
550 } | 553 } |
551 m_Objects.Add(pObj); | 554 m_Objects.Add(pObj); |
552 } | 555 } |
553 void CPDF_Array::AddName(const CFX_ByteString& str) { | 556 void CPDF_Array::AddName(const CFX_ByteString& str) { |
554 ASSERT(m_Type == PDFOBJ_ARRAY); | 557 ASSERT(IsArray()); |
555 Add(new CPDF_Name(str)); | 558 Add(new CPDF_Name(str)); |
556 } | 559 } |
557 void CPDF_Array::AddString(const CFX_ByteString& str) { | 560 void CPDF_Array::AddString(const CFX_ByteString& str) { |
558 ASSERT(m_Type == PDFOBJ_ARRAY); | 561 ASSERT(IsArray()); |
559 Add(new CPDF_String(str)); | 562 Add(new CPDF_String(str)); |
560 } | 563 } |
561 void CPDF_Array::AddInteger(int i) { | 564 void CPDF_Array::AddInteger(int i) { |
562 ASSERT(m_Type == PDFOBJ_ARRAY); | 565 ASSERT(IsArray()); |
563 Add(new CPDF_Number(i)); | 566 Add(new CPDF_Number(i)); |
564 } | 567 } |
565 void CPDF_Array::AddNumber(FX_FLOAT f) { | 568 void CPDF_Array::AddNumber(FX_FLOAT f) { |
566 ASSERT(m_Type == PDFOBJ_ARRAY); | 569 ASSERT(IsArray()); |
567 CPDF_Number* pNumber = new CPDF_Number; | 570 CPDF_Number* pNumber = new CPDF_Number; |
568 pNumber->SetNumber(f); | 571 pNumber->SetNumber(f); |
569 Add(pNumber); | 572 Add(pNumber); |
570 } | 573 } |
571 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { | 574 void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { |
572 ASSERT(m_Type == PDFOBJ_ARRAY); | 575 ASSERT(IsArray()); |
573 Add(new CPDF_Reference(pDoc, objnum)); | 576 Add(new CPDF_Reference(pDoc, objnum)); |
574 } | 577 } |
575 FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const { | 578 FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const { |
576 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { | 579 if (m_Objects.GetSize() != pOther->m_Objects.GetSize()) { |
577 return FALSE; | 580 return FALSE; |
578 } | 581 } |
579 for (int i = 0; i < m_Objects.GetSize(); i++) | 582 for (int i = 0; i < m_Objects.GetSize(); i++) |
580 if (!((CPDF_Object*)m_Objects[i]) | 583 if (!((CPDF_Object*)m_Objects[i]) |
581 ->IsIdentical((CPDF_Object*)pOther->m_Objects[i])) { | 584 ->IsIdentical((CPDF_Object*)pOther->m_Objects[i])) { |
582 return FALSE; | 585 return FALSE; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 708 } |
706 if (CPDF_Dictionary* pDict = p->AsDictionary()) { | 709 if (CPDF_Dictionary* pDict = p->AsDictionary()) { |
707 return pDict; | 710 return pDict; |
708 } | 711 } |
709 if (p->GetType() == PDFOBJ_STREAM) { | 712 if (p->GetType() == PDFOBJ_STREAM) { |
710 return ((CPDF_Stream*)p)->GetDict(); | 713 return ((CPDF_Stream*)p)->GetDict(); |
711 } | 714 } |
712 return nullptr; | 715 return nullptr; |
713 } | 716 } |
714 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const { | 717 CPDF_Array* CPDF_Dictionary::GetArray(const CFX_ByteStringC& key) const { |
715 CPDF_Object* p = GetElementValue(key); | 718 return ToArray(GetElementValue(key)); |
716 if (p == NULL || p->GetType() != PDFOBJ_ARRAY) { | |
717 return NULL; | |
718 } | |
719 return (CPDF_Array*)p; | |
720 } | 719 } |
721 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { | 720 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { |
722 CPDF_Object* p = GetElementValue(key); | 721 CPDF_Object* p = GetElementValue(key); |
723 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { | 722 if (p == NULL || p->GetType() != PDFOBJ_STREAM) { |
724 return NULL; | 723 return NULL; |
725 } | 724 } |
726 return (CPDF_Stream*)p; | 725 return (CPDF_Stream*)p; |
727 } | 726 } |
728 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { | 727 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { |
729 CFX_FloatRect rect; | 728 CFX_FloatRect rect; |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } | 1237 } |
1239 pObj->m_ObjNum = objnum; | 1238 pObj->m_ObjNum = objnum; |
1240 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1239 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
1241 if (m_LastObjNum < objnum) { | 1240 if (m_LastObjNum < objnum) { |
1242 m_LastObjNum = objnum; | 1241 m_LastObjNum = objnum; |
1243 } | 1242 } |
1244 } | 1243 } |
1245 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { | 1244 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { |
1246 return m_LastObjNum; | 1245 return m_LastObjNum; |
1247 } | 1246 } |
OLD | NEW |