wok diff qemu/stuff/cloop.u @ rev 23685

sqlite: fix version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 26 16:28:39 2020 +0000 (2020-04-26)
parents f29529667ea4
children 09045e83f959
line diff
     1.1 --- a/qemu/stuff/cloop.u	Sun Apr 26 15:41:58 2020 +0000
     1.2 +++ b/qemu/stuff/cloop.u	Sun Apr 26 16:28:39 2020 +0000
     1.3 @@ -42,11 +42,11 @@
     1.4  +	loff_t    *ofs64 = (loff_t *) offsets;
     1.5  +
     1.6  +	/* v3 64bits bug: v1 assumed */
     1.7 -+	unsigned long	v3_64;
     1.8 ++	unsigned long	v3_64=(n+1)/2;
     1.9  +	loff_t	prev;
    1.10  +
    1.11  +	if (ofs32[0] != 0 && ofs32[1] == 0) {
    1.12 -+		for (v3_64=(n+1)/2, prev=le64_to_cpu(ofs64[v3_64]);
    1.13 ++		for (prev=le64_to_cpu(ofs64[v3_64]);
    1.14  +		     v3_64 > 0 && le64_to_cpu(ofs64[--v3_64]) < prev;
    1.15  +		     prev=le64_to_cpu(ofs64[v3_64]));
    1.16  +	}
    1.17 @@ -55,7 +55,7 @@
    1.18  +		if (ofs32[2]) { /* ACCELERATED KNOPPIX V1.0 */
    1.19  +			while (n--) {
    1.20  +				offsets[n].offset = be64_to_cpu(offsets[n].offset);
    1.21 -+				offsets[n].size = ntohl(offsets[n].size);
    1.22 ++				offsets[n].size = be32_to_cpu(offsets[n].size);
    1.23  +				offsets[n].flags = 0;
    1.24  +        			if (offsets[n].size > 2 * MAX_BLOCK_SIZE)
    1.25  +        				return n+1;
    1.26 @@ -97,11 +97,11 @@
    1.27  +			offsets[n].flags = 0;
    1.28  +		}
    1.29  +	}
    1.30 -+	else if (ntohl(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */
    1.31 -+		loff_t last = ntohl(ofs32[n]);
    1.32 ++	else if (be32_to_cpu(ofs32[0]) == (4*n) + 0x8C) { /* V0.68 */
    1.33 ++		loff_t last = be32_to_cpu(ofs32[n]);
    1.34  +		while (n--) {
    1.35  +			offsets[n].size = last - 
    1.36 -+				(offsets[n].offset = ntohl(ofs32[n])); 
    1.37 ++				(offsets[n].offset = be32_to_cpu(ofs32[n])); 
    1.38  +        		if (offsets[n].size > 2 * MAX_BLOCK_SIZE)
    1.39  +        			return n+1;
    1.40  +			last = offsets[n].offset;
    1.41 @@ -114,7 +114,7 @@
    1.42  +		
    1.43  +		v3_64 = (ofs32[1] == 0) ? 2 : 1;
    1.44  +		for (i = n; i-- > 0; ) {
    1.45 -+			offsets[i].size = ntohl(ofs32[i*v3_64]); 
    1.46 ++			offsets[i].size = be32_to_cpu(ofs32[i*v3_64]); 
    1.47  +			if ((offsets[i].size & 0x80000000) == 0 &&
    1.48  +        		    offsets[i].size > 2 * MAX_BLOCK_SIZE)
    1.49  +        			return i+1;
    1.50 @@ -162,15 +162,15 @@
    1.51  -    int length = strlen(magic_version_2_0);
    1.52  -    if (length > buf_size) {
    1.53  -        length = buf_size;
    1.54 -+    int i, ret = 0, length = buf_size;
    1.55 -+    uint8_t c;
    1.56 ++    int ret = 0, length = buf_size;
    1.57 ++    int i;
    1.58  +
    1.59  +    if (length > 127) {
    1.60  +        length = 127;
    1.61  +    }
    1.62  +    for (i = 0; i < length - sizeof(magic) + 1; i++) {
    1.63  +	if (buf[i] != magic[0]) continue;
    1.64 -+	if (strncmp(buf + i, magic, sizeof(magic) - 1)) continue;
    1.65 ++	if (memcmp(buf + i, magic, sizeof(magic) - 1)) continue;
    1.66  +	ret = 2;
    1.67  +	break;
    1.68       }
    1.69 @@ -179,7 +179,7 @@
    1.70  +    return ret;
    1.71  +}
    1.72  +
    1.73 -+static uint32_t cloop_upack(BDRVCloopState *s, int flag)
    1.74 ++static uint32_t cloop_unpack(BDRVCloopState *s, int flag)
    1.75  +{
    1.76  +    int ret;
    1.77  +    size_t src_pos;