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

Side by Side Diff: core/fpdfapi/fpdf_font/cpdf_cidfont.cpp

Issue 2027273002: Fix all the code which has duplicate variable declarations (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 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 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/fpdfapi/fpdf_font/cpdf_cidfont.h" 7 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h"
8 8
9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h"
10 #include "core/fpdfapi/fpdf_font/font_int.h" 10 #include "core/fpdfapi/fpdf_font/font_int.h"
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 iBaseEncoding = PDFFONT_ENCODING_STANDARD; 675 iBaseEncoding = PDFFONT_ENCODING_STANDARD;
676 if (bMSUnicode) { 676 if (bMSUnicode) {
677 iBaseEncoding = PDFFONT_ENCODING_WINANSI; 677 iBaseEncoding = PDFFONT_ENCODING_WINANSI;
678 } else if (bMacRoman) { 678 } else if (bMacRoman) {
679 iBaseEncoding = PDFFONT_ENCODING_MACROMAN; 679 iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
680 } 680 }
681 const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode); 681 const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode);
682 if (!name) { 682 if (!name) {
683 return charcode == 0 ? -1 : (int)charcode; 683 return charcode == 0 ? -1 : (int)charcode;
684 } 684 }
685 uint16_t unicode = PDF_UnicodeFromAdobeName(name); 685 uint16_t name_unicode = PDF_UnicodeFromAdobeName(name);
686 if (unicode) { 686 if (name_unicode) {
687 if (bMSUnicode) { 687 if (bMSUnicode) {
688 index = FXFT_Get_Char_Index(face, unicode); 688 index = FXFT_Get_Char_Index(face, name_unicode);
689 } else if (bMacRoman) { 689 } else if (bMacRoman) {
690 uint32_t maccode = 690 uint32_t maccode =
691 FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode); 691 FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, name_unicode);
692 index = !maccode ? FXFT_Get_Name_Index(face, (char*)name) 692 index = !maccode ? FXFT_Get_Name_Index(face, (char*)name)
693 : FXFT_Get_Char_Index(face, maccode); 693 : FXFT_Get_Char_Index(face, maccode);
694 } else { 694 } else {
695 return FXFT_Get_Char_Index(face, unicode); 695 return FXFT_Get_Char_Index(face, name_unicode);
696 } 696 }
697 } else { 697 } else {
698 return charcode == 0 ? -1 : (int)charcode; 698 return charcode == 0 ? -1 : (int)charcode;
699 } 699 }
700 if (index == 0 || index == 0xffff) { 700 if (index == 0 || index == 0xffff) {
701 return charcode == 0 ? -1 : (int)charcode; 701 return charcode == 0 ? -1 : (int)charcode;
702 } 702 }
703 return index; 703 return index;
704 } 704 }
705 if (m_Charset == CIDSET_JAPAN1) { 705 if (m_Charset == CIDSET_JAPAN1) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 int nElements) { 808 int nElements) {
809 int width_status = 0; 809 int width_status = 0;
810 int iCurElement = 0; 810 int iCurElement = 0;
811 int first_code = 0; 811 int first_code = 0;
812 int last_code = 0; 812 int last_code = 0;
813 for (size_t i = 0; i < pArray->GetCount(); i++) { 813 for (size_t i = 0; i < pArray->GetCount(); i++) {
814 CPDF_Object* pObj = pArray->GetDirectObjectAt(i); 814 CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
815 if (!pObj) 815 if (!pObj)
816 continue; 816 continue;
817 817
818 if (CPDF_Array* pArray = pObj->AsArray()) { 818 if (CPDF_Array* pObjArray = pObj->AsArray()) {
819 if (width_status != 1) 819 if (width_status != 1)
820 return; 820 return;
821 821
822 for (size_t j = 0; j < pArray->GetCount(); j += nElements) { 822 for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) {
823 result.Add(first_code); 823 result.Add(first_code);
824 result.Add(first_code); 824 result.Add(first_code);
825 for (int k = 0; k < nElements; k++) { 825 for (int k = 0; k < nElements; k++)
826 result.Add(pArray->GetIntegerAt(j + k)); 826 result.Add(pObjArray->GetIntegerAt(j + k));
827 }
828 first_code++; 827 first_code++;
829 } 828 }
830 width_status = 0; 829 width_status = 0;
831 } else { 830 } else {
832 if (width_status == 0) { 831 if (width_status == 0) {
833 first_code = pObj->GetInteger(); 832 first_code = pObj->GetInteger();
834 width_status = 1; 833 width_status = 1;
835 } else if (width_status == 1) { 834 } else if (width_status == 1) {
836 last_code = pObj->GetInteger(); 835 last_code = pObj->GetInteger();
837 width_status = 2; 836 width_status = 2;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 885
887 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const { 886 const uint8_t* CPDF_CIDFont::GetCIDTransform(uint16_t CID) const {
888 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 887 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
889 return nullptr; 888 return nullptr;
890 889
891 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 890 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
892 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 891 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
893 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 892 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
894 return found ? &found->a : nullptr; 893 return found ? &found->a : nullptr;
895 } 894 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698