OLD | NEW |
---|---|
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fxge/android/cfpf_skiafontmgr.h" | 7 #include "core/fxge/android/cfpf_skiafontmgr.h" |
8 | 8 |
9 #define FPF_SKIAMATCHWEIGHT_NAME1 62 | 9 #define FPF_SKIAMATCHWEIGHT_NAME1 62 |
10 #define FPF_SKIAMATCHWEIGHT_NAME2 60 | 10 #define FPF_SKIAMATCHWEIGHT_NAME2 60 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #endif | 26 #endif |
27 static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream, | 27 static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream, |
28 unsigned long offset, | 28 unsigned long offset, |
29 unsigned char* buffer, | 29 unsigned char* buffer, |
30 unsigned long count) { | 30 unsigned long count) { |
31 IFX_SeekableReadStream* pFileRead = | 31 IFX_SeekableReadStream* pFileRead = |
32 (IFX_SeekableReadStream*)stream->descriptor.pointer; | 32 (IFX_SeekableReadStream*)stream->descriptor.pointer; |
33 if (!pFileRead) | 33 if (!pFileRead) |
34 return 0; | 34 return 0; |
35 if (count > 0) { | 35 if (count > 0) { |
36 if (!pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset, (size_t)count)) | 36 unsigned long readSize = static_cast<unsigned long>( |
37 pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset, (size_t)count)); | |
38 if (readSize != count && !pFileRead->IsEOF()) { | |
37 return 0; | 39 return 0; |
38 } | 40 } |
39 return count; | 41 return readSize; |
Tom Sepez
2016/11/16 18:32:01
readSize has gone out of scope. Did this compile?
| |
40 } | 42 } |
41 | 43 |
42 static void FPF_SkiaStream_Close(FXFT_Stream stream) {} | 44 static void FPF_SkiaStream_Close(FXFT_Stream stream) {} |
43 #ifdef __cplusplus | 45 #ifdef __cplusplus |
44 }; | 46 }; |
45 #endif | 47 #endif |
46 | 48 |
47 namespace { | 49 namespace { |
48 | 50 |
49 struct FPF_SKIAFONTMAP { | 51 struct FPF_SKIAFONTMAP { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 if ((uSerif > 1 && uSerif < 10) || uSerif > 13) | 476 if ((uSerif > 1 && uSerif < 10) || uSerif > 13) |
475 pFontDesc->m_dwStyle |= FXFONT_SERIF; | 477 pFontDesc->m_dwStyle |= FXFONT_SERIF; |
476 } | 478 } |
477 } | 479 } |
478 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) | 480 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) |
479 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; | 481 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; |
480 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); | 482 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); |
481 pFontDesc->m_iFaceIndex = face->face_index; | 483 pFontDesc->m_iFaceIndex = face->face_index; |
482 pFontDesc->m_iGlyphNum = face->num_glyphs; | 484 pFontDesc->m_iGlyphNum = face->num_glyphs; |
483 } | 485 } |
OLD | NEW |