OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * | 3 * |
4 * Copyright (C) 1998-2014, International Business Machines | 4 * Copyright (C) 1998-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ****************************************************************************** | 7 ****************************************************************************** |
8 * | 8 * |
9 * File ufile.c | 9 * File ufile.c |
10 * | 10 * |
11 * Modification History: | 11 * Modification History: |
12 * | 12 * |
13 * Date Name Description | 13 * Date Name Description |
14 * 11/19/98 stephen Creation. | 14 * 11/19/98 stephen Creation. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 result = (UFILE*) uprv_malloc(sizeof(UFILE)); | 58 result = (UFILE*) uprv_malloc(sizeof(UFILE)); |
59 if(result == NULL) { | 59 if(result == NULL) { |
60 return 0; | 60 return 0; |
61 } | 61 } |
62 | 62 |
63 uprv_memset(result, 0, sizeof(UFILE)); | 63 uprv_memset(result, 0, sizeof(UFILE)); |
64 result->fFileno = fileno(f); | 64 result->fFileno = fileno(f); |
65 | 65 |
66 #if U_PLATFORM_USES_ONLY_WIN32_API | 66 #if U_PLATFORM_USES_ONLY_WIN32_API && _MSC_VER < 1900 |
| 67 /* |
| 68 * Below is a very old workaround (ICU ticket:231). |
| 69 * |
| 70 * Previously, 'FILE*' from inside and outside ICU's DLL |
| 71 * were different, because they pointed into local copies |
| 72 * of the io block. At least by VS 2015 the implementation |
| 73 * is something like: |
| 74 * stdio = _acrt_iob_func(0) |
| 75 * .. which is a function call, so should return the same pointer |
| 76 * regardless of call site. |
| 77 * As of _MSC_VER 1900 this patch is retired, at 16 years old. |
| 78 */ |
67 if (0 <= result->fFileno && result->fFileno <= 2) { | 79 if (0 <= result->fFileno && result->fFileno <= 2) { |
68 /* stdin, stdout and stderr need to be special cased for Windows 98 */ | 80 /* stdin, stdout and stderr need to be special cased for Windows 98 */ |
69 #if _MSC_VER >= 1400 | 81 #if _MSC_VER >= 1400 |
70 result->fFile = &__iob_func()[_fileno(f)]; | 82 result->fFile = &__iob_func()[_fileno(f)]; |
71 #else | 83 #else |
72 result->fFile = &_iob[_fileno(f)]; | 84 result->fFile = &_iob[_fileno(f)]; |
73 #endif | 85 #endif |
74 } | 86 } |
75 else | 87 else |
76 #endif | 88 #endif |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return file->fConverter; | 351 return file->fConverter; |
340 } | 352 } |
341 #if !UCONFIG_NO_FORMATTING | 353 #if !UCONFIG_NO_FORMATTING |
342 U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file) | 354 U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file) |
343 { | 355 { |
344 return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL); | 356 return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL); |
345 } | 357 } |
346 #endif | 358 #endif |
347 | 359 |
348 #endif | 360 #endif |
OLD | NEW |