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 "public/fpdf_flatten.h" | 7 #include "public/fpdf_flatten.h" |
8 | 8 |
9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 | 10 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 CPDF_Stream* pAPStream = pAnnotAP->GetStream("N"); | 434 CPDF_Stream* pAPStream = pAnnotAP->GetStream("N"); |
435 if (!pAPStream) { | 435 if (!pAPStream) { |
436 CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N"); | 436 CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N"); |
437 if (!pAPDic) | 437 if (!pAPDic) |
438 continue; | 438 continue; |
439 | 439 |
440 if (!sAnnotState.IsEmpty()) { | 440 if (!sAnnotState.IsEmpty()) { |
441 pAPStream = pAPDic->GetStream(sAnnotState); | 441 pAPStream = pAPDic->GetStream(sAnnotState); |
442 } else { | 442 } else { |
443 FX_POSITION pos = pAPDic->GetStartPos(); | 443 auto it = pAPDic->begin(); |
444 if (pos) { | 444 if (it != pAPDic->end()) { |
445 CFX_ByteString sKey; | 445 CPDF_Object* pFirstObj = it->second; |
446 CPDF_Object* pFirstObj = pAPDic->GetNextElement(pos, sKey); | |
447 if (pFirstObj) { | 446 if (pFirstObj) { |
448 if (pFirstObj->IsReference()) | 447 if (pFirstObj->IsReference()) |
449 pFirstObj = pFirstObj->GetDirect(); | 448 pFirstObj = pFirstObj->GetDirect(); |
450 if (!pFirstObj->IsStream()) | 449 if (!pFirstObj->IsStream()) |
451 continue; | 450 continue; |
452 pAPStream = pFirstObj->AsStream(); | 451 pAPStream = pFirstObj->AsStream(); |
453 } | 452 } |
454 } | 453 } |
455 } | 454 } |
456 } | 455 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, | 513 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, |
515 FALSE); | 514 FALSE); |
516 } | 515 } |
517 pPageDict->RemoveAt("Annots"); | 516 pPageDict->RemoveAt("Annots"); |
518 | 517 |
519 ObjectArray.RemoveAll(); | 518 ObjectArray.RemoveAll(); |
520 RectArray.RemoveAll(); | 519 RectArray.RemoveAll(); |
521 | 520 |
522 return FLATTEN_SUCCESS; | 521 return FLATTEN_SUCCESS; |
523 } | 522 } |
OLD | NEW |