OLD | NEW |
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.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
10 #include "core/fpdfapi/fpdf_page/pageint.h" | 10 #include "core/fpdfapi/fpdf_page/pageint.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 {3355, 0}, {3370, 0}, {3371, 0}, {3383, 128}, {3424, 204}, | 456 {3355, 0}, {3370, 0}, {3371, 0}, {3383, 128}, {3424, 204}, |
457 {3427, 1}, {3428, 129}, {3436, 178}, {3464, 186}, {3466, 186}, | 457 {3427, 1}, {3428, 129}, {3436, 178}, {3464, 186}, {3466, 186}, |
458 {3486, 204}, {3487, 0}, {3493, 1}, {3494, 0}, {3508, 0}, | 458 {3486, 204}, {3487, 0}, {3493, 1}, {3494, 0}, {3508, 0}, |
459 {3518, 0}, {3520, 0}, {3569, 1}, {3580, 238}, {3588, 0}, | 459 {3518, 0}, {3520, 0}, {3569, 1}, {3580, 238}, {3588, 0}, |
460 {3645, 238}, {3651, 204}, {3672, 238}, {3673, 238}, {3678, 238}, | 460 {3645, 238}, {3651, 204}, {3672, 238}, {3673, 238}, {3678, 238}, |
461 {3679, 238}, {3683, 0}, {3684, 0}, {3693, 1}, {3697, 1}, | 461 {3679, 238}, {3683, 0}, {3684, 0}, {3693, 1}, {3697, 1}, |
462 {3700, 222}, {3710, 162}, {3734, 204}, {3741, 178}, {3749, 162}, | 462 {3700, 222}, {3710, 162}, {3734, 204}, {3741, 178}, {3749, 162}, |
463 {3763, 163}, {3886, 134}, {105943, 0}, {106375, 1}, {3923451837, 134}, | 463 {3763, 163}, {3886, 134}, {105943, 0}, {106375, 1}, {3923451837, 134}, |
464 {3923451838, 136}, | 464 {3923451838, 136}, |
465 }; | 465 }; |
466 static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) { | 466 static uint16_t FX_GetCsFromLangCode(uint32_t uCode) { |
467 int32_t iStart = 0; | 467 int32_t iStart = 0; |
468 int32_t iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; | 468 int32_t iEnd = sizeof(gs_FXLang2CharsetTable) / sizeof(FX_LANG2CS) - 1; |
469 while (iStart <= iEnd) { | 469 while (iStart <= iEnd) { |
470 int32_t iMid = (iStart + iEnd) / 2; | 470 int32_t iMid = (iStart + iEnd) / 2; |
471 const FX_LANG2CS& charset = gs_FXLang2CharsetTable[iMid]; | 471 const FX_LANG2CS& charset = gs_FXLang2CharsetTable[iMid]; |
472 if (uCode == charset.uLang) { | 472 if (uCode == charset.uLang) { |
473 return charset.uCharset; | 473 return charset.uCharset; |
474 } | 474 } |
475 if (uCode < charset.uLang) { | 475 if (uCode < charset.uLang) { |
476 iEnd = iMid - 1; | 476 iEnd = iMid - 1; |
477 } else { | 477 } else { |
478 iStart = iMid + 1; | 478 iStart = iMid + 1; |
479 } | 479 } |
480 } | 480 } |
481 return 0; | 481 return 0; |
482 } | 482 } |
483 static FX_WORD FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { | 483 static uint16_t FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) { |
484 FXSYS_assert(pLang); | 484 FXSYS_assert(pLang); |
485 if (iLength < 0) { | 485 if (iLength < 0) { |
486 iLength = FXSYS_strlen(pLang); | 486 iLength = FXSYS_strlen(pLang); |
487 } | 487 } |
488 uint32_t uHash = FX_GetLangHashCode(pLang); | 488 uint32_t uHash = FX_GetLangHashCode(pLang); |
489 return FX_GetCsFromLangCode(uHash); | 489 return FX_GetCsFromLangCode(uHash); |
490 } | 490 } |
491 static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString& dest) { | 491 static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString& dest) { |
492 SInt32 len = CFStringGetLength(src); | 492 SInt32 len = CFStringGetLength(src); |
493 CFRange range = CFRangeMake(0, len); | 493 CFRange range = CFRangeMake(0, len); |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, | 1148 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, |
1149 const CFX_ByteStringC& name) { | 1149 const CFX_ByteStringC& name) { |
1150 if (pPageDict->KeyExist(name)) { | 1150 if (pPageDict->KeyExist(name)) { |
1151 return; | 1151 return; |
1152 } | 1152 } |
1153 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1153 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1154 if (pObj) { | 1154 if (pObj) { |
1155 pPageDict->SetAt(name, pObj->Clone()); | 1155 pPageDict->SetAt(name, pObj->Clone()); |
1156 } | 1156 } |
1157 } | 1157 } |
OLD | NEW |