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

Side by Side Diff: source/i18n/uspoof.cpp

Issue 2499493002: Cherry pick 2 more patches from the upstream (Closed)
Patch Set: Created 4 years, 1 month 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 | « source/common/ucasemap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (C) 2016 and later: Unicode, Inc. and others. 1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html 2 // License & terms of use: http://www.unicode.org/copyright.html
3 /* 3 /*
4 *************************************************************************** 4 ***************************************************************************
5 * Copyright (C) 2008-2015, International Business Machines Corporation 5 * Copyright (C) 2008-2015, International Business Machines Corporation
6 * and others. All Rights Reserved. 6 * and others. All Rights Reserved.
7 *************************************************************************** 7 ***************************************************************************
8 * file name: uspoof.cpp 8 * file name: uspoof.cpp
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, 639 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
640 uint32_t /*type*/, 640 uint32_t /*type*/,
641 const UnicodeString &id, 641 const UnicodeString &id,
642 UnicodeString &dest, 642 UnicodeString &dest,
643 UErrorCode *status) { 643 UErrorCode *status) {
644 const SpoofImpl *This = SpoofImpl::validateThis(sc, *status); 644 const SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
645 if (U_FAILURE(*status)) { 645 if (U_FAILURE(*status)) {
646 return dest; 646 return dest;
647 } 647 }
648 648
649 // Check that at least one of the CONFUSABLE flags is turned on. If not,
650 // return an error.
651 if ((This->fChecks & USPOOF_CONFUSABLE) == 0) {
652 *status = U_ILLEGAL_ARGUMENT_ERROR;
653 return dest;
654 }
655
656 UnicodeString nfdId; 649 UnicodeString nfdId;
657 gNfdNormalizer->normalize(id, nfdId, *status); 650 gNfdNormalizer->normalize(id, nfdId, *status);
658 651
659 // Apply the skeleton mapping to the NFD normalized input string 652 // Apply the skeleton mapping to the NFD normalized input string
660 // Accumulate the skeleton, possibly unnormalized, in a UnicodeString. 653 // Accumulate the skeleton, possibly unnormalized, in a UnicodeString.
661 int32_t inputIndex = 0; 654 int32_t inputIndex = 0;
662 UnicodeString skelStr; 655 UnicodeString skelStr;
663 int32_t normalizedLen = nfdId.length(); 656 int32_t normalizedLen = nfdId.length();
664 for (inputIndex=0; inputIndex < normalizedLen; ) { 657 for (inputIndex=0; inputIndex < normalizedLen; ) {
665 UChar32 c = nfdId.char32At(inputIndex); 658 UChar32 c = nfdId.char32At(inputIndex);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 U_CAPI const USet* U_EXPORT2 767 U_CAPI const USet* U_EXPORT2
775 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode * status) { 768 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode * status) {
776 const CheckResult* This = CheckResult::validateThis(checkResult, *status); 769 const CheckResult* This = CheckResult::validateThis(checkResult, *status);
777 if (U_FAILURE(*status)) { return NULL; } 770 if (U_FAILURE(*status)) { return NULL; }
778 return This->fNumerics.toUSet(); 771 return This->fNumerics.toUSet();
779 } 772 }
780 773
781 774
782 775
783 #endif // !UCONFIG_NO_NORMALIZATION 776 #endif // !UCONFIG_NO_NORMALIZATION
OLDNEW
« no previous file with comments | « source/common/ucasemap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698