diff options
Diffstat (limited to 'src/Common/libzip/zip_progress.c')
-rw-r--r-- | src/Common/libzip/zip_progress.c | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/src/Common/libzip/zip_progress.c b/src/Common/libzip/zip_progress.c index ddb47c70..e080514b 100644 --- a/src/Common/libzip/zip_progress.c +++ b/src/Common/libzip/zip_progress.c @@ -3,7 +3,7 @@ Copyright (C) 2017-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 @@ -73,7 +73,7 @@ _zip_progress_end(zip_progress_t *progress) { void _zip_progress_free(zip_progress_t *progress) { if (progress == NULL) { - return; + return; } _zip_progress_free_progress_callback(progress); @@ -88,8 +88,8 @@ _zip_progress_new(zip_t *za) { zip_progress_t *progress = (zip_progress_t *)malloc(sizeof(*progress)); if (progress == NULL) { - zip_error_set(&za->error, ZIP_ER_MEMORY, 0); - return NULL; + zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + return NULL; } progress->za = za; @@ -109,7 +109,7 @@ _zip_progress_new(zip_t *za) { static void _zip_progress_free_progress_callback(zip_progress_t *progress) { if (progress->ud_progress_free) { - progress->ud_progress_free(progress->ud_progress); + progress->ud_progress_free(progress->ud_progress); } progress->callback_progress = NULL; @@ -120,7 +120,7 @@ _zip_progress_free_progress_callback(zip_progress_t *progress) { static void _zip_progress_free_cancel_callback(zip_progress_t *progress) { if (progress->ud_cancel_free) { - progress->ud_cancel_free(progress->ud_cancel); + progress->ud_cancel_free(progress->ud_cancel); } progress->callback_cancel = NULL; @@ -150,18 +150,18 @@ _zip_progress_set_cancel_callback(zip_progress_t *progress, zip_cancel_callback int _zip_progress_start(zip_progress_t *progress) { if (progress == NULL) { - return 0; + return 0; } if (progress->callback_progress != NULL) { - progress->last_update = 0.0; - progress->callback_progress(progress->za, 0.0, progress->ud_progress); + progress->last_update = 0.0; + progress->callback_progress(progress->za, 0.0, progress->ud_progress); } if (progress->callback_cancel != NULL) { - if (progress->callback_cancel(progress->za, progress->ud_cancel)) { - return -1; - } + if (progress->callback_cancel(progress->za, progress->ud_cancel)) { + return -1; + } } return 0; @@ -171,7 +171,7 @@ _zip_progress_start(zip_progress_t *progress) { int _zip_progress_subrange(zip_progress_t *progress, double start, double end) { if (progress == NULL) { - return 0; + return 0; } progress->start = start; @@ -185,22 +185,22 @@ _zip_progress_update(zip_progress_t *progress, double sub_current) { double current; if (progress == NULL) { - return 0; + return 0; } if (progress->callback_progress != NULL) { - current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start; + current = ZIP_MIN(ZIP_MAX(sub_current, 0.0), 1.0) * (progress->end - progress->start) + progress->start; - if (current - progress->last_update > progress->precision) { - progress->callback_progress(progress->za, current, progress->ud_progress); - progress->last_update = current; - } + if (current - progress->last_update > progress->precision) { + progress->callback_progress(progress->za, current, progress->ud_progress); + progress->last_update = current; + } } if (progress->callback_cancel != NULL) { - if (progress->callback_cancel(progress->za, progress->ud_cancel)) { - return -1; - } + if (progress->callback_cancel(progress->za, progress->ud_cancel)) { + return -1; + } } return 0; @@ -210,24 +210,24 @@ _zip_progress_update(zip_progress_t *progress, double sub_current) { ZIP_EXTERN int zip_register_progress_callback_with_state(zip_t *za, double precision, zip_progress_callback callback, void (*ud_free)(void *), void *ud) { if (callback != NULL) { - if (za->progress == NULL) { - if ((za->progress = _zip_progress_new(za)) == NULL) { - return -1; - } - } + if (za->progress == NULL) { + if ((za->progress = _zip_progress_new(za)) == NULL) { + return -1; + } + } - _zip_progress_set_progress_callback(za->progress, precision, callback, ud_free, ud); + _zip_progress_set_progress_callback(za->progress, precision, callback, ud_free, ud); } else { - if (za->progress != NULL) { - if (za->progress->callback_cancel == NULL) { - _zip_progress_free(za->progress); - za->progress = NULL; - } - else { - _zip_progress_free_progress_callback(za->progress); - } - } + if (za->progress != NULL) { + if (za->progress->callback_cancel == NULL) { + _zip_progress_free(za->progress); + za->progress = NULL; + } + else { + _zip_progress_free_progress_callback(za->progress); + } + } } return 0; @@ -237,24 +237,24 @@ zip_register_progress_callback_with_state(zip_t *za, double precision, zip_progr ZIP_EXTERN int zip_register_cancel_callback_with_state(zip_t *za, zip_cancel_callback callback, void (*ud_free)(void *), void *ud) { if (callback != NULL) { - if (za->progress == NULL) { - if ((za->progress = _zip_progress_new(za)) == NULL) { - return -1; - } - } + if (za->progress == NULL) { + if ((za->progress = _zip_progress_new(za)) == NULL) { + return -1; + } + } - _zip_progress_set_cancel_callback(za->progress, callback, ud_free, ud); + _zip_progress_set_cancel_callback(za->progress, callback, ud_free, ud); } else { - if (za->progress != NULL) { - if (za->progress->callback_progress == NULL) { - _zip_progress_free(za->progress); - za->progress = NULL; - } - else { - _zip_progress_free_cancel_callback(za->progress); - } - } + if (za->progress != NULL) { + if (za->progress->callback_progress == NULL) { + _zip_progress_free(za->progress); + za->progress = NULL; + } + else { + _zip_progress_free_cancel_callback(za->progress); + } + } } return 0; @@ -278,16 +278,16 @@ zip_register_progress_callback(zip_t *za, zip_progress_callback_t progress_callb struct legacy_ud *ud; if (progress_callback == NULL) { - zip_register_progress_callback_with_state(za, 0, NULL, NULL, NULL); + zip_register_progress_callback_with_state(za, 0, NULL, NULL, NULL); } if ((ud = (struct legacy_ud *)malloc(sizeof(*ud))) == NULL) { - return; + return; } ud->callback = progress_callback; if (zip_register_progress_callback_with_state(za, 0.001, _zip_legacy_progress_callback, free, ud) < 0) { - free(ud); + free(ud); } } |