Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 1135713004: Fix errors from commit f0a169e. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "text_int.h" 9 #include "text_int.h"
10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) 10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1])
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 { 1360 {
1361 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); 1361 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb");
1362 if (pFile == NULL) { 1362 if (pFile == NULL) {
1363 return; 1363 return;
1364 } 1364 }
1365 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); 1365 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
1366 FX_DWORD filesize = FXSYS_ftell(pFile); 1366 FX_DWORD filesize = FXSYS_ftell(pFile);
1367 FX_BYTE buffer[16]; 1367 FX_BYTE buffer[16];
1368 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); 1368 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
1369 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); 1369 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
1370 if (readCnt != 12) { 1370 if (readCnt != 1) {
1371 FXSYS_fclose(pFile); 1371 FXSYS_fclose(pFile);
1372 return; 1372 return;
1373 } 1373 }
1374 1374
1375 if (GET_TT_LONG(buffer) == 0x74746366) { 1375 if (GET_TT_LONG(buffer) == 0x74746366) {
1376 FX_DWORD nFaces = GET_TT_LONG(buffer + 8); 1376 FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
1377 if (nFaces > FX_DWORD_MAX / 4) { 1377 if (nFaces > FX_DWORD_MAX / 4) {
1378 FXSYS_fclose(pFile); 1378 FXSYS_fclose(pFile);
1379 return; 1379 return;
1380 } 1380 }
1381 FX_DWORD face_bytes = nFaces * 4; 1381 FX_DWORD face_bytes = nFaces * 4;
1382 FX_LPBYTE offsets = FX_Alloc(FX_BYTE, face_bytes); 1382 FX_LPBYTE offsets = FX_Alloc(FX_BYTE, face_bytes);
1383 if (!offsets) { 1383 if (!offsets) {
1384 FXSYS_fclose(pFile); 1384 FXSYS_fclose(pFile);
1385 return; 1385 return;
1386 } 1386 }
1387 readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile); 1387 readCnt = FXSYS_fread(offsets, face_bytes, 1, pFile);
1388 if (readCnt != face_bytes) { 1388 if (readCnt != face_bytes) {
1389 FX_Free(offsets);
1389 FXSYS_fclose(pFile); 1390 FXSYS_fclose(pFile);
1390 return; 1391 return;
1391 } 1392 }
1392 for (FX_DWORD i = 0; i < nFaces; i ++) { 1393 for (FX_DWORD i = 0; i < nFaces; i ++) {
1393 FX_LPBYTE p = offsets + i * 4; 1394 FX_LPBYTE p = offsets + i * 4;
1394 ReportFace(path, pFile, filesize, GET_TT_LONG(p)); 1395 ReportFace(path, pFile, filesize, GET_TT_LONG(p));
1395 } 1396 }
1396 FX_Free(offsets); 1397 FX_Free(offsets);
1397 } else { 1398 } else {
1398 ReportFace(path, pFile, filesize, 0); 1399 ReportFace(path, pFile, filesize, 0);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 return FALSE; 1529 return FALSE;
1529 } 1530 }
1530 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1531 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1531 name = pFont->m_FaceName; 1532 name = pFont->m_FaceName;
1532 return TRUE; 1533 return TRUE;
1533 } 1534 }
1534 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1535 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1535 { 1536 {
1536 return FALSE; 1537 return FALSE;
1537 } 1538 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698