Zlib: Funktioniert mit mingw nicht richtig



  • bool dtZipManager::OpenZip(const char* archive, const char* passwd)
    {
        this->CloseZip();
    
        // Copy stuff
        m_archivename = archive;
        if (!passwd && !m_password.empty())
        {
            m_password.clear();
        }
        else
        {
            m_password = passwd;
        }
    
        for (u32 i = 0; i < strlen(archive); i++)
        {
            if (m_archivename[i] == dtEvilSep)
            {
                m_archivename[i] = dtPathSep;
            }
        }
    
        m_zip = unzOpen(m_archivename.c_str());
        if (!m_zip)
        {
            return false;
        }
        return true;
    }
    
    dtMemoryHandle* dtZipManager::Decompress(const char* file)
    {
        // Return if there is no file open
        if (!m_zip)
        {
            return NULL;
        }
    
        dtMemoryHandle* handle = NULL;
        unz_file_info file_info;
        int done = 0;
        char current[_MAX_PATH];
    
        done = unzGoToFirstFile(m_zip);
        while(done == UNZ_OK)
        {
            unzGetCurrentFileInfo(m_zip, &file_info, current, sizeof(current), 0, 0, 0, 0);
    
            for(int i=0; current[i]; i++)
            {
                if(current[i]== dtEvilSep)
                {
                    current[i]= dtPathSep;
                }
            }
    
            if (CompareFileName(current, file) == true)
            {
                // If no password supplied, this opens the File normally.
                if(unzOpenCurrentFilePassword(m_zip, m_password.empty() ? NULL : m_password.c_str()) == UNZ_OK)
                {
                    handle = new dtMemoryHandle(file_info.uncompressed_size);
                    assert(handle->data != NULL);
    
                    unzReadCurrentFile(m_zip, handle->data, handle->size);
                    assert(handle->data);
                    handle->file = file;
                    unzCloseCurrentFile(m_zip);
    
                    return handle;
                }
            }
    
            done=unzGoToNextFile(m_zip);
        }
        return NULL;
    }
    

    Das ist der Code den ich verwende um eine Datei in den Speicher zu entpacken mit den zip-utils. Mit dem MSVC2008 Express funktioniert der Code wunderbar. Mit dem mingw allerings habe ich grausame Ergebnisse was Texturen angeht. Da werden weisse Bilder schwarz und Farben invertieren etc...
    Ist euch da was bekannt oder sehr Ihr vllt nen Fehler im Code?
    rya.

    ps.: Der komplette Code kompiliert ohne Warnungen (-WAll), mal von "No Newline at the end of file" abgesehen bei ein paar headern... Als IDE für den mingw nehme ich Code::Blocks.



  • Keiner eine idee?



  • Noch ein Push, das Problem treibt mich in den Wahnsinn 😞


Anmelden zum Antworten