On 12/28/2012 06:49 PM, julien2412 wrote:
By reading the function MigrationImpl::subtract in
desktop/source/migration/migration.cxx, see
http://opengrok.libreoffice.org/xref/core/desktop/source/migration/migration.cxx#847

I thought about this patch to use "set_difference"
desktop_patch.txt
<http://nabble.documentfoundation.org/file/n4026318/desktop_patch.txt>

The original code is broken to begin with, as it ignores the return values from the std::unique calls, so excess elements remain at the end of va and vb.

However, the patch is also broken:

* Why "vb.end()+5"?

* The output range of std::set_difference must not overlap with either input range.

* The return value of std::set_difference must be observed, to cut off excess elements at the end of the returned range.

* If va contains m identical elements and vb contains n < m elements identical to them, m - n of those elements will remain in the output of std::set_difference, so avoiding std::unique is unsound here.

Stephan
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to