]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/ucnv_ext.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / ucnv_ext.cpp
index 5cd1ab6174737c535431e0bb25dcc4c7b84e4d38..7dea4eef41a408b58f74f327b7972cef192b4b66 100644 (file)
@@ -1,12 +1,14 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2003-2013, International Business Machines
+*   Copyright (C) 2003-2016, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
 *   file name:  ucnv_ext.cpp
-*   encoding:   US-ASCII
+*   encoding:   UTF-8
 *   tab size:   8 (not used)
 *   indentation:4
 *
@@ -21,6 +23,7 @@
 #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION
 
 #include "unicode/uset.h"
+#include "unicode/ustring.h"
 #include "ucnv_bld.h"
 #include "ucnv_cnv.h"
 #include "ucnv_ext.h"
@@ -690,10 +693,13 @@ ucnv_extWriteFromU(UConverter *cnv, const int32_t *cx,
         switch(length) {
         case 3:
             *p++=(uint8_t)(value>>16);
-        case 2: /*fall through*/
+            U_FALLTHROUGH;
+        case 2:
             *p++=(uint8_t)(value>>8);
-        case 1: /*fall through*/
+            U_FALLTHROUGH;
+        case 1:
             *p++=(uint8_t)value;
+            U_FALLTHROUGH;
         default:
             break; /* will never occur */
         }
@@ -880,7 +886,7 @@ ucnv_extContinueMatchFromU(UConverter *cnv,
         } else {
             /* the match did not use all of preFromU[] - keep the rest for replay */
             int32_t length=cnv->preFromULength-match;
-            uprv_memmove(cnv->preFromU, cnv->preFromU+match, length*U_SIZEOF_UCHAR);
+            u_memmove(cnv->preFromU, cnv->preFromU+match, length);
             cnv->preFromULength=(int8_t)-length;
         }