4
0
mirror of https://github.com/QuasarApp/zip.git synced 2025-04-30 06:14:42 +00:00

Minor API changes ()

For public API s/zip_total_entries/zip_entries_total/
This commit is contained in:
Kuba Podgórski 2021-03-11 22:43:34 +01:00 committed by GitHub
parent 9cf2857e82
commit d01ec45d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 685 additions and 689 deletions

@ -168,7 +168,7 @@ struct zip_t *zip = zip_stream_open(NULL, 0, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w')
zip_entry_write(zip, inbuf, strlen(inbuf));
}
zip_entry_close(zip);
/* copy compressed stream into outbuf */
zip_stream_copy(zip, (void **)&outbuf, &outbufsize);
}
@ -199,7 +199,7 @@ free(buf);
* List of all zip entries
```c
struct zip_t *zip = zip_open("foo.zip", 0, 'r');
int i, n = zip_total_entries(zip);
int i, n = zip_entries_total(zip);
for (i = 0; i < n; ++i) {
zip_entry_openbyindex(zip, i);
{

1361
src/zip.c

File diff suppressed because it is too large Load Diff

@ -268,8 +268,7 @@ zip_entry_extract(struct zip_t *zip,
* @return the return code - the number of entries on success, negative number
* (< 0) on error.
*/
extern int zip_total_entries(struct zip_t *zip);
extern int zip_entries_total(struct zip_t *zip);
/**
* Deletes zip archive entries.

@ -71,7 +71,7 @@ MU_TEST(test_append) {
mu_assert_int_eq(0, zip_entry_close(zip));
++total_entries;
mu_assert_int_eq(total_entries, zip_total_entries(zip));
mu_assert_int_eq(total_entries, zip_entries_total(zip));
zip_close(zip);
}

@ -190,7 +190,7 @@ MU_TEST(test_list_entries) {
struct zip_t *zip = zip_open(ZIPNAME, 0, 'r');
mu_check(zip != NULL);
int i = 0, n = zip_total_entries(zip);
int i = 0, n = zip_entries_total(zip);
for (; i < n; ++i) {
mu_check(0 == zip_entry_openbyindex(zip, i));
fprintf(stdout, "[%d]: %s", i, zip_entry_name(zip));
@ -232,7 +232,7 @@ MU_TEST(test_entries_delete) {
mu_check(0 > zip_entry_open(zip, "delete/file.2"));
mu_check(0 == zip_entry_close(zip));
mu_assert_int_eq(total_entries - 5, zip_total_entries(zip));
mu_assert_int_eq(total_entries - 5, zip_entries_total(zip));
mu_check(0 == zip_entry_open(zip, "delete/file.4"));