]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fs_zip.cpp
don't crash on weird line endings like \r\r\n
[wxWidgets.git] / src / common / fs_zip.cpp
index eefa93f96af4aa7723c2c3a963b003946f0e54f4..b8ef9b69f9abecca8f7595c3117465f4445843ce 100644 (file)
@@ -108,25 +108,36 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l
     s = new wxZipFSInputStream(leftFile);
     if (s && s->IsOk())
     {
+#if wxUSE_DATETIME
+       wxDateTime dtMod;
+#endif // wxUSE_DATETIME
+
        bool found = false;
        while (!found)
        {
            wxZipEntry *ent = s->GetNextEntry();
            if (!ent)
                break;
+
            if (ent->GetInternalName() == right)
+           {
                found = true;
+               dtMod = ent->GetDateTime();
+           }
+
            delete ent;
        }
        if (found)
+       {
            return new wxFSFile(s,
                             left + wxT("#zip:") + right,
                             GetMimeTypeFromExt(location),
                             GetAnchor(location)
 #if wxUSE_DATETIME
-                            , wxDateTime(wxFileModificationTime(left))
+                            , dtMod
 #endif // wxUSE_DATETIME
                             );
+       }
     }
 
     delete s;