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

Side by Side Diff: xfa/fgas/localization/fgas_locale.cpp

Issue 1919563002: Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix issue from c4 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 | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "core/fxcrt/include/fx_xml.h" 10 #include "core/fxcrt/include/fx_xml.h"
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (pStr[ccf] == '.' || pStr[ccf] == '(') { 588 if (pStr[ccf] == '.' || pStr[ccf] == '(') {
589 break; 589 break;
590 } 590 }
591 if (pStr[ccf] == '{') { 591 if (pStr[ccf] == '{') {
592 bBraceOpen = TRUE; 592 bBraceOpen = TRUE;
593 break; 593 break;
594 } 594 }
595 wsCategory += pStr[ccf]; 595 wsCategory += pStr[ccf];
596 ccf++; 596 ccf++;
597 } 597 }
598 uint32_t dwHash = 598 uint32_t dwHash = FX_HashCode_GetW(wsCategory.AsStringC(), false);
599 FX_HashCode_String_GetW(wsCategory.c_str(), wsCategory.GetLength());
600 if (dwHash == FX_LOCALECATEGORY_DateHash) { 599 if (dwHash == FX_LOCALECATEGORY_DateHash) {
601 if (eCategory == FX_LOCALECATEGORY_Time) { 600 if (eCategory == FX_LOCALECATEGORY_Time) {
602 return FX_LOCALECATEGORY_DateTime; 601 return FX_LOCALECATEGORY_DateTime;
603 } 602 }
604 eCategory = FX_LOCALECATEGORY_Date; 603 eCategory = FX_LOCALECATEGORY_Date;
605 } else if (dwHash == FX_LOCALECATEGORY_TimeHash) { 604 } else if (dwHash == FX_LOCALECATEGORY_TimeHash) {
606 if (eCategory == FX_LOCALECATEGORY_Date) { 605 if (eCategory == FX_LOCALECATEGORY_Date) {
607 return FX_LOCALECATEGORY_DateTime; 606 return FX_LOCALECATEGORY_DateTime;
608 } 607 }
609 eCategory = FX_LOCALECATEGORY_Time; 608 eCategory = FX_LOCALECATEGORY_Time;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 pLocale = GetPatternLocale(wsLCID.AsStringC()); 747 pLocale = GetPatternLocale(wsLCID.AsStringC());
749 } else if (pStr[ccf] == '{') { 748 } else if (pStr[ccf] == '{') {
750 bBrackOpen = TRUE; 749 bBrackOpen = TRUE;
751 break; 750 break;
752 } else if (pStr[ccf] == '.') { 751 } else if (pStr[ccf] == '.') {
753 CFX_WideString wsSubCategory; 752 CFX_WideString wsSubCategory;
754 ccf++; 753 ccf++;
755 while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { 754 while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
756 wsSubCategory += pStr[ccf++]; 755 wsSubCategory += pStr[ccf++];
757 } 756 }
758 uint32_t dwSubHash = FX_HashCode_String_GetW( 757 uint32_t dwSubHash =
759 wsSubCategory.c_str(), wsSubCategory.GetLength()); 758 FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
760 FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal; 759 FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal;
761 for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) { 760 for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) {
762 if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) { 761 if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) {
763 eSubCategory = (FX_LOCALENUMSUBCATEGORY)g_FXLocaleNumSubCatData[i] 762 eSubCategory = (FX_LOCALENUMSUBCATEGORY)g_FXLocaleNumSubCatData[i]
764 .eSubCategory; 763 .eSubCategory;
765 break; 764 break;
766 } 765 }
767 } 766 }
768 wsSubCategory.clear(); 767 wsSubCategory.clear();
769 if (!pLocale) { 768 if (!pLocale) {
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 pLocale = GetPatternLocale(wsLCID.AsStringC()); 2201 pLocale = GetPatternLocale(wsLCID.AsStringC());
2203 } else if (pStr[ccf] == '{') { 2202 } else if (pStr[ccf] == '{') {
2204 bBraceOpen = TRUE; 2203 bBraceOpen = TRUE;
2205 break; 2204 break;
2206 } else if (pStr[ccf] == '.') { 2205 } else if (pStr[ccf] == '.') {
2207 CFX_WideString wsSubCategory; 2206 CFX_WideString wsSubCategory;
2208 ccf++; 2207 ccf++;
2209 while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { 2208 while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') {
2210 wsSubCategory += pStr[ccf++]; 2209 wsSubCategory += pStr[ccf++];
2211 } 2210 }
2212 uint32_t dwSubHash = FX_HashCode_String_GetW( 2211 uint32_t dwSubHash =
2213 wsSubCategory.c_str(), wsSubCategory.GetLength()); 2212 FX_HashCode_GetW(wsSubCategory.AsStringC(), false);
2214 FX_LOCALEDATETIMESUBCATEGORY eSubCategory = 2213 FX_LOCALEDATETIMESUBCATEGORY eSubCategory =
2215 FX_LOCALEDATETIMESUBCATEGORY_Medium; 2214 FX_LOCALEDATETIMESUBCATEGORY_Medium;
2216 for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) { 2215 for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) {
2217 if (g_FXLocaleDateTimeSubCatData[i].uHash == dwSubHash) { 2216 if (g_FXLocaleDateTimeSubCatData[i].uHash == dwSubHash) {
2218 eSubCategory = 2217 eSubCategory =
2219 (FX_LOCALEDATETIMESUBCATEGORY)g_FXLocaleDateTimeSubCatData[i] 2218 (FX_LOCALEDATETIMESUBCATEGORY)g_FXLocaleDateTimeSubCatData[i]
2220 .eSubCategory; 2219 .eSubCategory;
2221 break; 2220 break;
2222 } 2221 }
2223 } 2222 }
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after
4993 } 4992 }
4994 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { 4993 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const {
4995 return Multiply(val); 4994 return Multiply(val);
4996 } 4995 }
4997 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { 4996 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const {
4998 return Divide(val); 4997 return Divide(val);
4999 } 4998 }
5000 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { 4999 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const {
5001 return Modulus(val); 5000 return Modulus(val);
5002 } 5001 }
OLDNEW
« no previous file with comments | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698