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

Side by Side Diff: source/common/ucasemap.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 | « patches/uspoof.patch ('k') | source/i18n/uspoof.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 (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 * 5 *
6 * Copyright (C) 2005-2016, International Business Machines 6 * Copyright (C) 2005-2016, International Business Machines
7 * Corporation and others. All Rights Reserved. 7 * Corporation and others. All Rights Reserved.
8 * 8 *
9 ******************************************************************************* 9 *******************************************************************************
10 * file name: ucasemap.cpp 10 * file name: ucasemap.cpp
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return destIndex; 193 return destIndex;
194 } 194 }
195 195
196 static inline int32_t 196 static inline int32_t
197 appendUChar(uint8_t *dest, int32_t destIndex, int32_t destCapacity, UChar c) { 197 appendUChar(uint8_t *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
198 int32_t length=U8_LENGTH(c); 198 int32_t length=U8_LENGTH(c);
199 if(length>(INT32_MAX-destIndex)) { 199 if(length>(INT32_MAX-destIndex)) {
200 return -1; // integer overflow 200 return -1; // integer overflow
201 } 201 }
202 int32_t limit=destIndex+length; 202 int32_t limit=destIndex+length;
203 if(limit<destCapacity) { 203 if(limit<=destCapacity) {
204 U8_APPEND_UNSAFE(dest, destIndex, c); 204 U8_APPEND_UNSAFE(dest, destIndex, c);
205 } 205 }
206 return limit; 206 return limit;
207 } 207 }
208 208
209 static inline int32_t 209 static inline int32_t
210 appendString(uint8_t *dest, int32_t destIndex, int32_t destCapacity, 210 appendString(uint8_t *dest, int32_t destIndex, int32_t destCapacity,
211 const uint8_t *s, int32_t length) { 211 const uint8_t *s, int32_t length) {
212 if(length>0) { 212 if(length>0) {
213 if(length>(INT32_MAX-destIndex)) { 213 if(length>(INT32_MAX-destIndex)) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 U_CAPI int32_t U_EXPORT2 751 U_CAPI int32_t U_EXPORT2
752 ucasemap_utf8FoldCase(const UCaseMap *csm, 752 ucasemap_utf8FoldCase(const UCaseMap *csm,
753 char *dest, int32_t destCapacity, 753 char *dest, int32_t destCapacity,
754 const char *src, int32_t srcLength, 754 const char *src, int32_t srcLength,
755 UErrorCode *pErrorCode) { 755 UErrorCode *pErrorCode) {
756 return ucasemap_mapUTF8(csm, 756 return ucasemap_mapUTF8(csm,
757 (uint8_t *)dest, destCapacity, 757 (uint8_t *)dest, destCapacity,
758 (const uint8_t *)src, srcLength, 758 (const uint8_t *)src, srcLength,
759 ucasemap_internalUTF8Fold, pErrorCode); 759 ucasemap_internalUTF8Fold, pErrorCode);
760 } 760 }
OLDNEW
« no previous file with comments | « patches/uspoof.patch ('k') | source/i18n/uspoof.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698