diff options
Diffstat (limited to 'deps/icu-small/source/tools')
79 files changed, 1260 insertions, 188 deletions
diff --git a/deps/icu-small/source/tools/escapesrc/cptbl.h b/deps/icu-small/source/tools/escapesrc/cptbl.h new file mode 100644 index 0000000000..efaa9642e1 --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/cptbl.h @@ -0,0 +1,520 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html +// generated by tblgen. You weren't going to edit it by hand, were you? + +static const char cp1047_8859_1[256] = { + (char)0x00, /* 00 */ + (char)0x01, /* 01 */ + (char)0x02, /* 02 */ + (char)0x03, /* 03 */ + (char)0x9C, /* 04 */ + (char)0x09, /* 05 */ + (char)0x86, /* 06 */ + (char)0x7F, /* 07 */ + (char)0x97, /* 08 */ + (char)0x8D, /* 09 */ + (char)0x8E, /* 0A */ + (char)0x0B, /* 0B */ + (char)0x0C, /* 0C */ + (char)0x0D, /* 0D */ + (char)0x0E, /* 0E */ + (char)0x0F, /* 0F */ + (char)0x10, /* 10 */ + (char)0x11, /* 11 */ + (char)0x12, /* 12 */ + (char)0x13, /* 13 */ + (char)0x9D, /* 14 */ + (char)0x85, /* 15 */ + (char)0x08, /* 16 */ + (char)0x87, /* 17 */ + (char)0x18, /* 18 */ + (char)0x19, /* 19 */ + (char)0x92, /* 1A */ + (char)0x8F, /* 1B */ + (char)0x1C, /* 1C */ + (char)0x1D, /* 1D */ + (char)0x1E, /* 1E */ + (char)0x1F, /* 1F */ + (char)0x80, /* 20 */ + (char)0x81, /* 21 */ + (char)0x82, /* 22 */ + (char)0x83, /* 23 */ + (char)0x84, /* 24 */ + (char)0x0A, /* 25 */ + (char)0x17, /* 26 */ + (char)0x1B, /* 27 */ + (char)0x88, /* 28 */ + (char)0x89, /* 29 */ + (char)0x8A, /* 2A */ + (char)0x8B, /* 2B */ + (char)0x8C, /* 2C */ + (char)0x05, /* 2D */ + (char)0x06, /* 2E */ + (char)0x07, /* 2F */ + (char)0x90, /* 30 */ + (char)0x91, /* 31 */ + (char)0x16, /* 32 */ + (char)0x93, /* 33 */ + (char)0x94, /* 34 */ + (char)0x95, /* 35 */ + (char)0x96, /* 36 */ + (char)0x04, /* 37 */ + (char)0x98, /* 38 */ + (char)0x99, /* 39 */ + (char)0x9A, /* 3A */ + (char)0x9B, /* 3B */ + (char)0x14, /* 3C */ + (char)0x15, /* 3D */ + (char)0x9E, /* 3E */ + (char)0x1A, /* 3F */ + (char)0x20, /* 40 */ + (char)0xA0, /* 41 */ + (char)0xE2, /* 42 */ + (char)0xE4, /* 43 */ + (char)0xE0, /* 44 */ + (char)0xE1, /* 45 */ + (char)0xE3, /* 46 */ + (char)0xE5, /* 47 */ + (char)0xE7, /* 48 */ + (char)0xF1, /* 49 */ + (char)0xA2, /* 4A */ + (char)0x2E, /* 4B */ + (char)0x3C, /* 4C */ + (char)0x28, /* 4D */ + (char)0x2B, /* 4E */ + (char)0x7C, /* 4F */ + (char)0x26, /* 50 */ + (char)0xE9, /* 51 */ + (char)0xEA, /* 52 */ + (char)0xEB, /* 53 */ + (char)0xE8, /* 54 */ + (char)0xED, /* 55 */ + (char)0xEE, /* 56 */ + (char)0xEF, /* 57 */ + (char)0xEC, /* 58 */ + (char)0xDF, /* 59 */ + (char)0x21, /* 5A */ + (char)0x24, /* 5B */ + (char)0x2A, /* 5C */ + (char)0x29, /* 5D */ + (char)0x3B, /* 5E */ + (char)0x5E, /* 5F */ + (char)0x2D, /* 60 */ + (char)0x2F, /* 61 */ + (char)0xC2, /* 62 */ + (char)0xC4, /* 63 */ + (char)0xC0, /* 64 */ + (char)0xC1, /* 65 */ + (char)0xC3, /* 66 */ + (char)0xC5, /* 67 */ + (char)0xC7, /* 68 */ + (char)0xD1, /* 69 */ + (char)0xA6, /* 6A */ + (char)0x2C, /* 6B */ + (char)0x25, /* 6C */ + (char)0x5F, /* 6D */ + (char)0x3E, /* 6E */ + (char)0x3F, /* 6F */ + (char)0xF8, /* 70 */ + (char)0xC9, /* 71 */ + (char)0xCA, /* 72 */ + (char)0xCB, /* 73 */ + (char)0xC8, /* 74 */ + (char)0xCD, /* 75 */ + (char)0xCE, /* 76 */ + (char)0xCF, /* 77 */ + (char)0xCC, /* 78 */ + (char)0x60, /* 79 */ + (char)0x3A, /* 7A */ + (char)0x23, /* 7B */ + (char)0x40, /* 7C */ + (char)0x27, /* 7D */ + (char)0x3D, /* 7E */ + (char)0x22, /* 7F */ + (char)0xD8, /* 80 */ + (char)0x61, /* 81 */ + (char)0x62, /* 82 */ + (char)0x63, /* 83 */ + (char)0x64, /* 84 */ + (char)0x65, /* 85 */ + (char)0x66, /* 86 */ + (char)0x67, /* 87 */ + (char)0x68, /* 88 */ + (char)0x69, /* 89 */ + (char)0xAB, /* 8A */ + (char)0xBB, /* 8B */ + (char)0xF0, /* 8C */ + (char)0xFD, /* 8D */ + (char)0xFE, /* 8E */ + (char)0xB1, /* 8F */ + (char)0xB0, /* 90 */ + (char)0x6A, /* 91 */ + (char)0x6B, /* 92 */ + (char)0x6C, /* 93 */ + (char)0x6D, /* 94 */ + (char)0x6E, /* 95 */ + (char)0x6F, /* 96 */ + (char)0x70, /* 97 */ + (char)0x71, /* 98 */ + (char)0x72, /* 99 */ + (char)0xAA, /* 9A */ + (char)0xBA, /* 9B */ + (char)0xE6, /* 9C */ + (char)0xB8, /* 9D */ + (char)0xC6, /* 9E */ + (char)0xA4, /* 9F */ + (char)0xB5, /* A0 */ + (char)0x7E, /* A1 */ + (char)0x73, /* A2 */ + (char)0x74, /* A3 */ + (char)0x75, /* A4 */ + (char)0x76, /* A5 */ + (char)0x77, /* A6 */ + (char)0x78, /* A7 */ + (char)0x79, /* A8 */ + (char)0x7A, /* A9 */ + (char)0xA1, /* AA */ + (char)0xBF, /* AB */ + (char)0xD0, /* AC */ + (char)0x5B, /* AD */ + (char)0xDE, /* AE */ + (char)0xAE, /* AF */ + (char)0xAC, /* B0 */ + (char)0xA3, /* B1 */ + (char)0xA5, /* B2 */ + (char)0xB7, /* B3 */ + (char)0xA9, /* B4 */ + (char)0xA7, /* B5 */ + (char)0xB6, /* B6 */ + (char)0xBC, /* B7 */ + (char)0xBD, /* B8 */ + (char)0xBE, /* B9 */ + (char)0xDD, /* BA */ + (char)0xA8, /* BB */ + (char)0xAF, /* BC */ + (char)0x5D, /* BD */ + (char)0xB4, /* BE */ + (char)0xD7, /* BF */ + (char)0x7B, /* C0 */ + (char)0x41, /* C1 */ + (char)0x42, /* C2 */ + (char)0x43, /* C3 */ + (char)0x44, /* C4 */ + (char)0x45, /* C5 */ + (char)0x46, /* C6 */ + (char)0x47, /* C7 */ + (char)0x48, /* C8 */ + (char)0x49, /* C9 */ + (char)0xAD, /* CA */ + (char)0xF4, /* CB */ + (char)0xF6, /* CC */ + (char)0xF2, /* CD */ + (char)0xF3, /* CE */ + (char)0xF5, /* CF */ + (char)0x7D, /* D0 */ + (char)0x4A, /* D1 */ + (char)0x4B, /* D2 */ + (char)0x4C, /* D3 */ + (char)0x4D, /* D4 */ + (char)0x4E, /* D5 */ + (char)0x4F, /* D6 */ + (char)0x50, /* D7 */ + (char)0x51, /* D8 */ + (char)0x52, /* D9 */ + (char)0xB9, /* DA */ + (char)0xFB, /* DB */ + (char)0xFC, /* DC */ + (char)0xF9, /* DD */ + (char)0xFA, /* DE */ + (char)0xFF, /* DF */ + (char)0x5C, /* E0 */ + (char)0xF7, /* E1 */ + (char)0x53, /* E2 */ + (char)0x54, /* E3 */ + (char)0x55, /* E4 */ + (char)0x56, /* E5 */ + (char)0x57, /* E6 */ + (char)0x58, /* E7 */ + (char)0x59, /* E8 */ + (char)0x5A, /* E9 */ + (char)0xB2, /* EA */ + (char)0xD4, /* EB */ + (char)0xD6, /* EC */ + (char)0xD2, /* ED */ + (char)0xD3, /* EE */ + (char)0xD5, /* EF */ + (char)0x30, /* F0 */ + (char)0x31, /* F1 */ + (char)0x32, /* F2 */ + (char)0x33, /* F3 */ + (char)0x34, /* F4 */ + (char)0x35, /* F5 */ + (char)0x36, /* F6 */ + (char)0x37, /* F7 */ + (char)0x38, /* F8 */ + (char)0x39, /* F9 */ + (char)0xB3, /* FA */ + (char)0xDB, /* FB */ + (char)0xDC, /* FC */ + (char)0xD9, /* FD */ + (char)0xDA, /* FE */ + (char)0x9F, /* FF */ +}; + +static const bool oldIllegal[256] = { + false, /* U+0000 */ + false, /* U+0001 */ + false, /* U+0002 */ + false, /* U+0003 */ + false, /* U+0004 */ + false, /* U+0005 */ + false, /* U+0006 */ + false, /* U+0007 */ + false, /* U+0008 */ + false, /* U+0009 */ + false, /* U+000A */ + false, /* U+000B */ + false, /* U+000C */ + false, /* U+000D */ + false, /* U+000E */ + false, /* U+000F */ + false, /* U+0010 */ + false, /* U+0011 */ + false, /* U+0012 */ + false, /* U+0013 */ + false, /* U+0014 */ + false, /* U+0015 */ + false, /* U+0016 */ + false, /* U+0017 */ + false, /* U+0018 */ + false, /* U+0019 */ + false, /* U+001A */ + false, /* U+001B */ + false, /* U+001C */ + false, /* U+001D */ + false, /* U+001E */ + false, /* U+001F */ + true, /* U+0020 */ + true, /* U+0021 */ + true, /* U+0022 */ + true, /* U+0023 */ + false, /* U+0024 */ + true, /* U+0025 */ + true, /* U+0026 */ + true, /* U+0027 */ + true, /* U+0028 */ + true, /* U+0029 */ + true, /* U+002A */ + true, /* U+002B */ + true, /* U+002C */ + true, /* U+002D */ + true, /* U+002E */ + true, /* U+002F */ + true, /* U+0030 */ + true, /* U+0031 */ + true, /* U+0032 */ + true, /* U+0033 */ + true, /* U+0034 */ + true, /* U+0035 */ + true, /* U+0036 */ + true, /* U+0037 */ + true, /* U+0038 */ + true, /* U+0039 */ + true, /* U+003A */ + true, /* U+003B */ + true, /* U+003C */ + true, /* U+003D */ + true, /* U+003E */ + true, /* U+003F */ + false, /* U+0040 */ + true, /* U+0041 */ + true, /* U+0042 */ + true, /* U+0043 */ + true, /* U+0044 */ + true, /* U+0045 */ + true, /* U+0046 */ + true, /* U+0047 */ + true, /* U+0048 */ + true, /* U+0049 */ + true, /* U+004A */ + true, /* U+004B */ + true, /* U+004C */ + true, /* U+004D */ + true, /* U+004E */ + true, /* U+004F */ + true, /* U+0050 */ + true, /* U+0051 */ + true, /* U+0052 */ + true, /* U+0053 */ + true, /* U+0054 */ + true, /* U+0055 */ + true, /* U+0056 */ + true, /* U+0057 */ + true, /* U+0058 */ + true, /* U+0059 */ + true, /* U+005A */ + true, /* U+005B */ + false, /* U+005C */ + true, /* U+005D */ + true, /* U+005E */ + true, /* U+005F */ + false, /* U+0060 */ + true, /* U+0061 */ + true, /* U+0062 */ + true, /* U+0063 */ + true, /* U+0064 */ + true, /* U+0065 */ + true, /* U+0066 */ + true, /* U+0067 */ + true, /* U+0068 */ + true, /* U+0069 */ + true, /* U+006A */ + true, /* U+006B */ + true, /* U+006C */ + true, /* U+006D */ + true, /* U+006E */ + true, /* U+006F */ + true, /* U+0070 */ + true, /* U+0071 */ + true, /* U+0072 */ + true, /* U+0073 */ + true, /* U+0074 */ + true, /* U+0075 */ + true, /* U+0076 */ + true, /* U+0077 */ + true, /* U+0078 */ + true, /* U+0079 */ + true, /* U+007A */ + true, /* U+007B */ + true, /* U+007C */ + true, /* U+007D */ + true, /* U+007E */ + false, /* U+007F */ + false, /* U+0080 */ + false, /* U+0081 */ + false, /* U+0082 */ + false, /* U+0083 */ + false, /* U+0084 */ + false, /* U+0085 */ + false, /* U+0086 */ + false, /* U+0087 */ + false, /* U+0088 */ + false, /* U+0089 */ + false, /* U+008A */ + false, /* U+008B */ + false, /* U+008C */ + false, /* U+008D */ + false, /* U+008E */ + false, /* U+008F */ + false, /* U+0090 */ + false, /* U+0091 */ + false, /* U+0092 */ + false, /* U+0093 */ + false, /* U+0094 */ + false, /* U+0095 */ + false, /* U+0096 */ + false, /* U+0097 */ + false, /* U+0098 */ + false, /* U+0099 */ + false, /* U+009A */ + false, /* U+009B */ + false, /* U+009C */ + false, /* U+009D */ + false, /* U+009E */ + false, /* U+009F */ + false, /* U+00A0 */ + false, /* U+00A1 */ + false, /* U+00A2 */ + false, /* U+00A3 */ + false, /* U+00A4 */ + false, /* U+00A5 */ + false, /* U+00A6 */ + false, /* U+00A7 */ + false, /* U+00A8 */ + false, /* U+00A9 */ + false, /* U+00AA */ + false, /* U+00AB */ + false, /* U+00AC */ + false, /* U+00AD */ + false, /* U+00AE */ + false, /* U+00AF */ + false, /* U+00B0 */ + false, /* U+00B1 */ + false, /* U+00B2 */ + false, /* U+00B3 */ + false, /* U+00B4 */ + false, /* U+00B5 */ + false, /* U+00B6 */ + false, /* U+00B7 */ + false, /* U+00B8 */ + false, /* U+00B9 */ + false, /* U+00BA */ + false, /* U+00BB */ + false, /* U+00BC */ + false, /* U+00BD */ + false, /* U+00BE */ + false, /* U+00BF */ + false, /* U+00C0 */ + false, /* U+00C1 */ + false, /* U+00C2 */ + false, /* U+00C3 */ + false, /* U+00C4 */ + false, /* U+00C5 */ + false, /* U+00C6 */ + false, /* U+00C7 */ + false, /* U+00C8 */ + false, /* U+00C9 */ + false, /* U+00CA */ + false, /* U+00CB */ + false, /* U+00CC */ + false, /* U+00CD */ + false, /* U+00CE */ + false, /* U+00CF */ + false, /* U+00D0 */ + false, /* U+00D1 */ + false, /* U+00D2 */ + false, /* U+00D3 */ + false, /* U+00D4 */ + false, /* U+00D5 */ + false, /* U+00D6 */ + false, /* U+00D7 */ + false, /* U+00D8 */ + false, /* U+00D9 */ + false, /* U+00DA */ + false, /* U+00DB */ + false, /* U+00DC */ + false, /* U+00DD */ + false, /* U+00DE */ + false, /* U+00DF */ + false, /* U+00E0 */ + false, /* U+00E1 */ + false, /* U+00E2 */ + false, /* U+00E3 */ + false, /* U+00E4 */ + false, /* U+00E5 */ + false, /* U+00E6 */ + false, /* U+00E7 */ + false, /* U+00E8 */ + false, /* U+00E9 */ + false, /* U+00EA */ + false, /* U+00EB */ + false, /* U+00EC */ + false, /* U+00ED */ + false, /* U+00EE */ + false, /* U+00EF */ + false, /* U+00F0 */ + false, /* U+00F1 */ + false, /* U+00F2 */ + false, /* U+00F3 */ + false, /* U+00F4 */ + false, /* U+00F5 */ + false, /* U+00F6 */ + false, /* U+00F7 */ + false, /* U+00F8 */ + false, /* U+00F9 */ + false, /* U+00FA */ + false, /* U+00FB */ + false, /* U+00FC */ + false, /* U+00FD */ + false, /* U+00FE */ + false, /* U+00FF */ +}; diff --git a/deps/icu-small/source/tools/escapesrc/escapesrc.cpp b/deps/icu-small/source/tools/escapesrc/escapesrc.cpp new file mode 100644 index 0000000000..1127cd4ffb --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/escapesrc.cpp @@ -0,0 +1,409 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include <stdio.h> +#include <string> +#include <stdlib.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <iostream> +#include <fstream> + +// with caution: +#include "unicode/utf8.h" + +static const char + kSPACE = 0x20, + kTAB = 0x09, + kLF = 0x0A, + kCR = 0x0D, + // kHASH = 0x23, + // kSLASH = 0x2f, + kBKSLASH = 0x5C, + // kSTAR = 0x2A, + kL_U = 0x75, + kU_U = 0x55, + kQUOT = 0x27, + kDBLQ = 0x22; + +# include "cptbl.h" + +# define cp1047_to_8859(c) cp1047_8859_1[c] + +std::string prog; + +void usage() { + fprintf(stderr, "%s: usage: %s infile.cpp outfile.cpp\n", prog.c_str(), prog.c_str()); +} + + +int cleanup(const std::string &outfile) { + const char *outstr = outfile.c_str(); + if(outstr && *outstr) { + int rc = unlink(outstr); + if(rc == 0) { + fprintf(stderr, "%s: deleted %s\n", prog.c_str(), outstr); + return 0; + } else { + if( errno == ENOENT ) { + return 0; // File did not exist - no error. + } else { + perror("unlink"); + return 1; + } + } + } + return 0; +} + +// inline bool hasNonAscii(const char *line, size_t len) { +// const unsigned char *uline = reinterpret_cast<const unsigned char*>(line); +// for(size_t i=0;i<len; i++) { +// if( uline[i] > 0x7F) { +// return true; +// } +// } +// return false; +// } + +inline const char *skipws(const char *p, const char *e) { + for(;p<e;p++) { + switch(*p) { + case kSPACE: + case kTAB: + case kLF: + case kCR: + break; + default: + return p; // non ws + } + } + return p; +} + +// inline bool isCommentOrEmpty(const char* line, size_t len) { +// const char *p = line; +// const char *e = line+len; +// p = skipws(p,e); +// if(p==e) { +// return true; // whitespace only +// } +// p++; +// switch(*p) { +// case kHASH: return true; // #directive +// case kSLASH: +// p++; +// if(p==e) return false; // single slash +// switch(*p) { +// case kSLASH: // '/ /' +// case kSTAR: // '/ *' +// return true; // start of comment +// default: return false; // something else +// } +// default: return false; // something else +// } +// /*NOTREACHED*/ +// } + +void appendByte(std::string &outstr, + uint8_t byte) { + char tmp2[5]; + sprintf(tmp2, "\\x%02X", 0xFF & (int)(byte)); + outstr += tmp2; +} + +/** + * @return true on failure + */ +bool appendUtf8(std::string &outstr, + const std::string &linestr, + size_t &pos, + size_t chars) { + char tmp[9]; + for(size_t i=0;i<chars;i++) { + tmp[i] = linestr[++pos]; + } + tmp[chars] = 0; + unsigned int c; + sscanf(tmp, "%X", &c); + UChar32 ch = c & 0x1FFFFF; + + // now to append \\x%% etc + uint8_t bytesNeeded = U8_LENGTH(ch); + if(bytesNeeded == 0) { + fprintf(stderr, "Illegal code point U+%X\n", ch); + return true; + } + uint8_t bytes[4]; + uint8_t *s = bytes; + size_t i = 0; + U8_APPEND_UNSAFE(s, i, ch); + for(size_t t = 0; t<i; t++) { + appendByte(outstr, s[t]); + } + return false; +} + +/** + * @param linestr string to mutate. Already escaped into \u format. + * @param origpos beginning, points to 'u8"' + * @param pos end, points to " + * @return false for no-problem, true for failure! + */ +bool fixu8(std::string &linestr, size_t origpos, size_t &endpos) { + size_t pos = origpos + 3; + std::string outstr; + outstr += '\"'; // local encoding + for(;pos<endpos;pos++) { + char c = linestr[pos]; + if(c == '\\') { + char c2 = linestr[++pos]; + switch(c2) { + case '\'': + case '"': +#if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY) + c2 = cp1047_to_8859(c2); +#endif + appendByte(outstr, c2); + break; + case 'u': + appendUtf8(outstr, linestr, pos, 4); + break; + case 'U': + appendUtf8(outstr, linestr, pos, 8); + break; + } + } else { +#if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY) + c = cp1047_to_8859(c); +#endif + appendByte(outstr, c); + } + } + outstr += ('\"'); + + linestr.replace(origpos, (endpos-origpos+1), outstr); + + return false; // OK +} + +/** + * fix the string at the position + * false = no err + * true = had err + */ +bool fixAt(std::string &linestr, size_t pos) { + size_t origpos = pos; + + if(linestr[pos] != 'u') { + fprintf(stderr, "Not a 'u'?"); + return true; + } + + pos++; // past 'u' + + bool utf8 = false; + + if(linestr[pos] == '8') { // u8" + utf8 = true; + pos++; + } + + char quote = linestr[pos]; + + if(quote != '\'' && quote != '\"') { + fprintf(stderr, "Quote is '%c' - not sure what to do.\n", quote); + return true; + } + + if(quote == '\'' && utf8) { + fprintf(stderr, "Cannot do u8'...'\n"); + return true; + } + + pos ++; + + //printf("u%c…%c\n", quote, quote); + + for(; pos < linestr.size(); pos++) { + if(linestr[pos] == quote) { + if(utf8) { + return fixu8(linestr, origpos, pos); // fix u8"..." + } else { + return false; // end of quote + } + } + if(linestr[pos] == '\\') { + pos++; + if(linestr[pos] == quote) continue; // quoted quote + if(linestr[pos] == 'u') continue; // for now ... unicode escape + if(linestr[pos] == '\\') continue; + // some other escape… ignore + } else { + size_t old_pos = pos; + int32_t i = pos; +#if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY) + // mogrify 1-4 bytes from 1047 'back' to utf-8 + char old_byte = linestr[pos]; + linestr[pos] = cp1047_to_8859(linestr[pos]); + // how many more? + int32_t trail = U8_COUNT_TRAIL_BYTES(linestr[pos]); + for(size_t pos2 = pos+1; trail>0; pos2++,trail--) { + linestr[pos2] = cp1047_to_8859(linestr[pos2]); + if(linestr[pos2] == 0x0A) { + linestr[pos2] = 0x85; // NL is ambiguous here + } + } +#endif + + // Proceed to decode utf-8 + const uint8_t *s = (const uint8_t*) (linestr.c_str()); + int32_t length = linestr.size(); + UChar32 c; + if(U8_IS_SINGLE((uint8_t)s[i]) && oldIllegal[s[i]]) { +#if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY) + linestr[pos] = old_byte; // put it back +#endif + continue; // single code point not previously legal for \u escaping + } + + // otherwise, convert it to \u / \U + { + U8_NEXT(s, i, length, c); + } + if(c<0) { + fprintf(stderr, "Illegal utf-8 sequence at Column: %d\n", old_pos); + fprintf(stderr, "Line: >>%s<<\n", linestr.c_str()); + return true; + } + + size_t seqLen = (i-pos); + + //printf("U+%04X pos %d [len %d]\n", c, pos, seqLen);fflush(stdout); + + char newSeq[20]; + if( c <= 0xFFFF) { + sprintf(newSeq, "\\u%04X", c); + } else { + sprintf(newSeq, "\\U%08X", c); + } + linestr.replace(pos, seqLen, newSeq); + pos += strlen(newSeq) - 1; + } + } + + return false; +} + +/** + * false = no err + * true = had err + */ +bool fixLine(int /*no*/, std::string &linestr) { + const char *line = linestr.c_str(); + size_t len = linestr.size(); + + // no u' in the line? + if(!strstr(line, "u'") && !strstr(line, "u\"") && !strstr(line, "u8\"")) { + return false; // Nothing to do. No u' or u" detected + } + + // lines such as u8"\u0308" are all ASCII. + // // Quick Check: all ascii? + // if(!hasNonAscii(line, len)) { + // return false; // ASCII + // } + + // // comment or empty line? + // if(isCommentOrEmpty(line, len)) { + // return false; // Comment or just empty + // } + + // start from the end and find all u" cases + size_t pos = len = linestr.size(); + while((pos>0) && (pos = linestr.rfind("u\"", pos)) != std::string::npos) { + //printf("found doublequote at %d\n", pos); + if(fixAt(linestr, pos)) return true; + if(pos == 0) break; + pos--; + } + + // reset and find all u' cases + pos = len = linestr.size(); + while((pos>0) && (pos = linestr.rfind("u'", pos)) != std::string::npos) { + //printf("found singlequote at %d\n", pos); + if(fixAt(linestr, pos)) return true; + if(pos == 0) break; + pos--; + } + + // reset and find all u8" cases + pos = len = linestr.size(); + while((pos>0) && (pos = linestr.rfind("u8\"", pos)) != std::string::npos) { + if(fixAt(linestr, pos)) return true; + if(pos == 0) break; + pos--; + } + + //fprintf(stderr, "%d - fixed\n", no); + return false; +} + +int convert(const std::string &infile, const std::string &outfile) { + fprintf(stderr, "escapesrc: %s -> %s\n", infile.c_str(), outfile.c_str()); + + std::ifstream inf; + + inf.open(infile.c_str(), std::ios::in); + + if(!inf.is_open()) { + fprintf(stderr, "%s: could not open input file %s\n", prog.c_str(), infile.c_str()); + cleanup(outfile); + return 1; + } + + std::ofstream outf; + + outf.open(outfile.c_str(), std::ios::out); + + if(!outf.is_open()) { + fprintf(stderr, "%s: could not open output file %s\n", prog.c_str(), outfile.c_str()); + return 1; + } + + // TODO: any platform variations of #line? + outf << "#line 1 \"" << infile << "\"" << '\n'; + + int no = 0; + std::string linestr; + while( getline( inf, linestr)) { + no++; + if(fixLine(no, linestr)) { + outf.close(); + fprintf(stderr, "%s:%d: Fixup failed by %s\n", infile.c_str(), no, prog.c_str()); + cleanup(outfile); + return 1; + } + outf << linestr << '\n'; + } + + return 0; +} + +int main(int argc, const char *argv[]) { + prog = argv[0]; + + if(argc != 3) { + usage(); + return 1; + } + + std::string infile = argv[1]; + std::string outfile = argv[2]; + + return convert(infile, outfile); +} + + +#include "utf_impl.cpp" diff --git a/deps/icu-small/source/tools/escapesrc/expect-simple.cpp b/deps/icu-small/source/tools/escapesrc/expect-simple.cpp new file mode 100644 index 0000000000..a6019a8d40 --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/expect-simple.cpp @@ -0,0 +1,17 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +u"sa\u0127\u0127a"; +u'\u6587'; +u"\U000219F2"; +u"\u039C\u03C5\u03C3\u03C4\u03AE\u03C1\u03B9\u03BF"; + + u"sa\u0127\u0127a"; + u'\u6587'; u"\U000219F2"; + +"\x20\xCC\x81"; +"\xCC\x88\x20"; +"\x73\x61\xC4\xA7\xC4\xA7\x61"; +"\xE6\x96\x87"; +"\xF0\xA1\xA7\xB2"; +"\x73\x61\xC4\xA7\xC4\xA7\x61"; diff --git a/deps/icu-small/source/tools/escapesrc/tblgen.cpp b/deps/icu-small/source/tools/escapesrc/tblgen.cpp new file mode 100644 index 0000000000..9bf59a9db9 --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/tblgen.cpp @@ -0,0 +1,80 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" +#include "unicode/ucnv.h" +#include "unicode/uniset.h" +#include <stdio.h> + +static const char *kConverter = "ibm-1047"; + +int main(int argc, const char *argv[]) { + printf("// %s\n", U_COPYRIGHT_STRING); + printf("// generated by tblgen. You weren't going to edit it by hand, were you?\n"); + printf("\n"); + + UErrorCode status = U_ZERO_ERROR; + LocalUConverterPointer cnv(ucnv_open(kConverter, &status)); + + if(U_FAILURE(status)) { + fprintf(stderr, "Failed to open %s: %s\n", kConverter, u_errorName(status)); + return 1; + } + + printf("static const char cp1047_8859_1[256] = { \n"); + for(int i=0x00; i<0x100; i++) { + char cp1047[1]; + cp1047[0] = i; + UChar u[1]; + UChar *target = u; + const char *source = cp1047; + ucnv_toUnicode(cnv.getAlias(), &target, u+1, &source, cp1047+1, nullptr, true, &status); + if(U_FAILURE(status)) { + fprintf(stderr, "Conversion failure at #%X: %s\n", i, u_errorName(status)); + return 2; + } + printf(" (char)0x%02X, /* %02X */\n", u[0], i); + } + printf("};\n\n"); + + // + // UnicodeSet oldIllegal("[:print:]", status); // [a-zA-Z0-9_}{#)(><%:;.?*+-/^&|~!=,\\u005b\\u005d\\u005c]", status); + UnicodeSet oldIllegal("[0-9 a-z A-Z " + "_ \\{ \\} \\[ \\] # \\( \\) < > % \\: ; . " + "? * + \\- / \\^ \\& | ~ ! = , \\ \" ' ]", status); + + /* + +http://www.lirmm.fr/~ducour/Doc-objets/ISO+IEC+14882-1998.pdf ( note: 1998 ) page 10, section 2.2 says: + +1 The basic source character set consists of 96 characters: the space character, the control characters repre- 15) +senting horizontal tab, vertical tab, form feed, and new-line, plus the following 91 graphical characters: +a b c d e f g h i j k l m n opqrstuvwxyz +A B C D E F G H I J K L M N OPQRSTUVWXYZ +0 12 3 4 5 6 7 8 9 + _ { } [ ] # ( ) < > % : ; . ?*+-/^&|~!=,\" +2 The universal-character-name construct provides a way to name other characters. hex-quad: +hexadecimal-digit hexadecimal-digit hexadecimal-digit hexadecimal-digit +universal-character-name: \u hex-quad +\U hex-quad hex-quad +The character designated by the universal-character-name \UNNNNNNNN is that character whose character short name in ISO/IEC 10646 is NNNNNNNN; the character designated by the universal-character-name \uNNNN is that character whose character short name in ISO/IEC 10646 is 0000NNNN. If the hexadecimal value for a universal character name is less than 0x20 or in the range 0x7F-0x9F (inclusive), or if the uni- versal character name designates a character in the basic source character set, then the program is ill- formed. + + +So basically: printable ASCII plus 0x00-0x1F, 0x7F-0x9F, was all illegal. + +Some discussion at http://unicode.org/mail-arch/unicode-ml/y2003-m10/0471.html + + */ + + + + printf("static const bool oldIllegal[256] = { \n"); + for(UChar i=0x00; i<0x100;i++) { + printf(" %s, /* U+%04X */\n", + (oldIllegal.contains(i))?" true":"false", + i); + } + printf("};\n\n"); + + return 0; +} diff --git a/deps/icu-small/source/tools/escapesrc/test-nochange.cpp b/deps/icu-small/source/tools/escapesrc/test-nochange.cpp new file mode 100644 index 0000000000..8c0d04b809 --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/test-nochange.cpp @@ -0,0 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// This is a source file with no changes needed in it. +// In fact, the only non-ASCII character is the comment line at top. diff --git a/deps/icu-small/source/tools/escapesrc/test-simple.cpp b/deps/icu-small/source/tools/escapesrc/test-simple.cpp new file mode 100644 index 0000000000..b03f28f706 --- /dev/null +++ b/deps/icu-small/source/tools/escapesrc/test-simple.cpp @@ -0,0 +1,17 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +u"saħħa"; +u'文'; +u"𡧲"; +u"Μυστήριο"; + + u"saħħa"; + u'文'; u"𡧲"; + +u8" \u0301"; +u8"\u0308 "; +u8"saħħa"; +u8"文"; +u8"𡧲"; +u8"saħ\u0127a"; diff --git a/deps/icu-small/source/tools/genccode/genccode.c b/deps/icu-small/source/tools/genccode/genccode.c index 2534820bac..d35b589010 100644 --- a/deps/icu-small/source/tools/genccode/genccode.c +++ b/deps/icu-small/source/tools/genccode/genccode.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: gennames.c - * encoding: US-ASCII + * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/gencmn/gencmn.c b/deps/icu-small/source/tools/gencmn/gencmn.c index d328a30521..77f0c20c61 100644 --- a/deps/icu-small/source/tools/gencmn/gencmn.c +++ b/deps/icu-small/source/tools/gencmn/gencmn.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: gencmn.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/genrb/derb.cpp b/deps/icu-small/source/tools/genrb/derb.cpp index 22e275ef35..ac26d95be4 100644 --- a/deps/icu-small/source/tools/genrb/derb.cpp +++ b/deps/icu-small/source/tools/genrb/derb.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: derb.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/genrb/errmsg.c b/deps/icu-small/source/tools/genrb/errmsg.c index 7340f01af2..603f26a174 100644 --- a/deps/icu-small/source/tools/genrb/errmsg.c +++ b/deps/icu-small/source/tools/genrb/errmsg.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/errmsg.h b/deps/icu-small/source/tools/genrb/errmsg.h index 5026ecf7be..e01b9558f0 100644 --- a/deps/icu-small/source/tools/genrb/errmsg.h +++ b/deps/icu-small/source/tools/genrb/errmsg.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/genrb.cpp b/deps/icu-small/source/tools/genrb/genrb.cpp index 685fb5884e..68870bd90a 100644 --- a/deps/icu-small/source/tools/genrb/genrb.cpp +++ b/deps/icu-small/source/tools/genrb/genrb.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/genrb.h b/deps/icu-small/source/tools/genrb/genrb.h index 99c604f780..019020a34a 100644 --- a/deps/icu-small/source/tools/genrb/genrb.h +++ b/deps/icu-small/source/tools/genrb/genrb.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/parse.cpp b/deps/icu-small/source/tools/genrb/parse.cpp index f448daab6c..88b08c21d0 100644 --- a/deps/icu-small/source/tools/genrb/parse.cpp +++ b/deps/icu-small/source/tools/genrb/parse.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/parse.h b/deps/icu-small/source/tools/genrb/parse.h index d7341be6dd..dfe3b8dda0 100644 --- a/deps/icu-small/source/tools/genrb/parse.h +++ b/deps/icu-small/source/tools/genrb/parse.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/prscmnts.cpp b/deps/icu-small/source/tools/genrb/prscmnts.cpp index edae16c5c5..5d494cd9ad 100644 --- a/deps/icu-small/source/tools/genrb/prscmnts.cpp +++ b/deps/icu-small/source/tools/genrb/prscmnts.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/prscmnts.h b/deps/icu-small/source/tools/genrb/prscmnts.h index c9958cd071..82cf0deaa1 100644 --- a/deps/icu-small/source/tools/genrb/prscmnts.h +++ b/deps/icu-small/source/tools/genrb/prscmnts.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/rbutil.c b/deps/icu-small/source/tools/genrb/rbutil.c index 174b4d7b44..808d35bb1b 100644 --- a/deps/icu-small/source/tools/genrb/rbutil.c +++ b/deps/icu-small/source/tools/genrb/rbutil.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/rbutil.h b/deps/icu-small/source/tools/genrb/rbutil.h index d2a303516a..9a12c50959 100644 --- a/deps/icu-small/source/tools/genrb/rbutil.h +++ b/deps/icu-small/source/tools/genrb/rbutil.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/read.c b/deps/icu-small/source/tools/genrb/read.c index 313fb61677..c20b4510a2 100644 --- a/deps/icu-small/source/tools/genrb/read.c +++ b/deps/icu-small/source/tools/genrb/read.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/read.h b/deps/icu-small/source/tools/genrb/read.h index 74b8c823a2..e5b8d155da 100644 --- a/deps/icu-small/source/tools/genrb/read.h +++ b/deps/icu-small/source/tools/genrb/read.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/reslist.cpp b/deps/icu-small/source/tools/genrb/reslist.cpp index 9420184a9d..2e04bbce21 100644 --- a/deps/icu-small/source/tools/genrb/reslist.cpp +++ b/deps/icu-small/source/tools/genrb/reslist.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -271,7 +271,7 @@ StringBaseResource::StringBaseResource(SRBRoot *bundle, const char *tag, int8_t return; } - fString.setTo(value, len); + fString.setTo(ConstChar16Ptr(value), len); fString.getTerminatedBuffer(); // Some code relies on NUL-termination. if (U_SUCCESS(errorCode) && fString.isBogus()) { errorCode = U_MEMORY_ALLOCATION_ERROR; @@ -1031,7 +1031,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg, if (f16BitUnits.length() <= 1) { // no pool strings to checksum } else if (U_IS_BIG_ENDIAN) { - checksum = computeCRC((const char *)f16BitUnits.getBuffer(), + checksum = computeCRC(reinterpret_cast<const char *>(f16BitUnits.getBuffer()), (uint32_t)f16BitUnits.length() * 2, checksum); } else { // Swap to big-endian so we get the same checksum on all platforms @@ -1039,7 +1039,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg, UnicodeString s(f16BitUnits); s.append((UChar)1); // Ensure that we own this buffer. assert(!s.isBogus()); - uint16_t *p = (uint16_t *)s.getBuffer(); + uint16_t *p = const_cast<uint16_t *>(reinterpret_cast<const uint16_t *>(s.getBuffer())); for (int32_t count = f16BitUnits.length(); count > 0; --count) { uint16_t x = *p; *p++ = (uint16_t)((x << 8) | (x >> 8)); diff --git a/deps/icu-small/source/tools/genrb/reslist.h b/deps/icu-small/source/tools/genrb/reslist.h index 614be2d10f..53ade5b82c 100644 --- a/deps/icu-small/source/tools/genrb/reslist.h +++ b/deps/icu-small/source/tools/genrb/reslist.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -304,7 +304,7 @@ public: StringBaseResource(int8_t type, const UChar *value, int32_t len, UErrorCode &errorCode); virtual ~StringBaseResource(); - const UChar *getBuffer() const { return fString.getBuffer(); } + const UChar *getBuffer() const { return icu::toUCharPtr(fString.getBuffer()); } int32_t length() const { return fString.length(); } virtual void handlePreWrite(uint32_t *byteOffset); diff --git a/deps/icu-small/source/tools/genrb/rle.c b/deps/icu-small/source/tools/genrb/rle.c index 4a69cd5298..08495c2b4f 100644 --- a/deps/icu-small/source/tools/genrb/rle.c +++ b/deps/icu-small/source/tools/genrb/rle.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/rle.h b/deps/icu-small/source/tools/genrb/rle.h index 93d51a3750..9f580733d5 100644 --- a/deps/icu-small/source/tools/genrb/rle.h +++ b/deps/icu-small/source/tools/genrb/rle.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/ustr.c b/deps/icu-small/source/tools/genrb/ustr.c index 1631a205ff..f1436ae8ae 100644 --- a/deps/icu-small/source/tools/genrb/ustr.c +++ b/deps/icu-small/source/tools/genrb/ustr.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/ustr.h b/deps/icu-small/source/tools/genrb/ustr.h index c27a78104f..91483d1f0f 100644 --- a/deps/icu-small/source/tools/genrb/ustr.h +++ b/deps/icu-small/source/tools/genrb/ustr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/wrtjava.cpp b/deps/icu-small/source/tools/genrb/wrtjava.cpp index 329753717b..a0d72f72d8 100644 --- a/deps/icu-small/source/tools/genrb/wrtjava.cpp +++ b/deps/icu-small/source/tools/genrb/wrtjava.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/genrb/wrtxml.cpp b/deps/icu-small/source/tools/genrb/wrtxml.cpp index 62fdd2427c..2bfcfebf9e 100644 --- a/deps/icu-small/source/tools/genrb/wrtxml.cpp +++ b/deps/icu-small/source/tools/genrb/wrtxml.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -73,7 +73,7 @@ static int32_t write_utf8_file(FileStream* fileStream, UnicodeString outString) u_strToUTF8(NULL, 0, &len, - outString.getBuffer(), + toUCharPtr(outString.getBuffer()), outString.length(), &status); @@ -85,7 +85,7 @@ static int32_t write_utf8_file(FileStream* fileStream, UnicodeString outString) u_strToUTF8(dest, len, &len, - outString.getBuffer(), + toUCharPtr(outString.getBuffer()), outString.length(), &status); diff --git a/deps/icu-small/source/tools/icupkg/icupkg.cpp b/deps/icu-small/source/tools/icupkg/icupkg.cpp index 2023930441..ea7be4a909 100644 --- a/deps/icu-small/source/tools/icupkg/icupkg.cpp +++ b/deps/icu-small/source/tools/icupkg/icupkg.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: icupkg.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/pkgdata/pkgdata.cpp b/deps/icu-small/source/tools/pkgdata/pkgdata.cpp index bf93318602..d4dc271732 100644 --- a/deps/icu-small/source/tools/pkgdata/pkgdata.cpp +++ b/deps/icu-small/source/tools/pkgdata/pkgdata.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2000-2016, International Business Machines @@ -26,7 +26,7 @@ #include "putilimp.h" #if U_HAVE_POPEN -#if (U_PF_MINGW <= U_PLATFORM || U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) +#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) /* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */ #undef __STRICT_ANSI__ #endif @@ -121,7 +121,9 @@ enum { LIBNAME, QUIET, WITHOUT_ASSEMBLY, - PDS_BUILD + PDS_BUILD, + UWP_BUILD, + UWP_ARM_BUILD }; /* This sets the modes that are available */ @@ -163,7 +165,9 @@ static UOption options[]={ /*18*/ UOPTION_DEF( "libname", 'L', UOPT_REQUIRES_ARG), /*19*/ UOPTION_DEF( "quiet", 'q', UOPT_NO_ARG), /*20*/ UOPTION_DEF( "without-assembly", 'w', UOPT_NO_ARG), - /*21*/ UOPTION_DEF( "zos-pds-build", 'z', UOPT_NO_ARG) + /*21*/ UOPTION_DEF("zos-pds-build", 'z', UOPT_NO_ARG), + /*22*/ UOPTION_DEF("windows-uwp-build", 'u', UOPT_NO_ARG), + /*23*/ UOPTION_DEF("windows-uwp-arm-build", 'a', UOPT_NO_ARG) }; /* This enum and the following char array should be kept in sync. */ @@ -250,9 +254,11 @@ const char options_help[][320]={ "Specify a version when packaging in dll or static mode", "Add package to all file names if not present", "Library name to build (if different than package name)", - "Quite mode. (e.g. Do not output a readme file for static libraries)", + "Quiet mode. (e.g. Do not output a readme file for static libraries)", "Build the data without assembly code", - "Build PDS dataset (zOS build only)" + "Build PDS dataset (zOS build only)", + "Build for Universal Windows Platform (Windows build only)", + "Set DLL machine type for UWP to target windows ARM (Windows UWP build only)" }; const char *progname = "PKGDATA"; @@ -1751,7 +1757,14 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD #ifdef WINDOWS_WITH_MSVC #define LINK_CMD "link.exe /nologo /release /out:" -#define LINK_FLAGS "/DLL /NOENTRY /MANIFEST:NO /base:0x4ad00000 /implib:" +#define LINK_FLAGS "/DLL /NOENTRY /MANIFEST:NO /implib:" +#ifdef _WIN64 +#define LINK_EXTRA_UWP_FLAGS "/NXCOMPAT /DYNAMICBASE /APPCONTAINER " +#else +#define LINK_EXTRA_UWP_FLAGS "/NXCOMPAT /SAFESEH /DYNAMICBASE /APPCONTAINER /MACHINE:X86" +#endif +#define LINK_EXTRA_UWP_FLAGS_ARM "/NXCOMPAT /DYNAMICBASE /APPCONTAINER /MACHINE:ARM" +#define LINK_EXTRA_NO_UWP_FLAGS "/base:0x4ad00000 " #define LIB_CMD "LIB.exe /nologo /out:" #define LIB_FILE "icudt.lib" #define LIB_EXT UDATA_LIB_SUFFIX @@ -1831,14 +1844,33 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U return 0; } - sprintf(cmd, "%s\"%s\" %s\"%s\" \"%s\" %s", - LINK_CMD, - dllFilePath, - LINK_FLAGS, - libFilePath, - gencFilePath, - resFilePath - ); + char *extraFlags = ""; +#ifdef WINDOWS_WITH_MSVC + if (options[UWP_BUILD].doesOccur) + { + if (options[UWP_ARM_BUILD].doesOccur) + { + extraFlags = LINK_EXTRA_UWP_FLAGS_ARM; + } + else + { + extraFlags = LINK_EXTRA_UWP_FLAGS; + } + } + else + { + extraFlags = LINK_EXTRA_NO_UWP_FLAGS; + } +#endif + sprintf(cmd, "%s\"%s\" %s %s\"%s\" \"%s\" %s", + LINK_CMD, + dllFilePath, + extraFlags, + LINK_FLAGS, + libFilePath, + gencFilePath, + resFilePath + ); } result = runCommand(cmd, TRUE); diff --git a/deps/icu-small/source/tools/pkgdata/pkgtypes.c b/deps/icu-small/source/tools/pkgdata/pkgtypes.c index eadf634db3..43ee3dfb5e 100644 --- a/deps/icu-small/source/tools/pkgdata/pkgtypes.c +++ b/deps/icu-small/source/tools/pkgdata/pkgtypes.c @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /************************************************************************** * diff --git a/deps/icu-small/source/tools/pkgdata/pkgtypes.h b/deps/icu-small/source/tools/pkgdata/pkgtypes.h index c7eeba42cb..3297d0a2da 100644 --- a/deps/icu-small/source/tools/pkgdata/pkgtypes.h +++ b/deps/icu-small/source/tools/pkgdata/pkgtypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /************************************************************************** * diff --git a/deps/icu-small/source/tools/toolutil/collationinfo.cpp b/deps/icu-small/source/tools/toolutil/collationinfo.cpp index bbb1839ef1..6bad90e133 100644 --- a/deps/icu-small/source/tools/toolutil/collationinfo.cpp +++ b/deps/icu-small/source/tools/toolutil/collationinfo.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/toolutil/collationinfo.h b/deps/icu-small/source/tools/toolutil/collationinfo.h index 48cd556184..815b89d40d 100644 --- a/deps/icu-small/source/tools/toolutil/collationinfo.h +++ b/deps/icu-small/source/tools/toolutil/collationinfo.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/toolutil/dbgutil.cpp b/deps/icu-small/source/tools/toolutil/dbgutil.cpp index 345715163b..29bab92753 100644 --- a/deps/icu-small/source/tools/toolutil/dbgutil.cpp +++ b/deps/icu-small/source/tools/toolutil/dbgutil.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: @@ -117,7 +117,7 @@ U_CAPI int32_t udbg_stoi(const UnicodeString &s) { char ch[256]; - const UChar *u = s.getBuffer(); + const UChar *u = toUCharPtr(s.getBuffer()); int32_t len = s.length(); u_UCharsToChars(u, ch, len); ch[len] = 0; /* include terminating \0 */ @@ -129,7 +129,7 @@ U_CAPI double udbg_stod(const UnicodeString &s) { char ch[256]; - const UChar *u = s.getBuffer(); + const UChar *u = toUCharPtr(s.getBuffer()); int32_t len = s.length(); u_UCharsToChars(u, ch, len); ch[len] = 0; /* include terminating \0 */ diff --git a/deps/icu-small/source/tools/toolutil/dbgutil.h b/deps/icu-small/source/tools/toolutil/dbgutil.h index 704090cc21..314a9ae885 100644 --- a/deps/icu-small/source/tools/toolutil/dbgutil.h +++ b/deps/icu-small/source/tools/toolutil/dbgutil.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* diff --git a/deps/icu-small/source/tools/toolutil/denseranges.cpp b/deps/icu-small/source/tools/toolutil/denseranges.cpp index 3b83715f28..f5e52b1bbb 100644 --- a/deps/icu-small/source/tools/toolutil/denseranges.cpp +++ b/deps/icu-small/source/tools/toolutil/denseranges.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: denseranges.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/denseranges.h b/deps/icu-small/source/tools/toolutil/denseranges.h index 7b072f4654..c489ca47d8 100644 --- a/deps/icu-small/source/tools/toolutil/denseranges.h +++ b/deps/icu-small/source/tools/toolutil/denseranges.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: denseranges.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/filestrm.c b/deps/icu-small/source/tools/toolutil/filestrm.cpp index 446125de6b..cfffa1b75d 100644 --- a/deps/icu-small/source/tools/toolutil/filestrm.c +++ b/deps/icu-small/source/tools/toolutil/filestrm.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** diff --git a/deps/icu-small/source/tools/toolutil/filestrm.h b/deps/icu-small/source/tools/toolutil/filestrm.h index b423451406..86fac3063f 100644 --- a/deps/icu-small/source/tools/toolutil/filestrm.h +++ b/deps/icu-small/source/tools/toolutil/filestrm.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** diff --git a/deps/icu-small/source/tools/toolutil/filetools.cpp b/deps/icu-small/source/tools/toolutil/filetools.cpp index b0d4ed81a5..176a791b0d 100644 --- a/deps/icu-small/source/tools/toolutil/filetools.cpp +++ b/deps/icu-small/source/tools/toolutil/filetools.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2009-2013, International Business Machines diff --git a/deps/icu-small/source/tools/toolutil/filetools.h b/deps/icu-small/source/tools/toolutil/filetools.h index 5ede02761a..6a25c3601c 100644 --- a/deps/icu-small/source/tools/toolutil/filetools.h +++ b/deps/icu-small/source/tools/toolutil/filetools.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: filetools.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/flagparser.c b/deps/icu-small/source/tools/toolutil/flagparser.cpp index c87beb147c..c8d791c636 100644 --- a/deps/icu-small/source/tools/toolutil/flagparser.c +++ b/deps/icu-small/source/tools/toolutil/flagparser.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2009-2015, International Business Machines @@ -35,8 +35,8 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, goto parseFlagsFile_cleanup; } - buffer = uprv_malloc(sizeof(char) * currentBufferSize); - tmpFlagBuffer = uprv_malloc(sizeof(char) * flagBufferSize); + buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize); + tmpFlagBuffer = (char *)uprv_malloc(sizeof(char) * flagBufferSize); if (buffer == NULL || tmpFlagBuffer == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; @@ -48,7 +48,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, allocateMoreSpace = FALSE; currentBufferSize *= 2; uprv_free(buffer); - buffer = uprv_malloc(sizeof(char) * currentBufferSize); + buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize); if (buffer == NULL) { *status = U_MEMORY_ALLOCATION_ERROR; goto parseFlagsFile_cleanup; diff --git a/deps/icu-small/source/tools/toolutil/flagparser.h b/deps/icu-small/source/tools/toolutil/flagparser.h index 4aa03c8a5f..aa42547164 100644 --- a/deps/icu-small/source/tools/toolutil/flagparser.h +++ b/deps/icu-small/source/tools/toolutil/flagparser.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: flagparser.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/package.cpp b/deps/icu-small/source/tools/toolutil/package.cpp index d069147708..e3354b3524 100644 --- a/deps/icu-small/source/tools/toolutil/package.cpp +++ b/deps/icu-small/source/tools/toolutil/package.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: package.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -1290,7 +1290,7 @@ void Package::setItemCapacity(int32_t max) Item *oldItems = items; if(newItems == NULL) { fprintf(stderr, "icupkg: Out of memory trying to allocate %lu bytes for %d items\n", - (unsigned long)max*sizeof(items[0]), max); + (unsigned long)(max*sizeof(items[0])), max); exit(U_MEMORY_ALLOCATION_ERROR); } if(items && itemCount>0) { diff --git a/deps/icu-small/source/tools/toolutil/package.h b/deps/icu-small/source/tools/toolutil/package.h index 4d60202999..3263c84feb 100644 --- a/deps/icu-small/source/tools/toolutil/package.h +++ b/deps/icu-small/source/tools/toolutil/package.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: package.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/pkg_genc.c b/deps/icu-small/source/tools/toolutil/pkg_genc.cpp index c85a12322b..ec2cb2b67f 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_genc.c +++ b/deps/icu-small/source/tools/toolutil/pkg_genc.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2009-2016, International Business Machines @@ -283,7 +283,7 @@ writeAssemblyCode(const char *filename, const char *destdir, const char *optEntr uprv_strcpy(outFilePath, bufferStr); } -#ifdef WINDOWS_WITH_GNUC +#if defined (WINDOWS_WITH_GNUC) && U_PLATFORM != U_PF_CYGWIN /* Need to fix the file seperator character when using MinGW. */ swapFileSepChar(outFilePath, U_FILE_SEP_CHAR, '/'); #endif @@ -687,12 +687,19 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char /* _M_IA64 should be defined in windows.h */ # if defined(_M_IA64) *pCPU=IMAGE_FILE_MACHINE_IA64; + *pBits = 64; # elif defined(_M_AMD64) - *pCPU=IMAGE_FILE_MACHINE_AMD64; +// link.exe does not really care about the .obj machine type and this will +// allow us to build a dll for both ARM & x64 with an amd64 built tool +// ARM is same as x64 except for first 2 bytes of object file + *pCPU = IMAGE_FILE_MACHINE_UNKNOWN; + // *pCPU = IMAGE_FILE_MACHINE_ARMNT; // If we wanted to be explicit + // *pCPU = IMAGE_FILE_MACHINE_AMD64; // We would use one of these names + *pBits = 64; // Doesn't seem to be used for anything interesting? # else - *pCPU=IMAGE_FILE_MACHINE_I386; + *pCPU=IMAGE_FILE_MACHINE_I386; // We would use one of these names + *pBits = 32; # endif - *pBits= *pCPU==IMAGE_FILE_MACHINE_I386 ? 32 : 64; *pIsBigEndian=FALSE; #else # error "Unknown platform for CAN_GENERATE_OBJECTS." @@ -708,7 +715,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char length=T_FileStream_read(in, buffer.bytes, sizeof(buffer.bytes)); #ifdef U_ELF - if(length<sizeof(Elf32_Ehdr)) { + if(length<(int32_t)sizeof(Elf32_Ehdr)) { fprintf(stderr, "genccode: match-arch file %s is too short\n", filename); exit(U_UNSUPPORTED_ERROR); } @@ -806,7 +813,7 @@ writeObjectCode(const char *filename, const char *destdir, const char *optEntryP /* 32-bit Elf section header table */ static Elf32_Shdr sectionHeaders32[5]={ { /* SHN_UNDEF */ - 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { /* .symtab */ 1, /* sh_name */ @@ -862,7 +869,7 @@ writeObjectCode(const char *filename, const char *destdir, const char *optEntryP /* symbol table */ static Elf32_Sym symbols32[2]={ { /* STN_UNDEF */ - 0 + 0, 0, 0, 0, 0, 0 }, { /* data entry point */ 1, /* st_name */ @@ -923,7 +930,7 @@ writeObjectCode(const char *filename, const char *destdir, const char *optEntryP /* 64-bit Elf section header table */ static Elf64_Shdr sectionHeaders64[5]={ { /* SHN_UNDEF */ - 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { /* .symtab */ 1, /* sh_name */ @@ -982,7 +989,7 @@ writeObjectCode(const char *filename, const char *destdir, const char *optEntryP */ static Elf64_Sym symbols64[2]={ { /* STN_UNDEF */ - 0 + 0, 0, 0, 0, 0, 0 }, { /* data entry point */ 1, /* st_name */ @@ -1030,7 +1037,14 @@ writeObjectCode(const char *filename, const char *destdir, const char *optEntryP /* deal with options, files and the entry point name */ getArchitecture(&cpu, &bits, &makeBigEndian, optMatchArch); - printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%d\n", cpu, bits, makeBigEndian); + if (optMatchArch) + { + printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%d\n", cpu, bits, makeBigEndian); + } + else + { + printf("genccode: using architecture cpu=%hu bits=%hu big-endian=%d\n", cpu, bits, makeBigEndian); + } #if U_PLATFORM_HAS_WIN32_API if(cpu==IMAGE_FILE_MACHINE_I386) { entryOffset=1; diff --git a/deps/icu-small/source/tools/toolutil/pkg_genc.h b/deps/icu-small/source/tools/toolutil/pkg_genc.h index 12ffc92728..5039f27db5 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_genc.h +++ b/deps/icu-small/source/tools/toolutil/pkg_genc.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2008-2011, International Business Machines diff --git a/deps/icu-small/source/tools/toolutil/pkg_gencmn.c b/deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp index 38cc820a17..423e4b7363 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_gencmn.c +++ b/deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2008-2012, International Business Machines @@ -103,8 +103,10 @@ addFile(const char *filename, const char *name, const char *source, UBool source static char * allocString(uint32_t length); +U_CDECL_BEGIN static int compareFiles(const void *file1, const void *file2); +U_CDECL_END static char * pathToFullPath(const char *path, const char *source); @@ -410,7 +412,7 @@ addFile(const char *filename, const char *name, const char *source, UBool source if(fileCount==fileMax) { fileMax += CHUNK_FILE_COUNT; - files = uprv_realloc(files, fileMax*sizeof(files[0])); /* note: never freed. */ + files = (File *)uprv_realloc(files, fileMax*sizeof(files[0])); /* note: never freed. */ if(files==NULL) { fprintf(stderr, "pkgdata/gencmn: Could not allocate %u bytes for %d files\n", (unsigned int)(fileMax*sizeof(files[0])), fileCount); exit(U_MEMORY_ALLOCATION_ERROR); @@ -515,7 +517,7 @@ pathToFullPath(const char *path, const char *source) { length = (uint32_t)(uprv_strlen(path) + 1); newLength = (length + 1 + (int32_t)uprv_strlen(source)); - fullPath = uprv_malloc(newLength); + fullPath = (char *)uprv_malloc(newLength); if(source != NULL) { uprv_strcpy(fullPath, source); uprv_strcat(fullPath, U_FILE_SEP_STRING); @@ -548,15 +550,18 @@ pathToFullPath(const char *path, const char *source) { return fullPath; } +U_CDECL_BEGIN static int compareFiles(const void *file1, const void *file2) { /* sort by basename */ return uprv_strcmp(((File *)file1)->basename, ((File *)file2)->basename); } +U_CDECL_END static void fixDirToTreePath(char *s) { + (void)s; #if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) || ((U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)) char *t; #endif diff --git a/deps/icu-small/source/tools/toolutil/pkg_gencmn.h b/deps/icu-small/source/tools/toolutil/pkg_gencmn.h index 62f8327cdf..238239960a 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_gencmn.h +++ b/deps/icu-small/source/tools/toolutil/pkg_gencmn.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2008, International Business Machines diff --git a/deps/icu-small/source/tools/toolutil/pkg_icu.cpp b/deps/icu-small/source/tools/toolutil/pkg_icu.cpp index e679c23be8..ce0bfc215b 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_icu.cpp +++ b/deps/icu-small/source/tools/toolutil/pkg_icu.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2008-2015, International Business Machines diff --git a/deps/icu-small/source/tools/toolutil/pkg_icu.h b/deps/icu-small/source/tools/toolutil/pkg_icu.h index 3d620f78df..638056e60b 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_icu.h +++ b/deps/icu-small/source/tools/toolutil/pkg_icu.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /****************************************************************************** * Copyright (C) 2008-2016, International Business Machines diff --git a/deps/icu-small/source/tools/toolutil/pkg_imp.h b/deps/icu-small/source/tools/toolutil/pkg_imp.h index c9fe81bd73..29abd8d83c 100644 --- a/deps/icu-small/source/tools/toolutil/pkg_imp.h +++ b/deps/icu-small/source/tools/toolutil/pkg_imp.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: pkg_imp.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/pkgitems.cpp b/deps/icu-small/source/tools/toolutil/pkgitems.cpp index 91c8520110..dd414c2f87 100644 --- a/deps/icu-small/source/tools/toolutil/pkgitems.cpp +++ b/deps/icu-small/source/tools/toolutil/pkgitems.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: pkgitems.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/ppucd.cpp b/deps/icu-small/source/tools/toolutil/ppucd.cpp index 18d317e3e3..cccde81c7a 100644 --- a/deps/icu-small/source/tools/toolutil/ppucd.cpp +++ b/deps/icu-small/source/tools/toolutil/ppucd.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ppucd.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -515,12 +515,12 @@ PreparsedUCD::parseCodePointRange(const char *s, UChar32 &start, UChar32 &end, U void PreparsedUCD::parseString(const char *s, UnicodeString &uni, UErrorCode &errorCode) { - UChar *buffer=uni.getBuffer(-1); + UChar *buffer=toUCharPtr(uni.getBuffer(-1)); int32_t length=u_parseString(s, buffer, uni.getCapacity(), NULL, &errorCode); if(errorCode==U_BUFFER_OVERFLOW_ERROR) { errorCode=U_ZERO_ERROR; uni.releaseBuffer(0); - buffer=uni.getBuffer(length); + buffer=toUCharPtr(uni.getBuffer(length)); length=u_parseString(s, buffer, uni.getCapacity(), NULL, &errorCode); } uni.releaseBuffer(length); diff --git a/deps/icu-small/source/tools/toolutil/ppucd.h b/deps/icu-small/source/tools/toolutil/ppucd.h index 593bd24799..3cd6feee00 100644 --- a/deps/icu-small/source/tools/toolutil/ppucd.h +++ b/deps/icu-small/source/tools/toolutil/ppucd.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ppucd.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/swapimpl.cpp b/deps/icu-small/source/tools/toolutil/swapimpl.cpp index 6cc2162301..620a387e24 100644 --- a/deps/icu-small/source/tools/toolutil/swapimpl.cpp +++ b/deps/icu-small/source/tools/toolutil/swapimpl.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: swapimpl.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/swapimpl.h b/deps/icu-small/source/tools/toolutil/swapimpl.h index 0e4d417344..8c6474f662 100644 --- a/deps/icu-small/source/tools/toolutil/swapimpl.h +++ b/deps/icu-small/source/tools/toolutil/swapimpl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: swapimpl.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/toolutil.cpp b/deps/icu-small/source/tools/toolutil/toolutil.cpp index bb393a2e7d..0f7d0984a8 100644 --- a/deps/icu-small/source/tools/toolutil/toolutil.cpp +++ b/deps/icu-small/source/tools/toolutil/toolutil.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: toolutil.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/toolutil.h b/deps/icu-small/source/tools/toolutil/toolutil.h index 026e75aeb2..be07787a9f 100644 --- a/deps/icu-small/source/tools/toolutil/toolutil.h +++ b/deps/icu-small/source/tools/toolutil/toolutil.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: toolutil.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/ucbuf.cpp b/deps/icu-small/source/tools/toolutil/ucbuf.cpp index b6b0150afc..5269c8177c 100644 --- a/deps/icu-small/source/tools/toolutil/ucbuf.cpp +++ b/deps/icu-small/source/tools/toolutil/ucbuf.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/toolutil/ucbuf.h b/deps/icu-small/source/tools/toolutil/ucbuf.h index cb9509b427..48d41ef4cd 100644 --- a/deps/icu-small/source/tools/toolutil/ucbuf.h +++ b/deps/icu-small/source/tools/toolutil/ucbuf.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/deps/icu-small/source/tools/toolutil/ucln_tu.cpp b/deps/icu-small/source/tools/toolutil/ucln_tu.cpp index 2f67641768..5354fe1753 100644 --- a/deps/icu-small/source/tools/toolutil/ucln_tu.cpp +++ b/deps/icu-small/source/tools/toolutil/ucln_tu.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: diff --git a/deps/icu-small/source/tools/toolutil/ucm.c b/deps/icu-small/source/tools/toolutil/ucm.cpp index 8d4cdfc40f..28c3f3f4f8 100644 --- a/deps/icu-small/source/tools/toolutil/ucm.c +++ b/deps/icu-small/source/tools/toolutil/ucm.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: ucm.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -199,9 +199,9 @@ compareMappings(UCMTable *lTable, const UCMapping *l, /* compare the flags */ return l->f-r->f; } - +U_CDECL_BEGIN /* sorting by Unicode first sorts mappings directly */ -static int32_t +static int32_t U_CALLCONV compareMappingsUnicodeFirst(const void *context, const void *left, const void *right) { return compareMappings( (UCMTable *)context, (const UCMapping *)left, @@ -209,7 +209,7 @@ compareMappingsUnicodeFirst(const void *context, const void *left, const void *r } /* sorting by bytes first sorts the reverseMap; use indirection to mappings */ -static int32_t +static int32_t U_CALLCONV compareMappingsBytesFirst(const void *context, const void *left, const void *right) { UCMTable *table=(UCMTable *)context; int32_t l=*(const int32_t *)left, r=*(const int32_t *)right; @@ -217,6 +217,7 @@ compareMappingsBytesFirst(const void *context, const void *left, const void *rig table, table->mappings+l, table, table->mappings+r, FALSE); } +U_CDECL_END U_CAPI void U_EXPORT2 ucm_sortTable(UCMTable *t) { @@ -310,6 +311,8 @@ enum { static uint8_t checkBaseExtUnicode(UCMStates *baseStates, UCMTable *base, UCMTable *ext, UBool moveToExt, UBool intersectBase) { + (void)baseStates; + UCMapping *mb, *me, *mbLimit, *meLimit; int32_t cmp; uint8_t result; @@ -1043,6 +1046,7 @@ ucm_mappingType(UCMStates *baseStates, UCMapping *m, UChar32 codePoints[UCNV_EXT_MAX_UCHARS], uint8_t bytes[UCNV_EXT_MAX_BYTES]) { + (void)codePoints; /* check validity of the bytes and count the characters in them */ int32_t count=ucm_countChars(baseStates, bytes, m->bLen); if(count<1) { diff --git a/deps/icu-small/source/tools/toolutil/ucm.h b/deps/icu-small/source/tools/toolutil/ucm.h index 0058adab5d..3af9397585 100644 --- a/deps/icu-small/source/tools/toolutil/ucm.h +++ b/deps/icu-small/source/tools/toolutil/ucm.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ucm.h - * encoding: US-ASCII + * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/ucmstate.c b/deps/icu-small/source/tools/toolutil/ucmstate.cpp index 7c8559090b..2776575229 100644 --- a/deps/icu-small/source/tools/toolutil/ucmstate.c +++ b/deps/icu-small/source/tools/toolutil/ucmstate.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: ucmstate.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -916,10 +916,13 @@ compactToUnicodeHelper(UCMStates *states, } } -static int32_t +U_CDECL_BEGIN +static int32_t U_CALLCONV compareFallbacks(const void *context, const void *fb1, const void *fb2) { + (void)context; return ((const _MBCSToUFallback *)fb1)->offset-((const _MBCSToUFallback *)fb2)->offset; } +U_CDECL_END U_CAPI void U_EXPORT2 ucm_optimizeStates(UCMStates *states, diff --git a/deps/icu-small/source/tools/toolutil/udbgutil.cpp b/deps/icu-small/source/tools/toolutil/udbgutil.cpp index bbb814ba90..446e11aaf9 100644 --- a/deps/icu-small/source/tools/toolutil/udbgutil.cpp +++ b/deps/icu-small/source/tools/toolutil/udbgutil.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: @@ -351,8 +351,10 @@ int32_t udbg_enumByName(UDebugEnumType type, const char *value) { */ U_CAPI const char *udbg_getPlatform(void) { -#if U_PLATFORM_HAS_WIN32_API +#if U_PLATFORM_USES_ONLY_WIN32_API return "Windows"; +#elif U_PLATFORM == U_PF_CYGWIN + return "Cygwin"; #elif U_PLATFORM == U_PF_UNKNOWN return "unknown"; #elif U_PLATFORM == U_PF_DARWIN @@ -613,40 +615,6 @@ U_CAPI char *udbg_knownIssueURLFrom(const char *ticket, char *buf) { } -#if !U_HAVE_STD_STRING -const char *warning = "WARNING: Don't have std::string (STL) - known issue logs will be deficient."; - -U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket, - UBool *firstForWhere) { - if(ptr==NULL) { - puts(warning); - } - printf("%s\tKnown Issue #%s\n", where, ticket); - - return (void*)warning; -} - -U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket, - UBool *firstForWhere) { - if(ptr==NULL) { - puts(warning); - } - if(msg==NULL) msg = ""; - printf("%s\tKnown Issue #%s \"%s\n", where, ticket, msg); - - return (void*)warning; -} - -U_CAPI UBool udbg_knownIssue_print(void *ptr) { - puts(warning); - return FALSE; -} - -U_CAPI void udbg_knownIssue_close(void *ptr) { - // nothing to do -} -#else - #include <set> #include <map> #include <string> @@ -785,5 +753,3 @@ U_CAPI void udbg_knownIssue_close(void *ptr) { KnownIssues *t = static_cast<KnownIssues*>(ptr); delete t; } - -#endif diff --git a/deps/icu-small/source/tools/toolutil/udbgutil.h b/deps/icu-small/source/tools/toolutil/udbgutil.h index 4bfb4cf867..2f186e6ed8 100644 --- a/deps/icu-small/source/tools/toolutil/udbgutil.h +++ b/deps/icu-small/source/tools/toolutil/udbgutil.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ************************************************************************ diff --git a/deps/icu-small/source/tools/toolutil/unewdata.c b/deps/icu-small/source/tools/toolutil/unewdata.cpp index f3b152c079..5c28e992c9 100644 --- a/deps/icu-small/source/tools/toolutil/unewdata.c +++ b/deps/icu-small/source/tools/toolutil/unewdata.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: unewdata.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/unewdata.h b/deps/icu-small/source/tools/toolutil/unewdata.h index 9cc3994225..137fb49584 100644 --- a/deps/icu-small/source/tools/toolutil/unewdata.h +++ b/deps/icu-small/source/tools/toolutil/unewdata.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: unewdata.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/uoptions.c b/deps/icu-small/source/tools/toolutil/uoptions.cpp index e5ce64a372..53a77bcc4c 100644 --- a/deps/icu-small/source/tools/toolutil/uoptions.c +++ b/deps/icu-small/source/tools/toolutil/uoptions.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uoptions.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/uoptions.h b/deps/icu-small/source/tools/toolutil/uoptions.h index 72652feadb..a7a2e96c61 100644 --- a/deps/icu-small/source/tools/toolutil/uoptions.h +++ b/deps/icu-small/source/tools/toolutil/uoptions.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uoptions.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/uparse.c b/deps/icu-small/source/tools/toolutil/uparse.cpp index a7142c3cba..937728d78a 100644 --- a/deps/icu-small/source/tools/toolutil/uparse.c +++ b/deps/icu-small/source/tools/toolutil/uparse.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uparse.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/uparse.h b/deps/icu-small/source/tools/toolutil/uparse.h index 5ad766cf10..df0e79a21f 100644 --- a/deps/icu-small/source/tools/toolutil/uparse.h +++ b/deps/icu-small/source/tools/toolutil/uparse.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uparse.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/writesrc.c b/deps/icu-small/source/tools/toolutil/writesrc.cpp index e3f14f2c46..c05a07acd3 100644 --- a/deps/icu-small/source/tools/toolutil/writesrc.c +++ b/deps/icu-small/source/tools/toolutil/writesrc.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: writesrc.c -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -74,7 +74,7 @@ U_CAPI FILE * U_EXPORT2 usrc_create(const char *path, const char *filename, const char *generator) { // TODO: Add parameter for the first year this file was generated, not before 2016. static const char *header= - "// Copyright (C) 2016 and later: Unicode, Inc. and others.\n" + "// © 2016 and later: Unicode, Inc. and others.\n" "// License & terms of use: http://www.unicode.org/copyright.html\n" "//\n" "// Copyright (C) 1999-2016, International Business Machines\n" diff --git a/deps/icu-small/source/tools/toolutil/writesrc.h b/deps/icu-small/source/tools/toolutil/writesrc.h index c82bf3c334..fdcf1f9a6b 100644 --- a/deps/icu-small/source/tools/toolutil/writesrc.h +++ b/deps/icu-small/source/tools/toolutil/writesrc.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: writesrc.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/deps/icu-small/source/tools/toolutil/xmlparser.cpp b/deps/icu-small/source/tools/toolutil/xmlparser.cpp index 2fc6e1f78c..ae7ef17020 100644 --- a/deps/icu-small/source/tools/toolutil/xmlparser.cpp +++ b/deps/icu-small/source/tools/toolutil/xmlparser.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: xmlparser.cpp -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -209,7 +209,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) { goto exit; } - buffer=src.getBuffer(bytesLength); + buffer=toUCharPtr(src.getBuffer(bytesLength)); if(buffer==NULL) { // unexpected failure to reserve some string capacity errorCode=U_MEMORY_ALLOCATION_ERROR; @@ -278,7 +278,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) { pb=bytes; for(;;) { length=src.length(); - buffer=src.getBuffer(capacity); + buffer=toUCharPtr(src.getBuffer(capacity)); if(buffer==NULL) { // unexpected failure to reserve some string capacity errorCode=U_MEMORY_ALLOCATION_ERROR; diff --git a/deps/icu-small/source/tools/toolutil/xmlparser.h b/deps/icu-small/source/tools/toolutil/xmlparser.h index 5c08903f86..72f7ec8fa8 100644 --- a/deps/icu-small/source/tools/toolutil/xmlparser.h +++ b/deps/icu-small/source/tools/toolutil/xmlparser.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: xmlparser.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * |