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

Unified Diff: source/common/uarrsort.c

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/common/uarrsort.h ('k') | source/common/uassert.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/uarrsort.c
diff --git a/source/common/uarrsort.c b/source/common/uarrsort.c
index 22c769729e00368d6feee48f230a3140f19a9c3e..bb1b5bdd785febe0374a9fd0cd67f98fd41506f1 100644
--- a/source/common/uarrsort.c
+++ b/source/common/uarrsort.c
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
@@ -120,7 +122,7 @@ doInsertionSort(char *array, int32_t length, int32_t itemSize,
if(insertionPoint<j) {
char *dest=array+insertionPoint*itemSize;
uprv_memcpy(pv, item, itemSize); /* v=array[j] */
- uprv_memmove(dest+itemSize, dest, (j-insertionPoint)*itemSize);
+ uprv_memmove(dest+itemSize, dest, (j-insertionPoint)*(size_t)itemSize);
uprv_memcpy(dest, pv, itemSize); /* array[insertionPoint]=v */
}
}
@@ -181,7 +183,7 @@ subQuickSort(char *array, int32_t start, int32_t limit, int32_t itemSize,
right=limit;
/* x=array[middle] */
- uprv_memcpy(px, array+((start+limit)/2)*itemSize, itemSize);
+ uprv_memcpy(px, array+(size_t)((start+limit)/2)*itemSize, itemSize);
do {
while(/* array[left]<x */
@@ -200,9 +202,9 @@ subQuickSort(char *array, int32_t start, int32_t limit, int32_t itemSize,
--right;
if(left<right) {
- uprv_memcpy(pw, array+left*itemSize, itemSize);
- uprv_memcpy(array+left*itemSize, array+right*itemSize, itemSize);
- uprv_memcpy(array+right*itemSize, pw, itemSize);
+ uprv_memcpy(pw, array+(size_t)left*itemSize, itemSize);
+ uprv_memcpy(array+(size_t)left*itemSize, array+(size_t)right*itemSize, itemSize);
+ uprv_memcpy(array+(size_t)right*itemSize, pw, itemSize);
}
++left;
« no previous file with comments | « source/common/uarrsort.h ('k') | source/common/uassert.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698