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/fpdfapi/fpdf_parser/cpdf_document.cpp

Issue 1986533002: Fix the code that causes warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 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 | « core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp ('k') | core/fxcrt/fx_basic_wstring.cpp » ('j') | 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 "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 if (pLogFont->lfCharSet == ANSI_CHARSET || 1095 if (pLogFont->lfCharSet == ANSI_CHARSET ||
1096 pLogFont->lfCharSet == DEFAULT_CHARSET || 1096 pLogFont->lfCharSet == DEFAULT_CHARSET ||
1097 pLogFont->lfCharSet == SYMBOL_CHARSET) { 1097 pLogFont->lfCharSet == SYMBOL_CHARSET) {
1098 if (pLogFont->lfCharSet == SYMBOL_CHARSET) 1098 if (pLogFont->lfCharSet == SYMBOL_CHARSET)
1099 flags |= PDFFONT_SYMBOLIC; 1099 flags |= PDFFONT_SYMBOLIC;
1100 else 1100 else
1101 flags |= PDFFONT_NONSYMBOLIC; 1101 flags |= PDFFONT_NONSYMBOLIC;
1102 pBaseDict->SetAtName("Encoding", "WinAnsiEncoding"); 1102 pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
1103 } else { 1103 } else {
1104 flags |= PDFFONT_NONSYMBOLIC; 1104 flags |= PDFFONT_NONSYMBOLIC;
1105 int i; 1105 size_t i;
1106 for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) { 1106 for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) {
1107 if (g_FX_CharsetUnicodes[i].m_Charset == pLogFont->lfCharSet) 1107 if (g_FX_CharsetUnicodes[i].m_Charset == pLogFont->lfCharSet)
1108 break; 1108 break;
1109 } 1109 }
1110 if (i < FX_ArraySize(g_FX_CharsetUnicodes)) { 1110 if (i < FX_ArraySize(g_FX_CharsetUnicodes)) {
1111 CPDF_Dictionary* pEncoding = new CPDF_Dictionary; 1111 CPDF_Dictionary* pEncoding = new CPDF_Dictionary;
1112 pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding"); 1112 pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding");
1113 CPDF_Array* pArray = new CPDF_Array; 1113 CPDF_Array* pArray = new CPDF_Array;
1114 pArray->AddInteger(128); 1114 pArray->AddInteger(128);
1115 const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; 1115 const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
(...skipping 13 matching lines...) Expand all
1129 else if (pLogFont->lfItalic) 1129 else if (pLogFont->lfItalic)
1130 basefont += ",Italic"; 1130 basefont += ",Italic";
1131 1131
1132 pBaseDict->SetAtName("Subtype", "TrueType"); 1132 pBaseDict->SetAtName("Subtype", "TrueType");
1133 pBaseDict->SetAtName("BaseFont", basefont); 1133 pBaseDict->SetAtName("BaseFont", basefont);
1134 pBaseDict->SetAtNumber("FirstChar", 32); 1134 pBaseDict->SetAtNumber("FirstChar", 32);
1135 pBaseDict->SetAtNumber("LastChar", 255); 1135 pBaseDict->SetAtNumber("LastChar", 255);
1136 int char_widths[224]; 1136 int char_widths[224];
1137 GetCharWidth(hDC, 32, 255, char_widths); 1137 GetCharWidth(hDC, 32, 255, char_widths);
1138 CPDF_Array* pWidths = new CPDF_Array; 1138 CPDF_Array* pWidths = new CPDF_Array;
1139 for (int i = 0; i < 224; i++) 1139 for (size_t i = 0; i < 224; i++)
1140 pWidths->AddInteger(char_widths[i]); 1140 pWidths->AddInteger(char_widths[i]);
1141 1141
1142 pBaseDict->SetAt("Widths", pWidths); 1142 pBaseDict->SetAt("Widths", pWidths);
1143 } else { 1143 } else {
1144 flags |= PDFFONT_NONSYMBOLIC; 1144 flags |= PDFFONT_NONSYMBOLIC;
1145 pFontDict = new CPDF_Dictionary; 1145 pFontDict = new CPDF_Dictionary;
1146 CFX_ByteString cmap; 1146 CFX_ByteString cmap;
1147 CFX_ByteString ordering; 1147 CFX_ByteString ordering;
1148 int supplement = 0; 1148 int supplement = 0;
1149 CPDF_Array* pWidthArray = new CPDF_Array; 1149 CPDF_Array* pWidthArray = new CPDF_Array;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 } 1439 }
1440 } 1440 }
1441 pFontDesc->SetAtInteger("StemV", fStemV); 1441 pFontDesc->SetAtInteger("StemV", fStemV);
1442 AddIndirectObject(pFontDesc); 1442 AddIndirectObject(pFontDesc);
1443 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); 1443 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
1444 CFRelease(traits); 1444 CFRelease(traits);
1445 CFRelease(languages); 1445 CFRelease(languages);
1446 return LoadFont(pBaseDict); 1446 return LoadFont(pBaseDict);
1447 } 1447 }
1448 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1448 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp ('k') | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698