wok-current rev 17361
linux-cloop: fix v0-v2
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Nov 19 11:46:06 2014 +0100 (2014-11-19) |
parents | 53bf1ccff1a1 |
children | 6f9c3a54a7eb |
files | linux-cloop/stuff/cloop.u linux64-cloop/stuff/cloop.u |
line diff
1.1 --- a/linux-cloop/stuff/cloop.u Tue Nov 18 18:21:05 2014 -0500 1.2 +++ b/linux-cloop/stuff/cloop.u Wed Nov 19 11:46:06 2014 +0100 1.3 @@ -32,7 +32,7 @@ 1.4 + return (char *) "128BE accelerated knoppix 1.0"; 1.5 + } 1.6 + else { /* V2.0 */ 1.7 -+ loff_t last = __be64_to_cpu(ofs64[n]); 1.8 ++ loff_t last = __be64_to_cpu(ofs64[n - 1]); 1.9 + while (n--) { 1.10 + offsets[n].size = last - 1.11 + (offsets[n].offset = __be64_to_cpu(ofs64[n])); 1.12 @@ -42,7 +42,7 @@ 1.13 + } 1.14 + } 1.15 + else if (ofs32[1] == 0) { /* V1.0 */ 1.16 -+ loff_t last = __le64_to_cpu(ofs64[n]); 1.17 ++ loff_t last = __le64_to_cpu(ofs64[n - 1]); 1.18 + while (n--) { 1.19 + offsets[n].size = last - 1.20 + (offsets[n].offset = __le64_to_cpu(ofs64[n])); 1.21 @@ -51,7 +51,7 @@ 1.22 + return (char *) "64LE v1.0"; 1.23 + } 1.24 + else if (ntohl(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */ 1.25 -+ loff_t last = ntohl(ofs32[n]); 1.26 ++ loff_t last = ntohl(ofs32[n - 1]); 1.27 + while (n--) { 1.28 + offsets[n].size = last - 1.29 + (offsets[n].offset = ntohl(ofs32[n])); 1.30 @@ -239,7 +239,7 @@ 1.31 int i; 1.32 - for(i=0;i<total_offsets-1;i++) 1.33 + char *version = build_index(clo->offsets, ntohl(clo->head.num_blocks)); 1.34 -+ for(i=0;i<total_offsets;i++) 1.35 ++ for(i=0,clo->largest_block=0;i<total_offsets;i++) 1.36 { 1.37 - loff_t d=be64_to_cpu(clo->offsets[i+1]) - be64_to_cpu(clo->offsets[i]); 1.38 - clo->largest_block=MAX(clo->largest_block,d);
2.1 --- a/linux64-cloop/stuff/cloop.u Tue Nov 18 18:21:05 2014 -0500 2.2 +++ b/linux64-cloop/stuff/cloop.u Wed Nov 19 11:46:06 2014 +0100 2.3 @@ -32,7 +32,7 @@ 2.4 + return (char *) "128BE accelerated knoppix 1.0"; 2.5 + } 2.6 + else { /* V2.0 */ 2.7 -+ loff_t last = __be64_to_cpu(ofs64[n]); 2.8 ++ loff_t last = __be64_to_cpu(ofs64[n - 1]); 2.9 + while (n--) { 2.10 + offsets[n].size = last - 2.11 + (offsets[n].offset = __be64_to_cpu(ofs64[n])); 2.12 @@ -42,7 +42,7 @@ 2.13 + } 2.14 + } 2.15 + else if (ofs32[1] == 0) { /* V1.0 */ 2.16 -+ loff_t last = __le64_to_cpu(ofs64[n]); 2.17 ++ loff_t last = __le64_to_cpu(ofs64[n - 1]); 2.18 + while (n--) { 2.19 + offsets[n].size = last - 2.20 + (offsets[n].offset = __le64_to_cpu(ofs64[n])); 2.21 @@ -51,7 +51,7 @@ 2.22 + return (char *) "64LE v1.0"; 2.23 + } 2.24 + else if (ntohl(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */ 2.25 -+ loff_t last = ntohl(ofs32[n]); 2.26 ++ loff_t last = ntohl(ofs32[n - 1]); 2.27 + while (n--) { 2.28 + offsets[n].size = last - 2.29 + (offsets[n].offset = ntohl(ofs32[n])); 2.30 @@ -239,7 +239,7 @@ 2.31 int i; 2.32 - for(i=0;i<total_offsets-1;i++) 2.33 + char *version = build_index(clo->offsets, ntohl(clo->head.num_blocks)); 2.34 -+ for(i=0;i<total_offsets;i++) 2.35 ++ for(i=0,clo->largest_block=0;i<total_offsets;i++) 2.36 { 2.37 - loff_t d=be64_to_cpu(clo->offsets[i+1]) - be64_to_cpu(clo->offsets[i]); 2.38 - clo->largest_block=MAX(clo->largest_block,d);