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_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.h" |
8 #include "../../../include/fpdfapi/fpdf_resource.h" | 8 #include "../../../include/fpdfapi/fpdf_resource.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "font_int.h" | 10 #include "font_int.h" |
11 typedef struct { | 11 typedef struct { |
12 FXSYS_FILE* m_pFile; | 12 FXSYS_FILE* m_pFile; |
13 int m_nFiles; | 13 int m_nFiles; |
14 int m_IndexSize; | 14 int m_IndexSize; |
15 int m_IndexOffset; | 15 int m_IndexOffset; |
16 } FXFC_PACKAGE; | 16 } FXFC_PACKAGE; |
17 FX_LPVOID FXFC_LoadPackage(FX_LPCSTR name) | 17 FX_LPVOID FXFC_LoadPackage(FX_LPCSTR name) |
18 { | 18 { |
19 FXSYS_FILE* file = FXSYS_fopen(name, (FX_LPCSTR)"rb"); | 19 FXSYS_FILE* file = FXSYS_fopen(name, "rb"); |
20 if (file == NULL) { | 20 if (file == NULL) { |
21 return NULL; | 21 return NULL; |
22 } | 22 } |
23 FX_BYTE buf[256]; | 23 FX_BYTE buf[256]; |
24 FXSYS_fread(buf, 1, 20, file); | 24 FXSYS_fread(buf, 1, 20, file); |
25 if (*(FX_DWORD*)buf != 0x43465846) { | 25 if (*(FX_DWORD*)buf != 0x43465846) { |
26 FXSYS_fclose(file); | 26 FXSYS_fclose(file); |
27 return NULL; | 27 return NULL; |
28 } | 28 } |
29 FXFC_PACKAGE* pPackage = FX_Alloc(FXFC_PACKAGE, 1); | 29 FXFC_PACKAGE* pPackage = FX_Alloc(FXFC_PACKAGE, 1); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 FX_LPBYTE CPDF_FXMP::GetRecord(FX_DWORD index) | 85 FX_LPBYTE CPDF_FXMP::GetRecord(FX_DWORD index) |
86 { | 86 { |
87 if (m_pTable == NULL) { | 87 if (m_pTable == NULL) { |
88 return NULL; | 88 return NULL; |
89 } | 89 } |
90 if ((int)index < (int)m_pHeader->dwStartIndex || index > m_pHeader->dwEndInd
ex) { | 90 if ((int)index < (int)m_pHeader->dwStartIndex || index > m_pHeader->dwEndInd
ex) { |
91 return NULL; | 91 return NULL; |
92 } | 92 } |
93 return m_pTable + (index - m_pHeader->dwStartIndex) * m_pHeader->dwRecordSiz
e; | 93 return m_pTable + (index - m_pHeader->dwStartIndex) * m_pHeader->dwRecordSiz
e; |
94 } | 94 } |
OLD | NEW |