Skip to content

Commit

Permalink
more robust parsing of catalog headers - fixes bug #1119260
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Feb 27, 2005
1 parent 34d2ca3 commit f682e8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions poedit/NEWS
@@ -1,5 +1,6 @@
- added ability to create bookmarks (Olivier Sannier)
- improved status icons (Olivier Sannier)
- more robust parsing of catalog headers
- added more translations:
Galician (Leandro Regueiro)

Expand Down
16 changes: 9 additions & 7 deletions poedit/src/catalog.cpp
@@ -1,14 +1,14 @@

/*
poedit, a wxWindows i18n catalogs editor
---------------
catalog.cpp
Translations catalog
(c) Vaclav Slavik, 1999-2004
(c) Vaclav Slavik, 1999-2005
*/

Expand Down Expand Up @@ -195,17 +195,19 @@ void Catalog::HeaderData::FromString(const wxString& str)
while (tkn.HasMoreTokens())
{
ln = tkn.GetNextToken();
size_t pos = ln.find(_T(": "));
size_t pos = ln.find(_T(':'));
if (pos == wxString::npos)
{
wxLogError(_("Malformed header: '%s'"), ln.c_str());
}
else
{
Entry en;
en.Key = ln.substr(0, pos);
en.Value = ln.substr(pos + 2);
en.Key = wxString(ln.substr(0, pos)).Strip(wxString::both);
en.Value = wxString(ln.substr(pos + 1)).Strip(wxString::both);
m_entries.push_back(en);
wxLogTrace(_T("header"),
_T("%s='%s'"), en.Key.c_str(), en.Value.c_str());
}
}

Expand Down

0 comments on commit f682e8c

Please sign in to comment.