Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: source/io/ufile.c

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/io/ufile.h ('k') | source/io/ufmt_cmn.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ****************************************************************************** 2 ******************************************************************************
3 * 3 *
4 * Copyright (C) 1998-2013, International Business Machines 4 * Copyright (C) 1998-2014, 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.
15 * 03/12/99 stephen Modified for new C API. 15 * 03/12/99 stephen Modified for new C API.
16 * 06/16/99 stephen Changed T_LocaleBundle to u_locbund 16 * 06/16/99 stephen Changed T_LocaleBundle to u_locbund
17 * 07/19/99 stephen Fixed to use ucnv's default codepage. 17 * 07/19/99 stephen Fixed to use ucnv's default codepage.
18 ****************************************************************************** 18 ******************************************************************************
19 */ 19 */
20 20
21 /* 21 /*
22 * fileno is not declared when building with GCC in strict mode. 22 * fileno is not declared when building with GCC in strict mode.
23 */ 23 */
24 #if defined(__GNUC__) && defined(__STRICT_ANSI__) 24 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
25 #undef __STRICT_ANSI__ 25 #undef __STRICT_ANSI__
26 #endif 26 #endif
27 27
28 #include "locmap.h" 28 #include "locmap.h"
29 #include "unicode/ustdio.h" 29 #include "unicode/ustdio.h"
30
31 #if !UCONFIG_NO_CONVERSION
32
30 #include "ufile.h" 33 #include "ufile.h"
31 #include "unicode/uloc.h" 34 #include "unicode/uloc.h"
32 #include "unicode/ures.h" 35 #include "unicode/ures.h"
33 #include "unicode/ucnv.h" 36 #include "unicode/ucnv.h"
37 #include "unicode/ustring.h"
34 #include "cstring.h" 38 #include "cstring.h"
35 #include "cmemory.h" 39 #include "cmemory.h"
36 40
37 #if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno) 41 #if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno)
38 /* Windows likes to rename Unix-like functions */ 42 /* Windows likes to rename Unix-like functions */
39 #define fileno _fileno 43 #define fileno _fileno
40 #endif 44 #endif
41 45
42 static UFILE* 46 static UFILE*
43 finit_owner(FILE *f, 47 finit_owner(FILE *f,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!result) { 145 if (!result) {
142 /* Something bad happened. 146 /* Something bad happened.
143 Maybe the converter couldn't be opened. */ 147 Maybe the converter couldn't be opened. */
144 fclose(systemFile); 148 fclose(systemFile);
145 } 149 }
146 150
147 return result; /* not a file leak */ 151 return result; /* not a file leak */
148 } 152 }
149 153
150 U_CAPI UFILE* U_EXPORT2 154 U_CAPI UFILE* U_EXPORT2
155 u_fopen_u(const UChar *filename,
156 const char *perm,
157 const char *locale,
158 const char *codepage)
159 {
160 UFILE *result;
161 char buffer[256];
162
163 u_austrcpy(buffer, filename);
164
165 result = u_fopen(buffer, perm, locale, codepage);
166 #if U_PLATFORM_USES_ONLY_WIN32_API
167 /* Try Windows API _wfopen if the above fails. */
168 if (!result) {
169 FILE *systemFile = _wfopen(filename, (UChar*)perm);
170 if (systemFile) {
171 result = finit_owner(systemFile, locale, codepage, TRUE);
172 }
173 if (!result) {
174 /* Something bad happened.
175 Maybe the converter couldn't be opened. */
176 fclose(systemFile);
177 }
178 }
179 #endif
180 return result; /* not a file leak */
181 }
182
183 U_CAPI UFILE* U_EXPORT2
151 u_fstropen(UChar *stringBuf, 184 u_fstropen(UChar *stringBuf,
152 int32_t capacity, 185 int32_t capacity,
153 const char *locale) 186 const char *locale)
154 { 187 {
155 UFILE *result; 188 UFILE *result;
156 189
157 if (capacity < 0) { 190 if (capacity < 0) {
158 return NULL; 191 return NULL;
159 } 192 }
160 193
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 { 338 {
306 return file->fConverter; 339 return file->fConverter;
307 } 340 }
308 #if !UCONFIG_NO_FORMATTING 341 #if !UCONFIG_NO_FORMATTING
309 U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file) 342 U_CAPI const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *file)
310 { 343 {
311 return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL); 344 return u_locbund_getNumberFormat(&file->str.fBundle, UNUM_DECIMAL);
312 } 345 }
313 #endif 346 #endif
314 347
348 #endif
OLDNEW
« no previous file with comments | « source/io/ufile.h ('k') | source/io/ufmt_cmn.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698