]> granicus.if.org Git - icu/commitdiff
ICU-12507 RBBI data loading, incorporate Markus's review comments.
authorAndy Heninger <andy.heninger@gmail.com>
Mon, 17 Jul 2017 21:22:53 +0000 (21:22 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Mon, 17 Jul 2017 21:22:53 +0000 (21:22 +0000)
X-SVN-Rev: 40268

icu4c/source/common/rbbidata.cpp
icu4c/source/common/rbbidata.h

index 32f3d32d508dc6f4bb51a46368550ba181312fa5..9850be12dfc0a4ee41d43252ded2c3f2a4f375da 100644 (file)
@@ -66,13 +66,8 @@ RBBIDataWrapper::RBBIDataWrapper(UDataMemory* udm, UErrorCode &status) {
     fUDataMem = udm;
 }
 
-UBool RBBIDataWrapper::isDataVersionAcceptable(const uint8_t version[]) {
-    for (int i=0; i<UPRV_LENGTHOF(RBBI_DATA_FORMAT_VERSION); ++i) {
-        if (RBBI_DATA_FORMAT_VERSION[i] != version[i]) {
-            return false;
-        }
-    }
-    return true;
+UBool RBBIDataWrapper::isDataVersionAcceptable(const UVersionInfo version) {
+    return RBBI_DATA_FORMAT_VERSION[0] == version[0];
 }
 
 
index f1608b54285a7d8e5e2b9eefb86824ab2f1c7f57..bd703f9029fefa03c894f8fbc68bcc9c3e867430 100644 (file)
@@ -51,6 +51,7 @@ ubrk_swap(const UDataSwapper *ds,
 
 #include "unicode/uobject.h"
 #include "unicode/unistr.h"
+#include "unicode/uversion.h"
 #include "umutex.h"
 #include "utrie2.h"
 
@@ -64,12 +65,9 @@ static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {4, 0, 0, 0};
  */
 struct RBBIDataHeader {
     uint32_t         fMagic;           /*  == 0xbla0                                               */
-    uint8_t          fFormatVersion[4]; /* Data Format.  Same as the value in struct UDataInfo      */
+    UVersionInfo     fFormatVersion;   /* Data Format.  Same as the value in struct UDataInfo      */
                                        /*   if there is one associated with this data.             */
                                        /*     (version originates in rbbi, is copied to UDataInfo) */
-                                       /*   For ICU 3.2 and earlier, this field was                */
-                                       /*       uint32_t  fVersion                                 */
-                                       /*   with a value of 1.                                     */
     uint32_t         fLength;          /*  Total length in bytes of this RBBI Data,                */
                                        /*      including all sections, not just the header.        */
     uint32_t         fCatCount;        /*  Number of character categories.                         */
@@ -155,7 +153,7 @@ public:
     RBBIDataWrapper(UDataMemory* udm, UErrorCode &status);
     ~RBBIDataWrapper();
 
-    static UBool          isDataVersionAcceptable(const uint8_t version[]);
+    static UBool          isDataVersionAcceptable(const UVersionInfo version);
 
     void                  init0();
     void                  init(const RBBIDataHeader *data, UErrorCode &status);