# HG changeset patch # User Pascal Bellard # Date 1418245152 -3600 # Node ID 19bb7af3735fd260e3a07c926a220cb4b1a64b75 # Parent ea94058cfe7fcb8f94e58551d65da61a0aa29887 qemu/cloop: fix V0-V2 diff -r ea94058cfe7f -r 19bb7af3735f qemu/stuff/cloop.u --- a/qemu/stuff/cloop.u Tue Dec 09 18:22:52 2014 +0100 +++ b/qemu/stuff/cloop.u Wed Dec 10 21:59:12 2014 +0100 @@ -30,7 +30,7 @@ + // return (char *) "128BE accelerated knoppix 1.0"; + } + else { /* V2.0 */ -+ uint64_t last = be64_to_cpu(ofs64[n]); ++ uint64_t last = be64_to_cpu(ofs64[n - 1]); + while (n--) { + offsets[n].size = last - + (offsets[n].offset = be64_to_cpu(ofs64[n])); @@ -40,7 +40,7 @@ + } + } + else if (ofs32[1] == 0) { /* V1.0 */ -+ uint64_t last = le64_to_cpu(ofs64[n]); ++ uint64_t last = le64_to_cpu(ofs64[n - 1]); + while (n--) { + offsets[n].size = last - + (offsets[n].offset = le64_to_cpu(ofs64[n])); @@ -49,7 +49,7 @@ + // return (char *) "64LE v1.0"; + } + else if (ntohl(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */ -+ uint64_t last = ntohl(ofs32[n]); ++ uint64_t last = ntohl(ofs32[n - 1]); + while (n--) { + offsets[n].size = last - + (offsets[n].offset = ntohl(ofs32[n]));