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 "editint.h" | 7 #include "editint.h" |
8 | 8 |
9 #include "core/include/fxcrt/fx_ext.h" | 9 #include "core/include/fxcrt/fx_ext.h" |
10 #include "core/include/fpdfapi/fpdf_serial.h" | 10 #include "core/include/fpdfapi/fpdf_serial.h" |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 m_pXRefStream->End(this, TRUE); | 1629 m_pXRefStream->End(this, TRUE); |
1630 m_XrefStart = m_pXRefStream->m_PrevOffset; | 1630 m_XrefStart = m_pXRefStream->m_PrevOffset; |
1631 m_iStage = 90; | 1631 m_iStage = 90; |
1632 } else if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || | 1632 } else if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || |
1633 !m_pParser->IsXRefStream()) { | 1633 !m_pParser->IsXRefStream()) { |
1634 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || | 1634 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0 || |
1635 m_pParser->GetLastXRefOffset() == 0) { | 1635 m_pParser->GetLastXRefOffset() == 0) { |
1636 CFX_ByteString str; | 1636 CFX_ByteString str; |
1637 str = m_ObjectOffset.GetPtrAt(1) | 1637 str = m_ObjectOffset.GetPtrAt(1) |
1638 ? "xref\r\n" | 1638 ? "xref\r\n" |
1639 : "xref\r\n0 1\r\n0000000000 65536 f\r\n"; | 1639 : "xref\r\n0 1\r\n0000000000 65535 f\r\n"; |
1640 if (m_File.AppendString(str) < 0) { | 1640 if (m_File.AppendString(str) < 0) { |
1641 return -1; | 1641 return -1; |
1642 } | 1642 } |
1643 m_Pos = (void*)(uintptr_t)1; | 1643 m_Pos = (void*)(uintptr_t)1; |
1644 m_iStage = 81; | 1644 m_iStage = 81; |
1645 } else { | 1645 } else { |
1646 if (m_File.AppendString("xref\r\n") < 0) { | 1646 if (m_File.AppendString("xref\r\n") < 0) { |
1647 return -1; | 1647 return -1; |
1648 } | 1648 } |
1649 m_Pos = (void*)(uintptr_t)0; | 1649 m_Pos = (void*)(uintptr_t)0; |
(...skipping 11 matching lines...) Expand all Loading... |
1661 i++; | 1661 i++; |
1662 } | 1662 } |
1663 if (i > dwLastObjNum) { | 1663 if (i > dwLastObjNum) { |
1664 break; | 1664 break; |
1665 } | 1665 } |
1666 j = i; | 1666 j = i; |
1667 while (j <= dwLastObjNum && m_ObjectOffset.GetPtrAt(j)) { | 1667 while (j <= dwLastObjNum && m_ObjectOffset.GetPtrAt(j)) { |
1668 j++; | 1668 j++; |
1669 } | 1669 } |
1670 if (i == 1) { | 1670 if (i == 1) { |
1671 str.Format("0 %d\r\n0000000000 65536 f\r\n", j); | 1671 str.Format("0 %d\r\n0000000000 65535 f\r\n", j); |
1672 } else { | 1672 } else { |
1673 str.Format("%d %d\r\n", i, j - i); | 1673 str.Format("%d %d\r\n", i, j - i); |
1674 } | 1674 } |
1675 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { | 1675 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { |
1676 return -1; | 1676 return -1; |
1677 } | 1677 } |
1678 while (i < j) { | 1678 while (i < j) { |
1679 str.Format("%010d 00000 n\r\n", m_ObjectOffset[i++]); | 1679 str.Format("%010d 00000 n\r\n", m_ObjectOffset[i++]); |
1680 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { | 1680 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { |
1681 return -1; | 1681 return -1; |
(...skipping 21 matching lines...) Expand all Loading... |
1703 break; | 1703 break; |
1704 } | 1704 } |
1705 FX_DWORD dwCurrent = m_NewObjNumArray.ElementAt(j); | 1705 FX_DWORD dwCurrent = m_NewObjNumArray.ElementAt(j); |
1706 if (dwCurrent - objnum > 1) { | 1706 if (dwCurrent - objnum > 1) { |
1707 break; | 1707 break; |
1708 } | 1708 } |
1709 objnum = dwCurrent; | 1709 objnum = dwCurrent; |
1710 } | 1710 } |
1711 objnum = m_NewObjNumArray.ElementAt(i); | 1711 objnum = m_NewObjNumArray.ElementAt(i); |
1712 if (objnum == 1) { | 1712 if (objnum == 1) { |
1713 str.Format("0 %d\r\n0000000000 65536 f\r\n", j - i + 1); | 1713 str.Format("0 %d\r\n0000000000 65535 f\r\n", j - i + 1); |
1714 } else { | 1714 } else { |
1715 str.Format("%d %d\r\n", objnum, j - i); | 1715 str.Format("%d %d\r\n", objnum, j - i); |
1716 } | 1716 } |
1717 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { | 1717 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { |
1718 return -1; | 1718 return -1; |
1719 } | 1719 } |
1720 while (i < j) { | 1720 while (i < j) { |
1721 objnum = m_NewObjNumArray.ElementAt(i++); | 1721 objnum = m_NewObjNumArray.ElementAt(i++); |
1722 str.Format("%010d 00000 n\r\n", m_ObjectOffset[objnum]); | 1722 str.Format("%010d 00000 n\r\n", m_ObjectOffset[objnum]); |
1723 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { | 1723 if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 m_bNewCrypto = FALSE; | 2104 m_bNewCrypto = FALSE; |
2105 if (!m_bStandardSecurity) { | 2105 if (!m_bStandardSecurity) { |
2106 return; | 2106 return; |
2107 } | 2107 } |
2108 if (m_pEncryptDict) { | 2108 if (m_pEncryptDict) { |
2109 m_pEncryptDict->Release(); | 2109 m_pEncryptDict->Release(); |
2110 m_pEncryptDict = NULL; | 2110 m_pEncryptDict = NULL; |
2111 } | 2111 } |
2112 m_bStandardSecurity = FALSE; | 2112 m_bStandardSecurity = FALSE; |
2113 } | 2113 } |
OLD | NEW |