]> granicus.if.org Git - icu/commitdiff
ICU-13164 Fixes for compilation and test errors when building for Windows/MinGW.
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Fri, 23 Jun 2017 23:28:11 +0000 (23:28 +0000)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Fri, 23 Jun 2017 23:28:11 +0000 (23:28 +0000)
X-SVN-Rev: 40203

icu4c/source/common/locmap.cpp
icu4c/source/config/mh-mingw
icu4c/source/config/mh-mingw64
icu4c/source/io/ufile.cpp
icu4c/source/test/intltest/windttst.cpp
icu4c/source/test/intltest/winnmtst.cpp
icu4c/source/tools/toolutil/pkg_genc.cpp

index 97dc00c77358c48001bfbd70f9f483c54700e89c..18994fb8602a9d6e797692ba7631a5fe45431793 100644 (file)
@@ -190,7 +190,10 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0423, be, be_BY)
 
 ILCID_POSIX_ELEMENT_ARRAY(0x0402, bg, bg_BG)
 
-ILCID_POSIX_ELEMENT_ARRAY(0x0466, bin, bin_NG)
+ILCID_POSIX_SUBTABLE(bin) {
+    {0x66, "bin"},
+    {0x0466, "bin_NG"}
+};
 
 ILCID_POSIX_SUBTABLE(bn) {
     {0x45,   "bn"},
@@ -214,7 +217,13 @@ ILCID_POSIX_SUBTABLE(ca) {
 };
 
 ILCID_POSIX_ELEMENT_ARRAY(0x0483, co, co_FR)
-ILCID_POSIX_ELEMENT_ARRAY(0x045c, chr,chr_US)
+
+ILCID_POSIX_SUBTABLE(chr) {
+    {0x05c,  "chr"},
+    {0x7c5c, "chr_Cher"},
+    {0x045c, "chr_Cher_US"},
+    {0x045c, "chr_US"}
+};
 
 // ICU has chosen different names for these.
 ILCID_POSIX_SUBTABLE(ckb) {
@@ -263,10 +272,10 @@ ILCID_POSIX_SUBTABLE(en) {
     {0x2C09, "en_TT"},
     {0x0409, "en_US"},
     {0x007f, "en_US_POSIX"}, /* duplicate for round-tripping */
-    {0x2409, "en_VI"},  /* Virgin Islands AKA Caribbean Islands (en_CB). On Windows8+ This is 0x1000 or dynamically assigned */
+    {0x2409, "en_029"},
     {0x1c09, "en_ZA"},
     {0x3009, "en_ZW"},
-    {0x2409, "en_029"},
+    {0x2409, "en_VI"},  /* Virgin Islands AKA Caribbean Islands (en_CB). On Windows8+ This is 0x1000 or dynamically assigned */
     {0x0409, "en_AS"},  /* Alias for en_US. Leave last.  On Windows8+ This is 0x1000 or dynamically assigned */
     {0x0409, "en_GU"},  /* Alias for en_US. Leave last.  On Windows8+ This is 0x1000 or dynamically assigned */
     {0x0409, "en_MH"},  /* Alias for en_US. Leave last.  On Windows8+ This is 0x1000 or dynamically assigned */
@@ -419,7 +428,12 @@ ILCID_POSIX_SUBTABLE(hsb) {
 
 ILCID_POSIX_ELEMENT_ARRAY(0x040e, hu, hu_HU)
 ILCID_POSIX_ELEMENT_ARRAY(0x042b, hy, hy_AM)
-ILCID_POSIX_ELEMENT_ARRAY(0x0469, ibb, ibb_NG)
+
+ILCID_POSIX_SUBTABLE(ibb) {
+    {0x69, "ibb"},
+    {0x0469, "ibb_NG"}
+};
+
 ILCID_POSIX_ELEMENT_ARRAY(0x0421, id, id_ID)
 ILCID_POSIX_ELEMENT_ARRAY(0x0470, ig, ig_NG)
 ILCID_POSIX_ELEMENT_ARRAY(0x0478, ii, ii_CN)
@@ -458,13 +472,18 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0471, kr,  kr_NG)
 
 ILCID_POSIX_SUBTABLE(ks) {         /* We could add PK and CN too */
     {0x60,   "ks"},
-    {0x0860, "ks_IN"},              /* Documentation doesn't mention script */
     {0x0460, "ks_Arab_IN"},
     {0x0860, "ks_Deva_IN"}
 };
 
 ILCID_POSIX_ELEMENT_ARRAY(0x0440, ky, ky_KG)   /* Kyrgyz is spoken in Kyrgyzstan */
-ILCID_POSIX_ELEMENT_ARRAY(0x0476, la, la_IT)   /* TODO: Verify the country */
+
+ILCID_POSIX_SUBTABLE(la) {
+    {0x76,   "la"},
+    {0x0476, "la_001"},
+    {0x0476, "la_IT"}       /*Left in for compatibility*/
+};
+
 ILCID_POSIX_ELEMENT_ARRAY(0x046e, lb, lb_LU)
 ILCID_POSIX_ELEMENT_ARRAY(0x0454, lo, lo_LA)
 ILCID_POSIX_ELEMENT_ARRAY(0x0427, lt, lt_LT)
@@ -535,15 +554,19 @@ ILCID_POSIX_SUBTABLE(or_IN) {
     {0x0448, "or_IN"},
 };
 
-
 ILCID_POSIX_SUBTABLE(pa) {
     {0x46,   "pa"},
     {0x0446, "pa_IN"},
-    {0x0846, "pa_PK"},
-    {0x0846, "pa_Arab_PK"}
+    {0x0846, "pa_Arab_PK"},
+    {0x0846, "pa_PK"}
+};
+
+ILCID_POSIX_SUBTABLE(pap) {
+    {0x79, "pap"},
+    {0x0479, "pap_029"},
+    {0x0479, "pap_AN"}     /*Left in for compatibility*/
 };
 
-ILCID_POSIX_ELEMENT_ARRAY(0x0479, pap, pap_AN)
 ILCID_POSIX_ELEMENT_ARRAY(0x0415, pl, pl_PL)
 ILCID_POSIX_ELEMENT_ARRAY(0x0463, ps, ps_AF)
 
@@ -619,9 +642,11 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0485, sah,sah_RU)
 
 ILCID_POSIX_SUBTABLE(sd) {
     {0x59,   "sd"},
-    {0x0459, "sd_IN"},
     {0x0459, "sd_Deva_IN"},
-    {0x0859, "sd_PK"}
+    {0x0459, "sd_IN"},
+    {0x0859, "sd_Arab_PK"},
+    {0x0859, "sd_PK"},
+    {0x7c59, "sd_Arab"}
 };
 
 ILCID_POSIX_SUBTABLE(se) {
@@ -645,9 +670,8 @@ ILCID_POSIX_ELEMENT_ARRAY(0x045b, si, si_LK)
 ILCID_POSIX_ELEMENT_ARRAY(0x041b, sk, sk_SK)
 ILCID_POSIX_ELEMENT_ARRAY(0x0424, sl, sl_SI)
 
-ILCID_POSIX_SUBTABLE(so) { /* TODO: Verify the country */
+ILCID_POSIX_SUBTABLE(so) {
     {0x77,   "so"},
-    {0x0477, "so_ET"},
     {0x0477, "so_SO"}
 };
 
@@ -739,7 +763,12 @@ ILCID_POSIX_SUBTABLE(ve) { /* TODO: Verify the country */
 ILCID_POSIX_ELEMENT_ARRAY(0x042a, vi, vi_VN)
 ILCID_POSIX_ELEMENT_ARRAY(0x0488, wo, wo_SN)
 ILCID_POSIX_ELEMENT_ARRAY(0x0434, xh, xh_ZA)
-ILCID_POSIX_ELEMENT_ARRAY(0x043d, yi, yi)
+
+ILCID_POSIX_SUBTABLE(yi) {
+    {0x003d, "yi"},
+    {0x043d, "yi_001"}
+};
+
 ILCID_POSIX_ELEMENT_ARRAY(0x046a, yo, yo_NG)
 
 // Windows & ICU tend to different names for some of these
index b8d2ee0589dc60bef68689879162dc892ebf7a28..94e6439758ef247085f22c76cbd6d831a10ad0ee 100644 (file)
@@ -28,6 +28,10 @@ else
 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
 endif
 
+## ICU requires a minimum target of Windows 7, and MinGW does not set this by default.
+## https://msdn.microsoft.com/en-us/library/aa383745.aspx
+CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
+
 ## Flags for position independent code
 SHAREDLIBCFLAGS = 
 SHAREDLIBCXXFLAGS = 
index 188d2aa7482e2ded434e3032e41ea4bd527dc0d7..6d0c55753298c0463a364eb66e369f87acb63913 100644 (file)
@@ -28,6 +28,10 @@ else
 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
 endif
 
+## ICU requires a minimum target of Windows 7, and MinGW does not set this by default.
+## https://msdn.microsoft.com/en-us/library/aa383745.aspx
+CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
+
 ## Flags for position independent code
 SHAREDLIBCFLAGS = 
 SHAREDLIBCXXFLAGS = 
index 6cbb897555d3c73cc72b04c9bd19273073bc417b..1d8c221cdcbf85026029bf58d31126b89b494bfa 100644 (file)
@@ -160,7 +160,7 @@ u_fopen_u(const UChar   *filename,
         // TODO: test this code path, including wperm.
         wchar_t wperm[40] = {};
         size_t  retVal;
-        mbstowcs_s(&retVal, wperm, perm, _TRUNCATE);
+        mbstowcs_s(&retVal, wperm, UPRV_LENGTHOF(wperm), perm, _TRUNCATE);
         FILE *systemFile = _wfopen((const wchar_t *)filename, wperm);
         if (systemFile) {
             result = finit_owner(systemFile, locale, codepage, TRUE);
index 467ddb7ab7890655ad2e9176a93b0c6f1a8156e0..dea6ebf2475813aa3f25c3df2da9ede688f9759b 100644 (file)
@@ -43,6 +43,8 @@
 #   define NOMCX
 #   include <windows.h>
 
+#include <algorithm>
+
 static const char *getCalendarType(int32_t type)
 {
     switch (type)
index b65ad73dd6240295f5db68b54dfd432c06a6314b..84fc278c129736d3aedb4a8b0367aa02d450df26 100644 (file)
@@ -48,6 +48,8 @@
 #   include <float.h>
 #   include <locale.h>
 
+#include <algorithm>
+
 #define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type))
 #define DELETE_ARRAY(array) uprv_free((void *) (array))
 
index c4e2fbb68a8f81c67fea8e9b61fd1ff8b7ef25ba..0cf7a57ee113d8d7de7015b9a894e9b29b0d8d5c 100644 (file)
@@ -47,6 +47,7 @@
 #include "unicode/uclean.h"
 #include "uoptions.h"
 #include "pkg_genc.h"
+#include "filetools.h"
 
 #define MAX_COLUMN ((uint32_t)(0xFFFFFFFFU))
 
@@ -284,7 +285,7 @@ writeAssemblyCode(const char *filename, const char *destdir, const char *optEntr
     }
 
 #if defined (WINDOWS_WITH_GNUC) && U_PLATFORM != U_PF_CYGWIN
-    /* Need to fix the file seperator character when using MinGW. */
+    /* Need to fix the file separator character when using MinGW. */
     swapFileSepChar(outFilePath, U_FILE_SEP_CHAR, '/');
 #endif