xref: /aosp_15_r20/external/cronet/third_party/icu/patches/wpo.patch (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1diff --git a/source/common/ucmndata.h b/source/common/ucmndata.h
2index 486b4fd7..1e63833f 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 88126fc6..93458444 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 nullptr;
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 0fa2b170..32ceb185 100644
59--- a/source/stubdata/stubdata.cpp
60+++ b/source/stubdata/stubdata.cpp
61@@ -1,3 +1,4 @@
62+
63 // © 2016 and later: Unicode, Inc. and others.
64 // License & terms of use: http://www.unicode.org/copyright.html
65 /******************************************************************************
66@@ -17,36 +18,40 @@
67 *
68 *   The stub data library (for which this file is the source) is sufficient
69 *   for running the data building tools.
70+*
71 */
72-
73-#include "stubdata.h"
74-
75-extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT alignas(16) = {
76-    32,          /* headerSize */
77-    0xda,        /* magic1,  (see struct MappedData in udata.c)  */
78-    0x27,        /* magic2     */
79-    {            /*UDataInfo   */
80-        sizeof(UDataInfo),      /* size        */
81-        0,                      /* reserved    */
82-
83+#include "ucmndata.h"
84+extern "C" U_EXPORT const ICU_Data_Header U_ICUDATA_ENTRY_POINT = {
85+    {            /* DataHeader */
86+        {            /* MappedData */
87+            32,          /* headerSize */
88+            0xda,        /* magic1,  (see struct MappedData in udata.c)  */
89+            0x27,        /* magic2     */
90+        },
91+        {            /*UDataInfo   */
92+            sizeof(UDataInfo),      /* size        */
93+            0,                      /* reserved    */
94 #if U_IS_BIG_ENDIAN
95-        1,
96+            1,
97 #else
98-        0,
99+            0,
100 #endif
101-
102-        U_CHARSET_FAMILY,
103-        sizeof(char16_t),
104-        0,               /* reserved      */
105-        {0x54, 0x6f, 0x43, 0x50},   /* data format identifier: "ToCP" */
106-        {1, 0, 0, 0},   /* format version major, minor, milli, micro */
107-        {0, 0, 0, 0}    /* dataVersion   */
108+            U_CHARSET_FAMILY,
109+            sizeof(UChar),
110+            0,               /* reserved      */
111+            {                /* data format identifier */
112+               0x54, 0x6f, 0x43, 0x50}, /* "ToCP" */
113+               {1, 0, 0, 0},   /* format version major, minor, milli, micro */
114+               {0, 0, 0, 0}    /* dataVersion   */
115+        },
116     },
117-    { 's', 't', 'u', 'b', 'd', 'a', 't', 'a' },  /* Padding[8] */
118+    {0,0,0,0,0,0,0,0},  /* Padding[8]   */
119     0,                  /* count        */
120     0,                  /* Reserved     */
121     {                   /*  TOC structure */
122-        0 , 0           /* name and data entries.  Count says there are none,  */
123+/*        {    */
124+          0 , 0 , 0, 0  /* name and data entries.  Count says there are none,  */
125                         /*  but put one in just in case.                       */
126+/*        }  */
127     }
128-};
129+};
130\ No newline at end of file
131