@@ -381,7 +381,7 @@ static int zstd_step(void* state, void* buffer, size_t size)
int copyfile(int fdin, void *out, unsigned int nbytes, unsigned long *offs, unsigned long long seek,
int skip_file, int __attribute__ ((__unused__)) compressed,
- uint32_t *checksum, unsigned char *hash, int encrypted, const char *imgivt, writeimage callback)
+ uint32_t *checksum, unsigned char *hash, bool encrypted, const char *imgivt, writeimage callback)
{
unsigned int percent, prevpercent = 0;
int ret = 0;
@@ -713,7 +713,7 @@ int extract_sw_description(int fd, const char *descfile, off_t *offs, bool encry
close(fdout);
return -1;
}
- if (copyfile(fd, &fdout, fdh.size, &offset, 0, 0, 0, &checksum, NULL, encrypted ? 1 : 0, NULL, NULL) < 0) {
+ if (copyfile(fd, &fdout, fdh.size, &offset, 0, 0, 0, &checksum, NULL, encrypted, NULL, NULL) < 0) {
ERROR("%s corrupted or not valid", descfile);
close(fdout);
return -1;
@@ -839,7 +839,7 @@ int cpio_scan(int fd, struct swupdate_cfg *cfg, off_t start)
* we do not have to provide fdout
*/
if (copyfile(fd, NULL, fdh.size, &offset, 0, 1, 0, &checksum, img ? img->sha256 : NULL,
- 0, NULL, NULL) != 0) {
+ false, NULL, NULL) != 0) {
ERROR("invalid archive");
return -1;
}
@@ -103,7 +103,7 @@ static int extract_file_to_tmp(int fd, const char *fname, unsigned long *poffs,
return -1;
if (copyfile(fd, &fdout, fdh.size, poffs, 0, 0, 0, &checksum, NULL,
- encrypted ? 1 : 0, NULL, NULL) < 0) {
+ encrypted, NULL, NULL) < 0) {
close(fdout);
return -1;
}
@@ -221,7 +221,7 @@ static int extract_files(int fd, struct swupdate_cfg *software)
fdout = openfileoutput(img->extract_file);
if (fdout < 0)
return -1;
- if (copyfile(fd, &fdout, fdh.size, &offset, 0, 0, 0, &checksum, img->sha256, 0, NULL, NULL) < 0) {
+ if (copyfile(fd, &fdout, fdh.size, &offset, 0, 0, 0, &checksum, img->sha256, false, NULL, NULL) < 0) {
close(fdout);
return -1;
}
@@ -233,7 +233,7 @@ static int extract_files(int fd, struct swupdate_cfg *software)
break;
case SKIP_FILE:
- if (copyfile(fd, &fdout, fdh.size, &offset, 0, skip, 0, &checksum, NULL, 0, NULL, NULL) < 0) {
+ if (copyfile(fd, &fdout, fdh.size, &offset, 0, skip, 0, &checksum, NULL, false, NULL, NULL) < 0) {
return -1;
}
if (!swupdate_verify_chksum(checksum, fdh.chksum)) {
@@ -181,7 +181,7 @@ static int copy_raw_image(struct img_type *img,
0, /* no compressed */
&checksum,
0, /* no sha256 */
- 0, /* no encrypted */
+ false, /* no encrypted */
NULL, /* no IVT */
NULL);
@@ -106,7 +106,7 @@ static int readback_postinst(struct img_type *img)
0, /* no compressed */
NULL, /* no checksum */
hash,
- 0, /* no encrypted */
+ false, /* no encrypted */
NULL, /* no IVT */
NULL); /* no callback */
if (status == 0) {
@@ -81,7 +81,7 @@ struct img_type {
int provided;
int compressed;
int preserve_attributes; /* whether to preserve attributes in archives */
- int is_encrypted;
+ bool is_encrypted;
char ivt_ascii[33];
int install_directly;
int is_script;
@@ -189,7 +189,7 @@ strlcpy(char *dst, const char * src, size_t size);
int copyfile(int fdin, void *out, unsigned int nbytes, unsigned long *offs,
unsigned long long seek,
int skip_file, int compressed, uint32_t *checksum,
- unsigned char *hash, int encrypted, const char *imgivt, writeimage callback);
+ unsigned char *hash, bool encrypted, const char *imgivt, writeimage callback);
int copyimage(void *out, struct img_type *img, writeimage callback);
int extract_sw_description(int fd, const char *descfile, off_t *offs, bool encrypted);
off_t extract_next_file(int fd, int fdout, off_t start, int compressed,
@@ -82,7 +82,7 @@ static void sw_append_stream(struct img_type *img, const char *key,
if (!strcmp(key, "sha256"))
ascii_to_hash(img->sha256, value);
if (!strcmp(key, "encrypted"))
- img->is_encrypted = 1;
+ img->is_encrypted = true;
if (!strcmp(key, "compressed")) {
if (value != NULL) {
if (!strcmp(value, "zlib")) {
Calling copyfile the parameter "encrypted" is used as bool and not as int. Replace type in function and where it is called. Signed-off-by: Stefano Babic <sbabic@denx.de> --- core/cpio_utils.c | 6 +++--- core/stream_interface.c | 6 +++--- handlers/raw_handler.c | 2 +- handlers/readback_handler.c | 2 +- include/swupdate.h | 2 +- include/util.h | 2 +- parser/parse_external.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-)