diff options
Diffstat (limited to 'src/Common/libzip/zip_source_file_stdio.c')
-rw-r--r-- | src/Common/libzip/zip_source_file_stdio.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/Common/libzip/zip_source_file_stdio.c b/src/Common/libzip/zip_source_file_stdio.c index 4a22f78c..c4e3f8a1 100644 --- a/src/Common/libzip/zip_source_file_stdio.c +++ b/src/Common/libzip/zip_source_file_stdio.c @@ -3,7 +3,7 @@ Copyright (C) 2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at <libzip@nih.at> + The authors can be contacted at <info@libzip.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -69,7 +69,7 @@ static zip_source_file_operations_t ops_stdio_read = { ZIP_EXTERN zip_source_t * zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) { if (za == NULL) { - return NULL; + return NULL; } return zip_source_filep_create(file, start, len, &za->error); @@ -79,8 +79,8 @@ zip_source_filep(zip_t *za, FILE *file, zip_uint64_t start, zip_int64_t len) { ZIP_EXTERN zip_source_t * zip_source_filep_create(FILE *file, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { if (file == NULL || length < -1) { - zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; } return zip_source_file_common_new(NULL, file, start, length, NULL, &ops_stdio_read, NULL, error); @@ -97,14 +97,14 @@ zip_int64_t _zip_stdio_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len) { size_t i; if (len > SIZE_MAX) { - len = SIZE_MAX; + len = SIZE_MAX; } if ((i = fread(buf, 1, (size_t)len, ctx->f)) == 0) { - if (ferror((FILE *)ctx->f)) { - zip_error_set(&ctx->error, ZIP_ER_READ, errno); - return -1; - } + if (ferror((FILE *)ctx->f)) { + zip_error_set(&ctx->error, ZIP_ER_READ, errno); + return -1; + } } return (zip_int64_t)i; @@ -115,14 +115,14 @@ bool _zip_stdio_op_seek(zip_source_file_context_t *ctx, void *f, zip_int64_t offset, int whence) { #if ZIP_FSEEK_MAX > ZIP_INT64_MAX if (offset > ZIP_FSEEK_MAX || offset < ZIP_FSEEK_MIN) { - zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW); - return false; + zip_error_set(&ctx->error, ZIP_ER_SEEK, EOVERFLOW); + return false; } #endif if (fseeko((FILE *)f, (off_t)offset, whence) < 0) { - zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); - return false; + zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); + return false; } return true; } @@ -135,10 +135,10 @@ _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) { int ret; if (ctx->fname) { - ret = stat(ctx->fname, &sb); + ret = stat(ctx->fname, &sb); } else { - ret = fstat(fileno((FILE *)ctx->f), &sb); + ret = fstat(fileno((FILE *)ctx->f), &sb); } if (ret < 0) { @@ -146,8 +146,8 @@ _zip_stdio_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) { st->exists = false; return true; } - zip_error_set(&ctx->error, ZIP_ER_READ, errno); - return false; + zip_error_set(&ctx->error, ZIP_ER_READ, errno); + return false; } st->size = (zip_uint64_t)sb.st_size; @@ -171,7 +171,7 @@ _zip_stdio_op_tell(zip_source_file_context_t *ctx, void *f) { off_t offset = ftello((FILE *)f); if (offset < 0) { - zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); + zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); } return offset; @@ -191,18 +191,18 @@ _zip_fopen_close_on_exec(const char *name, bool writeable) { flags = O_CLOEXEC; if (writeable) { - flags |= O_RDWR; + flags |= O_RDWR; } else { - flags |= O_RDONLY; + flags |= O_RDONLY; } /* mode argument needed on Windows */ if ((fd = open(name, flags, 0666)) < 0) { - return NULL; + return NULL; } if ((fp = fdopen(fd, writeable ? "r+b" : "rb")) == NULL) { - return NULL; + return NULL; } return fp; } |