Sorted the data file content extents by ECMA-119 tree rather than
by the red-black tree which shall consolidate files with identical source object. Discovered and repaired a flaw in transitivity of iso_stream_cmp_ino().
This commit is contained in:
@@ -838,6 +838,9 @@ no_mem:
|
||||
static
|
||||
int ziso_cmp_ino(IsoStream *s1, IsoStream *s2);
|
||||
|
||||
static
|
||||
int ziso_uncompress_cmp_ino(IsoStream *s1, IsoStream *s2);
|
||||
|
||||
|
||||
IsoStreamIface ziso_stream_compress_class = {
|
||||
4,
|
||||
@@ -868,7 +871,7 @@ IsoStreamIface ziso_stream_uncompress_class = {
|
||||
ziso_stream_free,
|
||||
ziso_update_size,
|
||||
ziso_get_input_stream,
|
||||
ziso_cmp_ino,
|
||||
ziso_uncompress_cmp_ino,
|
||||
ziso_clone_stream
|
||||
};
|
||||
|
||||
@@ -876,9 +879,36 @@ IsoStreamIface ziso_stream_uncompress_class = {
|
||||
static
|
||||
int ziso_cmp_ino(IsoStream *s1, IsoStream *s2)
|
||||
{
|
||||
/* This function may rely on being called by iso_stream_cmp_ino()
|
||||
only with s1, s2 which both point to it as their .cmp_ino() function.
|
||||
It would be a programming error to let any other than
|
||||
ziso_stream_compress_class point to ziso_cmp_ino().
|
||||
*/
|
||||
if (s1->class != s2->class || (s1->class != &ziso_stream_compress_class &&
|
||||
s2->class != &ziso_stream_uncompress_class))
|
||||
iso_stream_cmp_ino(s1, s2, 1);
|
||||
|
||||
/* Both streams apply the same treatment to their input streams */
|
||||
return iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0),
|
||||
iso_stream_get_input_stream(s2, 0), 0);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int ziso_uncompress_cmp_ino(IsoStream *s1, IsoStream *s2)
|
||||
{
|
||||
/* This function may rely on being called by iso_stream_cmp_ino()
|
||||
only with s1, s2 which both point to it as their .cmp_ino() function.
|
||||
It would be a programming error to let any other than
|
||||
ziso_stream_uncompress_class point to ziso_uncompress_cmp_ino().
|
||||
This fallback endangers transitivity of iso_stream_cmp_ino().
|
||||
*/
|
||||
if (s1->class != s2->class ||
|
||||
(s1->class != &ziso_stream_uncompress_class &&
|
||||
s2->class != &ziso_stream_uncompress_class))
|
||||
iso_stream_cmp_ino(s1, s2, 1);
|
||||
|
||||
/* Both streams apply the same treatment to their input streams */
|
||||
return iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0),
|
||||
iso_stream_get_input_stream(s2, 0), 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user