fixed bug where disk size was written without the header included
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4040
This commit is contained in:
parent
2f47baee55
commit
166a2b8a43
@ -584,6 +584,7 @@ int main(int argc, char *argv[])
|
|||||||
size_t size;
|
size_t size;
|
||||||
Bytef *zcmp;
|
Bytef *zcmp;
|
||||||
uLong disksize;
|
uLong disksize;
|
||||||
|
size_t header_size;
|
||||||
int err = Z_OK;
|
int err = Z_OK;
|
||||||
|
|
||||||
/* reuse this memory block! */
|
/* reuse this memory block! */
|
||||||
@ -600,8 +601,9 @@ int main(int argc, char *argv[])
|
|||||||
(unsigned char *)pOrig->base + sizeof(sp_file_hdr_t),
|
(unsigned char *)pOrig->base + sizeof(sp_file_hdr_t),
|
||||||
pHdr->dataoffs - sizeof(sp_file_hdr_t));
|
pHdr->dataoffs - sizeof(sp_file_hdr_t));
|
||||||
|
|
||||||
size = pHdr->imagesize - pHdr->dataoffs;
|
header_size = pHdr->dataoffs;
|
||||||
proper = (unsigned char *)pOrig->base + pHdr->dataoffs;
|
size = pHdr->imagesize - header_size;
|
||||||
|
proper = (unsigned char *)pOrig->base + header_size;
|
||||||
|
|
||||||
/* get initial size estimate */
|
/* get initial size estimate */
|
||||||
pHdr->disksize = (uint32_t)compressBound(pHdr->imagesize);
|
pHdr->disksize = (uint32_t)compressBound(pHdr->imagesize);
|
||||||
@ -621,11 +623,11 @@ int main(int argc, char *argv[])
|
|||||||
proper,
|
proper,
|
||||||
size);
|
size);
|
||||||
} else {
|
} else {
|
||||||
pHdr->disksize = (uint32_t)disksize;
|
pHdr->disksize = (uint32_t)disksize + header_size;
|
||||||
pHdr->compression = SPFILE_COMPRESSION_GZ;
|
pHdr->compression = SPFILE_COMPRESSION_GZ;
|
||||||
memfile_write(bin_file,
|
memfile_write(bin_file,
|
||||||
(unsigned char *)zcmp,
|
(unsigned char *)zcmp,
|
||||||
pHdr->disksize);
|
disksize);
|
||||||
free(zcmp);
|
free(zcmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user