summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/io
diff options
context:
space:
mode:
Diffstat (limited to 'deps/icu-small/source/io')
-rw-r--r--deps/icu-small/source/io/locbund.cpp2
-rw-r--r--deps/icu-small/source/io/locbund.h2
-rw-r--r--deps/icu-small/source/io/sprintf.cpp (renamed from deps/icu-small/source/io/sprintf.c)2
-rw-r--r--deps/icu-small/source/io/sscanf.cpp (renamed from deps/icu-small/source/io/sscanf.c)2
-rw-r--r--deps/icu-small/source/io/ucln_io.cpp4
-rw-r--r--deps/icu-small/source/io/ucln_io.h4
-rw-r--r--deps/icu-small/source/io/ufile.cpp (renamed from deps/icu-small/source/io/ufile.c)51
-rw-r--r--deps/icu-small/source/io/ufile.h4
-rw-r--r--deps/icu-small/source/io/ufmt_cmn.cpp (renamed from deps/icu-small/source/io/ufmt_cmn.c)2
-rw-r--r--deps/icu-small/source/io/ufmt_cmn.h4
-rw-r--r--deps/icu-small/source/io/unicode/ustdio.h2
-rw-r--r--deps/icu-small/source/io/unicode/ustream.h4
-rw-r--r--deps/icu-small/source/io/uprintf.cpp2
-rw-r--r--deps/icu-small/source/io/uprintf.h2
-rw-r--r--deps/icu-small/source/io/uprntf_p.cpp (renamed from deps/icu-small/source/io/uprntf_p.c)15
-rw-r--r--deps/icu-small/source/io/uscanf.cpp (renamed from deps/icu-small/source/io/uscanf.c)2
-rw-r--r--deps/icu-small/source/io/uscanf.h2
-rw-r--r--deps/icu-small/source/io/uscanf_p.cpp (renamed from deps/icu-small/source/io/uscanf_p.c)44
-rw-r--r--deps/icu-small/source/io/ustdio.cpp (renamed from deps/icu-small/source/io/ustdio.c)2
-rw-r--r--deps/icu-small/source/io/ustream.cpp2
20 files changed, 96 insertions, 58 deletions
diff --git a/deps/icu-small/source/io/locbund.cpp b/deps/icu-small/source/io/locbund.cpp
index 4dc50d50df..f15788ee19 100644
--- a/deps/icu-small/source/io/locbund.cpp
+++ b/deps/icu-small/source/io/locbund.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/io/locbund.h b/deps/icu-small/source/io/locbund.h
index b9e19484b6..5879e28f01 100644
--- a/deps/icu-small/source/io/locbund.h
+++ b/deps/icu-small/source/io/locbund.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/io/sprintf.c b/deps/icu-small/source/io/sprintf.cpp
index 17cdb2dcdd..20b9e52a21 100644
--- a/deps/icu-small/source/io/sprintf.c
+++ b/deps/icu-small/source/io/sprintf.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/io/sscanf.c b/deps/icu-small/source/io/sscanf.cpp
index 2e14cdbcb6..5409ebb716 100644
--- a/deps/icu-small/source/io/sscanf.c
+++ b/deps/icu-small/source/io/sscanf.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/io/ucln_io.cpp b/deps/icu-small/source/io/ucln_io.cpp
index 5822d22be1..388abbb4e9 100644
--- a/deps/icu-small/source/io/ucln_io.cpp
+++ b/deps/icu-small/source/io/ucln_io.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: ucln_io.cpp
-* encoding: US-ASCII
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/deps/icu-small/source/io/ucln_io.h b/deps/icu-small/source/io/ucln_io.h
index 97d06a12ff..20dcb88ac7 100644
--- a/deps/icu-small/source/io/ucln_io.h
+++ b/deps/icu-small/source/io/ucln_io.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: ucln_io.h
-* encoding: US-ASCII
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
diff --git a/deps/icu-small/source/io/ufile.c b/deps/icu-small/source/io/ufile.cpp
index 71d27a5e25..6cbb897555 100644
--- a/deps/icu-small/source/io/ufile.c
+++ b/deps/icu-small/source/io/ufile.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 ufile.c
+* File ufile.cpp
*
* Modification History:
*
@@ -20,10 +20,11 @@
******************************************************************************
*/
-/*
- * fileno is not declared when building with GCC in strict mode.
- */
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#include "unicode/platform.h"
+#if defined(__GNUC__) && !defined(__clang__) && defined(__STRICT_ANSI__)
+// g++, fileno isn't defined if __STRICT_ANSI__ is defined.
+// clang fails to compile the <string> header unless __STRICT_ANSI__ is defined.
+// __GNUC__ is set by both gcc and clang.
#undef __STRICT_ANSI__
#endif
@@ -32,6 +33,8 @@
#if !UCONFIG_NO_CONVERSION
+#include <stdlib.h>
+
#include "ufile.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
@@ -64,33 +67,7 @@ finit_owner(FILE *f,
uprv_memset(result, 0, sizeof(UFILE));
result->fFileno = fileno(f);
-
-#if U_PLATFORM_USES_ONLY_WIN32_API && _MSC_VER < 1900
- /*
- * Below is a very old workaround (ICU ticket:231).
- *
- * Previously, 'FILE*' from inside and outside ICU's DLL
- * were different, because they pointed into local copies
- * of the io block. At least by VS 2015 the implementation
- * is something like:
- * stdio = _acrt_iob_func(0)
- * .. which is a function call, so should return the same pointer
- * regardless of call site.
- * As of _MSC_VER 1900 this patch is retired, at 16 years old.
- */
- if (0 <= result->fFileno && result->fFileno <= 2) {
- /* stdin, stdout and stderr need to be special cased for Windows 98 */
-#if _MSC_VER >= 1400
- result->fFile = &__iob_func()[_fileno(f)];
-#else
- result->fFile = &_iob[_fileno(f)];
-#endif
- }
- else
-#endif
- {
- result->fFile = f;
- }
+ result->fFile = f;
result->str.fBuffer = result->fUCBuffer;
result->str.fPos = result->fUCBuffer;
@@ -180,7 +157,11 @@ u_fopen_u(const UChar *filename,
#if U_PLATFORM_USES_ONLY_WIN32_API
/* Try Windows API _wfopen if the above fails. */
if (!result) {
- FILE *systemFile = _wfopen(filename, (UChar*)perm);
+ // TODO: test this code path, including wperm.
+ wchar_t wperm[40] = {};
+ size_t retVal;
+ mbstowcs_s(&retVal, wperm, perm, _TRUNCATE);
+ FILE *systemFile = _wfopen((const wchar_t *)filename, wperm);
if (systemFile) {
result = finit_owner(systemFile, locale, codepage, TRUE);
}
@@ -208,7 +189,7 @@ u_fstropen(UChar *stringBuf,
result = (UFILE*) uprv_malloc(sizeof(UFILE));
/* Null pointer test */
if (result == NULL) {
- return NULL; /* Just get out. */
+ return NULL; /* Just get out. */
}
uprv_memset(result, 0, sizeof(UFILE));
result->str.fBuffer = stringBuf;
diff --git a/deps/icu-small/source/io/ufile.h b/deps/icu-small/source/io/ufile.h
index b2562747e6..ed89727543 100644
--- a/deps/icu-small/source/io/ufile.h
+++ b/deps/icu-small/source/io/ufile.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
/*
*******************************************************************************
@@ -25,6 +25,8 @@
#if !UCONFIG_NO_CONVERSION
+#include <stdio.h>
+
#include "unicode/ucnv.h"
#include "unicode/utrans.h"
#include "locbund.h"
diff --git a/deps/icu-small/source/io/ufmt_cmn.c b/deps/icu-small/source/io/ufmt_cmn.cpp
index e896bc560d..760d2711bd 100644
--- a/deps/icu-small/source/io/ufmt_cmn.c
+++ b/deps/icu-small/source/io/ufmt_cmn.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/io/ufmt_cmn.h b/deps/icu-small/source/io/ufmt_cmn.h
index 7daeee8813..d9cfd6a5f3 100644
--- a/deps/icu-small/source/io/ufmt_cmn.h
+++ b/deps/icu-small/source/io/ufmt_cmn.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
/*
******************************************************************************
@@ -26,7 +26,7 @@
#include "unicode/utf16.h"
#define UFMT_DEFAULT_BUFFER_SIZE 128
-#define MAX_UCHAR_BUFFER_SIZE(buffer) (sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar)))
+#define MAX_UCHAR_BUFFER_SIZE(buffer) ((int32_t)(sizeof(buffer)/(U16_MAX_LENGTH*sizeof(UChar))))
#define MAX_UCHAR_BUFFER_NEEDED(strLen) ((strLen+1)*U16_MAX_LENGTH*sizeof(UChar))
/**
diff --git a/deps/icu-small/source/io/unicode/ustdio.h b/deps/icu-small/source/io/unicode/ustdio.h
index 5e11bb6766..565b5b3fc5 100644
--- a/deps/icu-small/source/io/unicode/ustdio.h
+++ b/deps/icu-small/source/io/unicode/ustdio.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/io/unicode/ustream.h b/deps/icu-small/source/io/unicode/ustream.h
index ab52f6a28a..df1506ebfb 100644
--- a/deps/icu-small/source/io/unicode/ustream.h
+++ b/deps/icu-small/source/io/unicode/ustream.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
/*
**********************************************************************
@@ -30,7 +30,7 @@
* C++ I/O stream API.
*/
-#if !defined(_MSC_VER)
+#if defined(__GLIBCXX__)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif
diff --git a/deps/icu-small/source/io/uprintf.cpp b/deps/icu-small/source/io/uprintf.cpp
index e6062ade29..316c794498 100644
--- a/deps/icu-small/source/io/uprintf.cpp
+++ b/deps/icu-small/source/io/uprintf.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/io/uprintf.h b/deps/icu-small/source/io/uprintf.h
index 0a07e6b7d6..0fd6066e56 100644
--- a/deps/icu-small/source/io/uprintf.h
+++ b/deps/icu-small/source/io/uprintf.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/io/uprntf_p.c b/deps/icu-small/source/io/uprntf_p.cpp
index 81f5269658..ecf2e67235 100644
--- a/deps/icu-small/source/io/uprntf_p.c
+++ b/deps/icu-small/source/io/uprntf_p.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
/*
******************************************************************************
@@ -184,6 +184,9 @@ u_printf_simple_percent_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
+ (void)info;
+ (void)args;
static const UChar PERCENT[] = { UP_PERCENT };
/* put a single '%' onto the output */
@@ -198,6 +201,7 @@ u_printf_string_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
UChar *s;
UChar buffer[UFMT_DEFAULT_BUFFER_SIZE];
int32_t len, written;
@@ -248,6 +252,7 @@ u_printf_char_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
UChar s[U16_MAX_LENGTH+1];
int32_t len = 1, written;
unsigned char arg = (unsigned char)(args[0].int64Value);
@@ -418,6 +423,7 @@ u_printf_hex_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
int64_t num = args[0].int64Value;
UChar result[UPRINTF_BUFFER_SIZE];
int32_t len = UPRINTF_BUFFER_SIZE;
@@ -453,6 +459,7 @@ u_printf_octal_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
int64_t num = args[0].int64Value;
UChar result[UPRINTF_BUFFER_SIZE];
int32_t len = UPRINTF_BUFFER_SIZE;
@@ -540,6 +547,7 @@ u_printf_pointer_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
UChar result[UPRINTF_BUFFER_SIZE];
int32_t len = UPRINTF_BUFFER_SIZE;
@@ -751,6 +759,7 @@ u_printf_ustring_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
int32_t len, written;
const UChar *arg = (const UChar*)(args[0].ptrValue);
@@ -779,6 +788,7 @@ u_printf_uchar_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)formatBundle;
int32_t written = 0;
UChar arg = (UChar)(args[0].int64Value);
@@ -858,6 +868,9 @@ u_printf_count_handler(const u_printf_stream_handler *handler,
const u_printf_spec_info *info,
const ufmt_args *args)
{
+ (void)handler;
+ (void)context;
+ (void)formatBundle;
int32_t *count = (int32_t*)(args[0].ptrValue);
/* in the special case of count, the u_printf_spec_info's width */
diff --git a/deps/icu-small/source/io/uscanf.c b/deps/icu-small/source/io/uscanf.cpp
index 9866963201..0febd21398 100644
--- a/deps/icu-small/source/io/uscanf.c
+++ b/deps/icu-small/source/io/uscanf.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/io/uscanf.h b/deps/icu-small/source/io/uscanf.h
index bbe84d9e2b..760691cb0a 100644
--- a/deps/icu-small/source/io/uscanf.h
+++ b/deps/icu-small/source/io/uscanf.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/io/uscanf_p.c b/deps/icu-small/source/io/uscanf_p.cpp
index f17502038a..c08949d729 100644
--- a/deps/icu-small/source/io/uscanf_p.c
+++ b/deps/icu-small/source/io/uscanf_p.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
/*
*******************************************************************************
@@ -380,6 +380,11 @@ u_scanf_simple_percent_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)info;
+ (void)args;
+ (void)fmt;
+ (void)fmtConsumed;
+
/* make sure the next character in the input is a percent */
*argConverted = 0;
if(u_fgetc(input) != 0x0025) {
@@ -396,6 +401,10 @@ u_scanf_count_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)input;
+ (void)fmt;
+ (void)fmtConsumed;
+
/* in the special case of count, the u_scanf_spec_info's width */
/* will contain the # of items converted thus far */
if (!info->fSkipArg) {
@@ -420,6 +429,9 @@ u_scanf_double_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
double num;
UNumberFormat *format;
@@ -485,6 +497,9 @@ u_scanf_scientific_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
double num;
UNumberFormat *format;
@@ -582,6 +597,9 @@ u_scanf_scidbl_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
double num;
UNumberFormat *scientificFormat, *genericFormat;
@@ -672,6 +690,9 @@ u_scanf_integer_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
void *num = (void*) (args[0].ptrValue);
UNumberFormat *format;
@@ -745,6 +766,9 @@ u_scanf_percent_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
double num;
UNumberFormat *format;
@@ -802,6 +826,9 @@ u_scanf_string_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
const UChar *source;
UConverter *conv;
char *arg = (char*)(args[0].ptrValue);
@@ -900,6 +927,9 @@ u_scanf_ustring_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
UChar *arg = (UChar*)(args[0].ptrValue);
UChar *alias = arg;
int32_t count;
@@ -969,6 +999,9 @@ u_scanf_spellout_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
double num;
UNumberFormat *format;
@@ -1028,6 +1061,9 @@ u_scanf_hex_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
int32_t skipped;
void *num = (void*) (args[0].ptrValue);
@@ -1084,6 +1120,9 @@ u_scanf_octal_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
int32_t skipped;
void *num = (void*) (args[0].ptrValue);
@@ -1131,6 +1170,9 @@ u_scanf_pointer_handler(UFILE *input,
int32_t *fmtConsumed,
int32_t *argConverted)
{
+ (void)fmt;
+ (void)fmtConsumed;
+
int32_t len;
int32_t skipped;
void *result;
diff --git a/deps/icu-small/source/io/ustdio.c b/deps/icu-small/source/io/ustdio.cpp
index 4b156595bb..790a097980 100644
--- a/deps/icu-small/source/io/ustdio.c
+++ b/deps/icu-small/source/io/ustdio.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/io/ustream.cpp b/deps/icu-small/source/io/ustream.cpp
index 8e0087edbe..a537d14383 100644
--- a/deps/icu-small/source/io/ustream.cpp
+++ b/deps/icu-small/source/io/ustream.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
/*
**********************************************************************