• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/source/common/ucmndata.h b/source/common/ucmndata.h
2index c3eba9f4..15c1a6c4 100644
3--- a/source/common/ucmndata.h
4+++ b/source/common/ucmndata.h
5@@ -45,6 +45,20 @@ typedef struct  {
6     UDataInfo   info;
7 } DataHeader;
8
9+typedef struct {
10+    DataHeader hdr;
11+    char padding[8];
12+    uint32_t count, reserved;
13+    /*
14+    const struct {
15+    const char *const name;
16+    const void *const data;
17+    } toc[1];
18+    */
19+   int   fakeNameAndData[4];       /* TODO:  Change this header type from */
20+                                   /*        pointerTOC to OffsetTOC.     */
21+} ICU_Data_Header;
22+
23 typedef struct {
24     uint32_t nameOffset;
25     uint32_t dataOffset;
26diff --git a/source/common/udata.cpp b/source/common/udata.cpp
27index ec9c999c..07156da5 100644
28--- a/source/common/udata.cpp
29+++ b/source/common/udata.cpp
30@@ -643,7 +643,7 @@ U_NAMESPACE_END
31  *----------------------------------------------------------------------*/
32 #if !defined(ICU_DATA_DIR_WINDOWS)
33 // When using the Windows system data, we expect only a single data file.
34-extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
35+extern "C" const ICU_Data_Header U_DATA_API U_ICUDATA_ENTRY_POINT;
36 #endif
37
38 /*
39@@ -696,7 +696,7 @@ openCommonData(const char *path,          /*  Path from OpenChoice?          */
40 // When using the Windows system data, we expect only a single data file.
41             int32_t i;
42             for(i = 0; i < commonDataIndex; ++i) {
43-                if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT) {
44+                if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT.hdr) {
45                     /* The linked-in data is already in the list. */
46                     return NULL;
47                 }
48@@ -719,7 +719,7 @@ openCommonData(const char *path,          /*  Path from OpenChoice?          */
49         */
50 #if !defined(ICU_DATA_DIR_WINDOWS)
51 // When using the Windows system data, we expect only a single data file.
52-        setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode);
53+        setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT.hdr, FALSE, pErrorCode);
54         {
55             Mutex lock;
56             return gCommonICUDataArray[commonDataIndex];
57diff --git a/source/stubdata/stubdata.cpp b/source/stubdata/stubdata.cpp
58index 0fcab4fa..f2efd3c3 100644
59--- a/source/stubdata/stubdata.cpp
60+++ b/source/stubdata/stubdata.cpp
61@@ -22,45 +22,34 @@
62 #include "unicode/utypes.h"
63 #include "unicode/udata.h"
64 #include "unicode/uversion.h"
65+#include "ucmndata.h"
66
67
68-typedef struct {
69-    uint16_t headerSize;
70-    uint8_t magic1, magic2;
71-    UDataInfo info;
72-    char padding[8];
73-    uint32_t count, reserved;
74-    /*
75-    const struct {
76-    const char *const name;
77-    const void *const data;
78-    } toc[1];
79-    */
80-   int   fakeNameAndData[4];       /* TODO:  Change this header type from */
81-                                   /*        pointerTOC to OffsetTOC.     */
82-} ICU_Data_Header;
83-
84 extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT = {
85-    32,          /* headerSize */
86-    0xda,        /* magic1,  (see struct MappedData in udata.c)  */
87-    0x27,        /* magic2     */
88-    {            /*UDataInfo   */
89-        sizeof(UDataInfo),      /* size        */
90-        0,                      /* reserved    */
91+    {            /* DataHeader */
92+        {            /* MappedData */
93+            32,          /* headerSize */
94+            0xda,        /* magic1,  (see struct MappedData in udata.c)  */
95+            0x27,        /* magic2     */
96+        },
97+        {            /*UDataInfo   */
98+            sizeof(UDataInfo),      /* size        */
99+            0,                      /* reserved    */
100
101 #if U_IS_BIG_ENDIAN
102-        1,
103+            1,
104 #else
105-        0,
106+            0,
107 #endif
108
109-        U_CHARSET_FAMILY,
110-        sizeof(UChar),
111-        0,               /* reserved      */
112-        {                /* data format identifier */
113-           0x54, 0x6f, 0x43, 0x50}, /* "ToCP" */
114-           {1, 0, 0, 0},   /* format version major, minor, milli, micro */
115-           {0, 0, 0, 0}    /* dataVersion   */
116+            U_CHARSET_FAMILY,
117+            sizeof(UChar),
118+            0,               /* reserved      */
119+            {                /* data format identifier */
120+               0x54, 0x6f, 0x43, 0x50}, /* "ToCP" */
121+               {1, 0, 0, 0},   /* format version major, minor, milli, micro */
122+               {0, 0, 0, 0}    /* dataVersion   */
123+        },
124     },
125     {0,0,0,0,0,0,0,0},  /* Padding[8]   */
126     0,                  /* count        */
127