]> granicus.if.org Git - icu/commitdiff
ICU-8773 use real array element comparison, not memcmp()
authorMarkus Scherer <markus.icu@gmail.com>
Fri, 8 Jun 2012 21:31:22 +0000 (21:31 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 8 Jun 2012 21:31:22 +0000 (21:31 +0000)
X-SVN-Rev: 31926

icu4c/source/common/messagepattern.cpp

index ed6ee252a66dd5275b7c5ff2b376abbfc3ed85f0..1f0beba91d0ad540a0e4ff6fe130644df6994ac4 100644 (file)
@@ -93,8 +93,11 @@ public:
                   int32_t length,
                   UErrorCode &errorCode);
     UBool ensureCapacityForOneMore(int32_t oldLength, UErrorCode &errorCode);
-    UBool memEquals(const MessagePatternList<T, stackCapacity> &other, int32_t length) const {
-        return 0==uprv_memcmp(a.getAlias(), other.a.getAlias(), length*sizeof(T));
+    UBool equals(const MessagePatternList<T, stackCapacity> &other, int32_t length) const {
+        for(int32_t i=0; i<length; ++i) {
+            if(a[i]!=other.a[i]) { return FALSE; }
+        }
+        return TRUE;
     }
 
     MaybeStackArray<T, stackCapacity> a;
@@ -314,7 +317,7 @@ MessagePattern::operator==(const MessagePattern &other) const {
         msg==other.msg &&
         // parts.equals(o.parts)
         partsLength==other.partsLength &&
-        (partsLength==0 || partsList->memEquals(*other.partsList, partsLength));
+        (partsLength==0 || partsList->equals(*other.partsList, partsLength));
     // No need to compare numericValues if msg and parts are the same.
 }