@@ -91,7 +91,6 @@ class CharSetConverterTable : public details::CharSetConverterImplBase {
9191 std::error_code convert (StringRef Source, SmallVectorImpl<char > &Result,
9292 bool ShouldAutoFlush) const override ;
9393 std::error_code flush () const override ;
94- std::error_code flush (SmallVectorImpl<char > &Result) const override ;
9594};
9695
9796std::error_code CharSetConverterTable::convert (StringRef Source,
@@ -111,11 +110,6 @@ std::error_code CharSetConverterTable::flush() const {
111110 return std::error_code ();
112111}
113112
114- std::error_code
115- CharSetConverterTable::flush (SmallVectorImpl<char > &Result) const {
116- return std::error_code ();
117- }
118-
119113#ifdef HAVE_ICU
120114class CharSetConverterICU : public details ::CharSetConverterImplBase {
121115 UConverter *FromConvDesc;
@@ -144,7 +138,6 @@ class CharSetConverterICU : public details::CharSetConverterImplBase {
144138 std::error_code convert (StringRef Source, SmallVectorImpl<char > &Result,
145139 bool ShouldAutoFlush) const override ;
146140 std::error_code flush () const override ;
147- std::error_code flush (SmallVectorImpl<char > &Result) const override ;
148141};
149142
150143std::error_code CharSetConverterICU::convert (StringRef Source,
@@ -164,7 +157,7 @@ std::error_code CharSetConverterICU::convert(StringRef Source,
164157 const char *Input =
165158 InputLength ? const_cast <char *>(Source.data ()) : nullptr ;
166159 const char *In = Input;
167- Output = InputLength ? static_cast <char *>(Result.data ()) : nullptr ;
160+ Output = static_cast <char *>(Result.data ());
168161 Out = Output;
169162 ucnv_convertEx (ToConvDesc, FromConvDesc, &Output, Out + OutputLength,
170163 &Input, In + InputLength, /* pivotStart=*/ NULL ,
@@ -173,26 +166,22 @@ std::error_code CharSetConverterICU::convert(StringRef Source,
173166 /* flush=*/ ShouldAutoFlush, &EC);
174167 if (U_FAILURE (EC)) {
175168 if (EC == U_BUFFER_OVERFLOW_ERROR &&
176- Capacity < std::numeric_limits<size_t >::max ())
169+ Capacity < std::numeric_limits<size_t >::max ()) {
177170 HandleOverflow (Capacity, Output, OutputLength, Result);
178- else
171+ continue ;
172+ } else
179173 // Some other error occured.
180174 return std::error_code (EILSEQ, std::generic_category ());
181- } else if ( U_SUCCESS (EC))
182- break ;
183- } while (U_FAILURE (EC) );
175+ }
176+ break ;
177+ } while (true );
184178
185179 Result.resize (Output - Out);
186180 return std::error_code ();
187181}
188182
189183std::error_code CharSetConverterICU::flush () const { return std::error_code (); }
190184
191- std::error_code
192- CharSetConverterICU::flush (SmallVectorImpl<char > &Result) const {
193- return std::error_code ();
194- }
195-
196185#elif defined(HAVE_ICONV)
197186class CharSetConverterIconv : public details ::CharSetConverterImplBase {
198187 iconv_t ConvDesc;
@@ -203,7 +192,6 @@ class CharSetConverterIconv : public details::CharSetConverterImplBase {
203192 std::error_code convert (StringRef Source, SmallVectorImpl<char > &Result,
204193 bool ShouldAutoFlush) const override ;
205194 std::error_code flush () const override ;
206- std::error_code flush (SmallVectorImpl<char > &Result) const override ;
207195};
208196
209197std::error_code CharSetConverterIconv::convert (StringRef Source,
@@ -263,11 +251,6 @@ std::error_code CharSetConverterIconv::flush() const {
263251 return std::error_code ();
264252}
265253
266- std::error_code
267- CharSetConverterIconv::flush (SmallVectorImpl<char > &Result) const {
268- return convert (" " , Result, /* ShouldAutoFlush=*/ true );
269- }
270-
271254#endif // HAVE_ICONV
272255} // namespace
273256
0 commit comments