X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..3225a4b8b8656f25dac6cb20684a3c2c273cf796:/src/html/chm.cpp?ds=sidebyside diff --git a/src/html/chm.cpp b/src/html/chm.cpp index 6eb0e21dac..3d6ad7d60c 100644 --- a/src/html/chm.cpp +++ b/src/html/chm.cpp @@ -619,8 +619,11 @@ wxChmInputStream::CreateHHPStream() switch (code) { case 0: // CONTENTS_FILE - tmp = "Contents file="; - hhc=true; + if (len) + { + tmp = "Contents file="; + hhc=true; + } break; case 1: // INDEX_FILE tmp = "Index file="; @@ -649,9 +652,10 @@ wxChmInputStream::CreateHHPStream() // LCID at position 0 wxUint32 dummy = *((wxUint32 *)(structptr+0)) ; wxUint32 lcid = wxUINT32_SWAP_ON_BE( dummy ) ; - wxString msg ; - msg.Printf(wxT("Language=0x%X\r\n"),lcid) ; - out->Write(msg.c_str() , msg.length() ) ; + char msg[64]; + int len = sprintf(msg, "Language=0x%X\r\n", lcid) ; + if (len > 0) + out->Write(msg, len) ; } break ; default: @@ -838,6 +842,8 @@ wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), } wxFileName leftFilename = wxFileSystem::URLToFileName(left); + if (!leftFilename.FileExists()) + return NULL; // Open a stream to read the content of the chm-file s = new wxChmInputStream(leftFilename.GetFullPath(), right, true); @@ -848,7 +854,7 @@ wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), left + wxT("#chm:") + right, wxEmptyString, GetAnchor(location), - wxDateTime(wxFileModificationTime(left))); + wxDateTime(leftFilename.GetModificationTime())); } delete s;