File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,13 @@ class ConverterObject : public BaseObject, Converter {
215215 result.AllocateSufficientStorage (limit);
216216
217217 UBool flush = (flags & CONVERTER_FLAGS_FLUSH) == CONVERTER_FLAGS_FLUSH;
218+ OnScopeLeave cleanup ([&]() {
219+ if (flush) {
220+ // Reset the converter state.
221+ converter->bomSeen_ = false ;
222+ ucnv_reset (converter->conv );
223+ }
224+ });
218225
219226 const char * source = input_obj_data;
220227 size_t source_length = input_obj_length;
@@ -238,17 +245,10 @@ class ConverterObject : public BaseObject, Converter {
238245 result.SetLength (target - &result[0 ]);
239246 ret = ToBufferEndian (env, &result);
240247 args.GetReturnValue ().Set (ret.ToLocalChecked ());
241- goto reset ;
248+ return ;
242249 }
243250
244251 args.GetReturnValue ().Set (status);
245-
246- reset:
247- if (flush) {
248- // Reset the converter state
249- converter->bomSeen_ = false ;
250- ucnv_reset (converter->conv );
251- }
252252 }
253253
254254 void MemoryInfo (MemoryTracker* tracker) const override {
You can’t perform that action at this time.
0 commit comments