@@ -232,10 +232,10 @@ void UnlistFunctionScan::internalOpen(thread_db* tdbb) const
232232 auto size = end = valueView.find (separatorView);
233233 if (end == std::string_view::npos)
234234 {
235- if (!valueView.empty ())
236- size = valueView.length ();
237- else
235+ if (valueView.empty ())
238236 break ;
237+
238+ size = valueView.length ();
239239 }
240240
241241 if (size > 0 )
@@ -247,7 +247,10 @@ void UnlistFunctionScan::internalOpen(thread_db* tdbb) const
247247 impure->m_recordBuffer ->store (record);
248248 }
249249
250- valueView.remove_prefix (size + separatorView.length ());
250+ if (end != std::string_view::npos)
251+ size += separatorView.length ();
252+
253+ valueView.remove_prefix (size);
251254
252255 } while (end != std::string_view::npos);
253256 }
@@ -305,21 +308,26 @@ bool UnlistFunctionScan::nextBuffer(thread_db* tdbb) const
305308 std::string_view valueView (bufferString.data (), blobLength + resultLength);
306309 auto end = std::string_view::npos;
307310 impure->m_resultStr ->erase ();
311+
308312 do
309313 {
310314 const auto size = end = valueView.find (separatorView);
311315 if (end == std::string_view::npos)
312316 {
313317 if (!valueView.empty ())
318+ {
314319 impure->m_resultStr ->append (valueView.data (),
315320 static_cast <string::size_type>(valueView.length ()));
321+ }
316322
317323 break ;
318324 }
319325
320326 if (size > 0 )
327+ {
321328 impure->m_resultStr ->append (valueView.data (),
322329 static_cast <string::size_type>(size));
330+ }
323331
324332 valueView.remove_prefix (size + separatorView.length ());
325333
0 commit comments