(blind) fix for valgrind error

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-10 09:23:47 +00:00
parent 5048c832bb
commit 2b6d8c00fc

View File

@@ -644,14 +644,12 @@ void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename,
void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& filename) void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& filename)
{ {
wxTextFile textfile(filename); wxTextFile textfile(filename);
#if defined(__WXGTK20__) && wxUSE_UNICODE
if ( !textfile.Open( wxConvUTF8) )
#else
if ( !textfile.Open() ) if ( !textfile.Open() )
#endif
return; return;
wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"),
filename.c_str()); wxLogTrace(TRACE_MIME,
wxT("--- Opened Gnome file %s ---"),
filename.c_str());
// values for the entry being parsed // values for the entry being parsed
wxString curMimeType, curExtList; wxString curMimeType, curExtList;
@@ -680,8 +678,9 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
// end of the entry // end of the entry
if ( !!curMimeType && !!curExtList ) if ( !!curMimeType && !!curExtList )
{ {
wxLogTrace(TRACE_MIME, wxT("--- At end of Gnome file finding mimetype %s ---"), wxLogTrace(TRACE_MIME,
curMimeType.c_str()); wxT("--- At end of Gnome file finding mimetype %s ---"),
curMimeType.c_str());
AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString);
} }
@@ -703,20 +702,20 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
// this is a field=value ling // this is a field=value ling
pc++; // skip leading TAB pc++; // skip leading TAB
static const int lenField = 4; // strlen("ext:") static const int lenField = 5; // strlen("ext: ")
if ( wxStrncmp(pc, wxT("ext:"), lenField) == 0 ) if ( wxStrncmp(pc, wxT("ext: "), lenField) == 0 )
{ {
// skip ' ' which follows and take everything left until the end // skip it and take everything left until the end of line
// of line curExtList = pc + lenField;
curExtList = pc + lenField + 1;
} }
//else: some other field, we don't care //else: some other field, we don't care
} }
else else
{ {
// this is the start of the new section // this is the start of the new section
wxLogTrace(TRACE_MIME, wxT("--- In Gnome file finding mimetype %s ---"), wxLogTrace(TRACE_MIME,
curMimeType.c_str()); wxT("--- In Gnome file finding mimetype %s ---"),
curMimeType.c_str());
if (! curMimeType.empty()) if (! curMimeType.empty())
AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString);