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

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

Issue 1287843004: Fix some -Wmaybe-uninitialized errors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 4 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
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 <limits> 7 #include <limits>
8 8
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../../../include/fxge/fx_freetype.h" 10 #include "../../../include/fxge/fx_freetype.h"
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 } 1455 }
1456 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; 1456 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
1457 FXSYS_FILE* pFile = NULL; 1457 FXSYS_FILE* pFile = NULL;
1458 if (size > 0) { 1458 if (size > 0) {
1459 pFile = FXSYS_fopen(pFont->m_FilePath, "rb"); 1459 pFile = FXSYS_fopen(pFont->m_FilePath, "rb");
1460 if (pFile == NULL) { 1460 if (pFile == NULL) {
1461 return 0; 1461 return 0;
1462 } 1462 }
1463 } 1463 }
1464 FX_DWORD datasize = 0; 1464 FX_DWORD datasize = 0;
1465 FX_DWORD offset; 1465 FX_DWORD offset = 0;
1466 if (table == 0) { 1466 if (table == 0) {
1467 datasize = pFont->m_FontOffset ? 0 : pFont->m_FileSize; 1467 datasize = pFont->m_FontOffset ? 0 : pFont->m_FileSize;
1468 offset = 0;
1469 } else if (table == 0x74746366) { 1468 } else if (table == 0x74746366) {
1470 datasize = pFont->m_FontOffset ? pFont->m_FileSize : 0; 1469 datasize = pFont->m_FontOffset ? pFont->m_FileSize : 0;
1471 offset = 0;
1472 } else { 1470 } else {
1473 FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; 1471 FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16;
1474 for (FX_DWORD i = 0; i < nTables; i++) { 1472 for (FX_DWORD i = 0; i < nTables; i++) {
1475 const uint8_t* p = (const uint8_t*)pFont->m_FontTables + i * 16; 1473 const uint8_t* p = (const uint8_t*)pFont->m_FontTables + i * 16;
1476 if (GET_TT_LONG(p) == table) { 1474 if (GET_TT_LONG(p) == table) {
Lei Zhang 2015/08/18 20:10:32 |offset| may not be initialized
Tom Sepez 2015/08/18 20:20:50 Ok, probably an error to continue if one of the ab
1477 offset = GET_TT_LONG(p + 8); 1475 offset = GET_TT_LONG(p + 8);
1478 datasize = GET_TT_LONG(p + 12); 1476 datasize = GET_TT_LONG(p + 12);
1479 } 1477 }
1480 } 1478 }
1481 } 1479 }
1482 if (datasize && size >= datasize && pFile) { 1480 if (datasize && size >= datasize && pFile) {
1483 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); 1481 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
1484 FXSYS_fread(buffer, datasize, 1, pFile); 1482 FXSYS_fread(buffer, datasize, 1, pFile);
1485 } 1483 }
1486 if (pFile) { 1484 if (pFile) {
1487 FXSYS_fclose(pFile); 1485 FXSYS_fclose(pFile);
1488 } 1486 }
1489 return datasize; 1487 return datasize;
1490 } 1488 }
1491 void CFX_FolderFontInfo::DeleteFont(void* hFont) {} 1489 void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
1492 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { 1490 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
1493 if (hFont == NULL) { 1491 if (hFont == NULL) {
1494 return FALSE; 1492 return FALSE;
1495 } 1493 }
1496 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; 1494 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
1497 name = pFont->m_FaceName; 1495 name = pFont->m_FaceName;
1498 return TRUE; 1496 return TRUE;
1499 } 1497 }
1500 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { 1498 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
1501 return FALSE; 1499 return FALSE;
1502 } 1500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698