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

Side by Side Diff: source/common/unistr_cnv.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 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/common/unistr_case.cpp ('k') | source/common/unistrappender.h » ('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) 1999-2010, International Business Machines 4 * Copyright (C) 1999-2014, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * file name: unistr_cnv.cpp 8 * file name: unistr_cnv.cpp
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
11 * indentation:2 11 * indentation:2
12 * 12 *
13 * created on: 2004aug19 13 * created on: 2004aug19
14 * created by: Markus W. Scherer 14 * created by: Markus W. Scherer
(...skipping 17 matching lines...) Expand all
32 #include "ustr_imp.h" 32 #include "ustr_imp.h"
33 33
34 U_NAMESPACE_BEGIN 34 U_NAMESPACE_BEGIN
35 35
36 //======================================== 36 //========================================
37 // Constructors 37 // Constructors
38 //======================================== 38 //========================================
39 39
40 #if !U_CHARSET_IS_UTF8 40 #if !U_CHARSET_IS_UTF8
41 41
42 UnicodeString::UnicodeString(const char *codepageData) 42 UnicodeString::UnicodeString(const char *codepageData) {
43 : fShortLength(0), 43 fUnion.fFields.fLengthAndFlags = kShortString;
44 fFlags(kShortString)
45 {
46 if(codepageData != 0) { 44 if(codepageData != 0) {
47 doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), 0); 45 doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), 0);
48 } 46 }
49 } 47 }
50 48
51 UnicodeString::UnicodeString(const char *codepageData, 49 UnicodeString::UnicodeString(const char *codepageData,
52 int32_t dataLength) 50 int32_t dataLength) {
53 : fShortLength(0), 51 fUnion.fFields.fLengthAndFlags = kShortString;
54 fFlags(kShortString)
55 {
56 if(codepageData != 0) { 52 if(codepageData != 0) {
57 doCodepageCreate(codepageData, dataLength, 0); 53 doCodepageCreate(codepageData, dataLength, 0);
58 } 54 }
59 } 55 }
60 56
61 // else see unistr.cpp 57 // else see unistr.cpp
62 #endif 58 #endif
63 59
64 UnicodeString::UnicodeString(const char *codepageData, 60 UnicodeString::UnicodeString(const char *codepageData,
65 const char *codepage) 61 const char *codepage) {
66 : fShortLength(0), 62 fUnion.fFields.fLengthAndFlags = kShortString;
67 fFlags(kShortString)
68 {
69 if(codepageData != 0) { 63 if(codepageData != 0) {
70 doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), codep age); 64 doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), codep age);
71 } 65 }
72 } 66 }
73 67
74 UnicodeString::UnicodeString(const char *codepageData, 68 UnicodeString::UnicodeString(const char *codepageData,
75 int32_t dataLength, 69 int32_t dataLength,
76 const char *codepage) 70 const char *codepage) {
77 : fShortLength(0), 71 fUnion.fFields.fLengthAndFlags = kShortString;
78 fFlags(kShortString)
79 {
80 if(codepageData != 0) { 72 if(codepageData != 0) {
81 doCodepageCreate(codepageData, dataLength, codepage); 73 doCodepageCreate(codepageData, dataLength, codepage);
82 } 74 }
83 } 75 }
84 76
85 UnicodeString::UnicodeString(const char *src, int32_t srcLength, 77 UnicodeString::UnicodeString(const char *src, int32_t srcLength,
86 UConverter *cnv, 78 UConverter *cnv,
87 UErrorCode &errorCode) 79 UErrorCode &errorCode) {
88 : fShortLength(0), 80 fUnion.fFields.fLengthAndFlags = kShortString;
89 fFlags(kShortString)
90 {
91 if(U_SUCCESS(errorCode)) { 81 if(U_SUCCESS(errorCode)) {
92 // check arguments 82 // check arguments
93 if(src==NULL) { 83 if(src==NULL) {
94 // treat as an empty string, do nothing more 84 // treat as an empty string, do nothing more
95 } else if(srcLength<-1) { 85 } else if(srcLength<-1) {
96 errorCode=U_ILLEGAL_ARGUMENT_ERROR; 86 errorCode=U_ILLEGAL_ARGUMENT_ERROR;
97 } else { 87 } else {
98 // get input length 88 // get input length
99 if(srcLength==-1) { 89 if(srcLength==-1) {
100 srcLength=(int32_t)uprv_strlen(src); 90 srcLength=(int32_t)uprv_strlen(src);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 arraySize = (int32_t)(length() + 2 * (mySourceEnd - mySource)); 406 arraySize = (int32_t)(length() + 2 * (mySourceEnd - mySource));
417 } else { 407 } else {
418 break; 408 break;
419 } 409 }
420 } 410 }
421 } 411 }
422 412
423 U_NAMESPACE_END 413 U_NAMESPACE_END
424 414
425 #endif 415 #endif
OLDNEW
« no previous file with comments | « source/common/unistr_case.cpp ('k') | source/common/unistrappender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698