Chromium Code Reviews| 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 "parser_int.h" | 7 #include "parser_int.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2968 } | 2968 } |
| 2969 } | 2969 } |
| 2970 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { | 2970 void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { |
| 2971 m_pDocument = pDoc; | 2971 m_pDocument = pDoc; |
| 2972 } | 2972 } |
| 2973 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { | 2973 FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { |
| 2974 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser()); | 2974 CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser()); |
| 2975 if (!pParser || !pParser->IsValidObjectNumber(objnum)) | 2975 if (!pParser || !pParser->IsValidObjectNumber(objnum)) |
| 2976 return 0; | 2976 return 0; |
| 2977 | 2977 |
| 2978 if (pParser->m_V5Type[objnum] == 2) { | 2978 if (pParser->m_V5Type[objnum] == 2) |
| 2979 objnum = pParser->m_ObjectInfo[objnum].pos; | 2979 objnum = pParser->m_ObjectInfo[objnum].pos; |
|
Lei Zhang
2015/12/25 05:12:21
Changing a passed by value param makes no sense.
| |
| 2980 } else if (pParser->m_V5Type[objnum] == 1 || | 2980 |
| 2981 pParser->m_V5Type[objnum] == 255) { | 2981 if (pParser->m_V5Type[objnum] == 1 || pParser->m_V5Type[objnum] == 255) { |
| 2982 offset = pParser->m_ObjectInfo[objnum].pos; | 2982 offset = pParser->m_ObjectInfo[objnum].pos; |
| 2983 if (offset == 0) { | 2983 if (offset == 0) { |
| 2984 return 0; | 2984 return 0; |
| 2985 } | 2985 } |
| 2986 void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), | 2986 void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), |
| 2987 pParser->m_SortedOffset.GetSize(), | 2987 pParser->m_SortedOffset.GetSize(), |
| 2988 sizeof(FX_FILESIZE), CompareFileSize); | 2988 sizeof(FX_FILESIZE), CompareFileSize); |
| 2989 if (!pResult) { | 2989 if (!pResult) { |
| 2990 return 0; | 2990 return 0; |
| 2991 } | 2991 } |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4987 if (!m_pLinearizedDict) | 4987 if (!m_pLinearizedDict) |
| 4988 return -1; | 4988 return -1; |
| 4989 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); | 4989 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); |
| 4990 if (!pRange) | 4990 if (!pRange) |
| 4991 return -1; | 4991 return -1; |
| 4992 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4992 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
| 4993 if (!pStreamLen) | 4993 if (!pStreamLen) |
| 4994 return -1; | 4994 return -1; |
| 4995 return pStreamLen->GetInteger(); | 4995 return pStreamLen->GetInteger(); |
| 4996 } | 4996 } |
| OLD | NEW |