List Archive

Thread

Thread Index

Message

From: Aleksey Timin <atimin%gmail.com@localhost>
To: libzip-discuss%nih.at@localhost
Subject: zip_fopen works with error ZIP_ER_ZLIB on Windows
Date: Tue, 12 Sep 2017 16:15:01 +0000

Hallo everyone,
I have a problem trying to read a ZIP archive by using zip_fopen function:

```C
    auto archive = cip_server.get_archive_name();
    if ((zip_archive = zip_open(archive.c_str(), 0, &err)) == NULL) {
        LOG_ERROR("Error: can't open zip archive.");
        return;
    }

    for (uint32_t i = 0; i < zip_get_num_entries(zip_archive, 0); i++) {
        struct zip_stat zip_stat;

        if (zip_stat_index(zip_archive, i, 0, &zip_stat) == 0) {
            LOG_INFO("Start uncompressing archive file");

            struct zip_file *zip_file = zip_fopen(zip_archive, zip_stat.name, 0);
            if (zip_file == NULL) {
                zip_error_t* error = zip_get_error(zip_archive);
                LOG_ERROR_FMT("ERROR Zip: can't open uncompress entry in archive: %i",  zip_error_code_zip(error));
                zip_error_fini(error);
                has_error = true;
                break;
            }
/* unrelated part of code */
```

This code shows message `ERROR Zip: can't open uncompress entry in archive: 13` after it has tried to read an entry of the archive. I use it on Linux and don't have any problems. but it doesn't work on Windows at all.
I understand that something wrong with zlib but don't have any ideas what to do.


Thanks for your help!
Aleksey

Made by MHonArc.