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

Side by Side Diff: icu46/source/common/ures_cnv.c

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « icu46/source/common/uprops.cpp ('k') | icu46/source/common/uresbund.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 1997-2006, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: ures_cnv.c
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2004aug25
14 * created by: Markus W. Scherer
15 *
16 * Character conversion functions moved here from uresbund.c
17 */
18
19 #include "unicode/utypes.h"
20 #include "unicode/putil.h"
21 #include "unicode/ustring.h"
22 #include "unicode/ucnv.h"
23 #include "unicode/ures.h"
24 #include "uinvchar.h"
25 #include "ustr_cnv.h"
26
27 U_CAPI UResourceBundle * U_EXPORT2
28 ures_openU(const UChar *myPath,
29 const char *localeID,
30 UErrorCode *status)
31 {
32 char pathBuffer[1024];
33 int32_t length;
34 char *path = pathBuffer;
35
36 if(status==NULL || U_FAILURE(*status)) {
37 return NULL;
38 }
39 if(myPath==NULL) {
40 path = NULL;
41 }
42 else {
43 length=u_strlen(myPath);
44 if(length>=sizeof(pathBuffer)) {
45 *status=U_ILLEGAL_ARGUMENT_ERROR;
46 return NULL;
47 } else if(uprv_isInvariantUString(myPath, length)) {
48 /*
49 * the invariant converter is sufficient for package and tree names
50 * and is more efficient
51 */
52 u_UCharsToChars(myPath, path, length+1); /* length+1 to include the NUL */
53 } else {
54 #if !UCONFIG_NO_CONVERSION
55 /* use the default converter to support variant-character paths */
56 UConverter *cnv=u_getDefaultConverter(status);
57 length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPat h, length, status);
58 u_releaseDefaultConverter(cnv);
59 if(U_FAILURE(*status)) {
60 return NULL;
61 }
62 if(length>=sizeof(pathBuffer)) {
63 /* not NUL-terminated - path too long */
64 *status=U_ILLEGAL_ARGUMENT_ERROR;
65 return NULL;
66 }
67 #else
68 /* the default converter is not available */
69 *status=U_UNSUPPORTED_ERROR;
70 return NULL;
71 #endif
72 }
73 }
74
75 return ures_open(path, localeID, status);
76 }
OLDNEW
« no previous file with comments | « icu46/source/common/uprops.cpp ('k') | icu46/source/common/uresbund.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698