// if the file could not be located, but was *.hhp, than we create
// the content of the hhp-file on the fly and store it for reading
// by the application
// if the file could not be located, but was *.hhp, than we create
// the content of the hhp-file on the fly and store it for reading
// by the application
// Try to open the #SYSTEM-File and create the HHP File out of it
// see http://bonedaddy.net/pabs3/chmspec/0.1.2/Internal.html#SYSTEM
// Try to open the #SYSTEM-File and create the HHP File out of it
// see http://bonedaddy.net/pabs3/chmspec/0.1.2/Internal.html#SYSTEM
- wxString msg ;
- msg.Printf(_T("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) ;
{
tmp = "Contents File=*.hhc\r\n";
out->Write((const void *) tmp, strlen(tmp));
}
{
tmp = "Contents File=*.hhc\r\n";
out->Write((const void *) tmp, strlen(tmp));
}
{
tmp = "Index File=*.hhk\r\n";
out->Write((const void *) tmp, strlen(tmp));
{
tmp = "Index File=*.hhk\r\n";
out->Write((const void *) tmp, strlen(tmp));
{
right=wxString(right.Mid(index+1));
wxLogWarning(_("Link contained '//', converted to absolute link."));
}
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
{
right=wxString(right.Mid(index+1));
wxLogWarning(_("Link contained '//', converted to absolute link."));
}
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
// Open a stream to read the content of the chm-file
s = new wxChmInputStream(leftFilename.GetFullPath(), right, true);
// Open a stream to read the content of the chm-file
s = new wxChmInputStream(leftFilename.GetFullPath(), right, true);
wxString left = GetLeftLocation(spec);
wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();
wxString left = GetLeftLocation(spec);
wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();
{
wxLogError(_("CHM handler currently supports only local files!"));
return wxEmptyString;
}
m_chm = new wxChmTools(wxFileName(nativename));
{
wxLogError(_("CHM handler currently supports only local files!"));
return wxEmptyString;
}
m_chm = new wxChmTools(wxFileName(nativename));
wxString m_found = m_chm->Find(m_pattern);
// now fake around hhp-files which are not existing in projects...
if (m_found.empty() &&
wxString m_found = m_chm->Find(m_pattern);
// now fake around hhp-files which are not existing in projects...
if (m_found.empty() &&
- m_found.Printf(_T("%s#chm:%s.hhp"),
- left.c_str(), m_pattern.BeforeLast(_T('.')).c_str());
+ m_found.Printf(wxT("%s#chm:%s.hhp"),
+ left.c_str(), m_pattern.BeforeLast(wxT('.')).c_str());