Lots of small changes to prevent glibc from crashing

when converting ansi strings to unicode. After
   this, you can use and display east asian locales
   in wxGTK, which looks sorta funny...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-10-23 17:32:15 +00:00
parent 8dcb2ef2ee
commit f8300041bd
14 changed files with 154 additions and 124 deletions

View File

@@ -43,12 +43,7 @@ public:
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS,
const wxString& name = wxCalendarNameStr) const wxString& name = wxCalendarNameStr);
{
Init();
(void)Create(parent, id, date, pos, size, style, name);
}
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id, wxWindowID id,

View File

@@ -44,7 +44,7 @@ class WXDLLEXPORT wxImageHandler: public wxObject
{ {
public: public:
wxImageHandler() wxImageHandler()
: m_name(""), m_extension(""), m_mime(), m_type(0) : m_name(wxT("")), m_extension(wxT("")), m_mime(), m_type(0)
{ } { }
#if wxUSE_STREAMS #if wxUSE_STREAMS

View File

@@ -25,23 +25,23 @@
class WXDLLEXPORT wxGIFHandler : public wxImageHandler class WXDLLEXPORT wxGIFHandler : public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxGIFHandler)
public: public:
inline wxGIFHandler() inline wxGIFHandler()
{ {
m_name = "GIF file"; m_name = wxT("GIF file");
m_extension = "gif"; m_extension = wxT("gif");
m_type = wxBITMAP_TYPE_GIF; m_type = wxBITMAP_TYPE_GIF;
m_mime = "image/gif"; m_mime = wxT("image/gif");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxGIFHandler)
}; };
#endif #endif

View File

@@ -24,8 +24,6 @@
class WXDLLEXPORT wxIFFHandler : public wxImageHandler class WXDLLEXPORT wxIFFHandler : public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxIFFHandler)
public: public:
wxIFFHandler() wxIFFHandler()
{ {
@@ -33,13 +31,16 @@ public:
m_extension = wxT("iff"); m_extension = wxT("iff");
m_type = wxBITMAP_TYPE_IFF; m_type = wxBITMAP_TYPE_IFF;
m_mime = wxT("image/x-iff"); m_mime = wxT("image/x-iff");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1); virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1);
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=TRUE); virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=TRUE);
virtual bool DoCanRead(wxInputStream& stream); virtual bool DoCanRead(wxInputStream& stream);
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxIFFHandler)
}; };
#endif // wxUSE_IMAGE && wxUSE_IFF #endif // wxUSE_IMAGE && wxUSE_IFF

View File

@@ -23,23 +23,23 @@
#if wxUSE_LIBJPEG #if wxUSE_LIBJPEG
class WXDLLEXPORT wxJPEGHandler: public wxImageHandler class WXDLLEXPORT wxJPEGHandler: public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxJPEGHandler)
public: public:
inline wxJPEGHandler() inline wxJPEGHandler()
{ {
m_name = "JPEG file"; m_name = wxT("JPEG file");
m_extension = "jpg"; m_extension = wxT("jpg");
m_type = wxBITMAP_TYPE_JPEG; m_type = wxBITMAP_TYPE_JPEG;
m_mime = "image/jpeg"; m_mime = wxT("image/jpeg");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxJPEGHandler)
}; };
#endif #endif

View File

@@ -24,23 +24,23 @@
#if wxUSE_PCX #if wxUSE_PCX
class WXDLLEXPORT wxPCXHandler : public wxImageHandler class WXDLLEXPORT wxPCXHandler : public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxPCXHandler)
public: public:
inline wxPCXHandler() inline wxPCXHandler()
{ {
m_name = "PCX file"; m_name = wxT("PCX file");
m_extension = "pcx"; m_extension = wxT("pcx");
m_type = wxBITMAP_TYPE_PCX; m_type = wxBITMAP_TYPE_PCX;
m_mime = "image/pcx"; m_mime = wxT("image/pcx");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif // wxUSE_STREAMS #endif // wxUSE_STREAMS
private:
DECLARE_DYNAMIC_CLASS(wxPCXHandler)
}; };
#endif // wxUSE_PCX #endif // wxUSE_PCX

View File

@@ -23,23 +23,23 @@
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
class WXDLLEXPORT wxPNGHandler: public wxImageHandler class WXDLLEXPORT wxPNGHandler: public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxPNGHandler)
public: public:
inline wxPNGHandler() inline wxPNGHandler()
{ {
m_name = "PNG file"; m_name = wxT("PNG file");
m_extension = "png"; m_extension = wxT("png");
m_type = wxBITMAP_TYPE_PNG; m_type = wxBITMAP_TYPE_PNG;
m_mime = "image/png"; m_mime = wxT("image/png");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxPNGHandler)
}; };
#endif #endif

View File

@@ -23,23 +23,23 @@
#if wxUSE_PNM #if wxUSE_PNM
class WXDLLEXPORT wxPNMHandler : public wxImageHandler class WXDLLEXPORT wxPNMHandler : public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxPNMHandler)
public: public:
inline wxPNMHandler() inline wxPNMHandler()
{ {
m_name = "PNM file"; m_name = wxT("PNM file");
m_extension = "pnm"; m_extension = wxT("pnm");
m_type = wxBITMAP_TYPE_PNM; m_type = wxBITMAP_TYPE_PNM;
m_mime = "image/pnm"; m_mime = wxT("image/pnm");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxPNMHandler)
}; };
#endif #endif

View File

@@ -24,17 +24,14 @@
#if wxUSE_LIBTIFF #if wxUSE_LIBTIFF
class WXDLLEXPORT wxTIFFHandler: public wxImageHandler class WXDLLEXPORT wxTIFFHandler: public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxTIFFHandler)
public: public:
inline wxTIFFHandler() inline wxTIFFHandler()
{ {
m_name = "TIFF file"; m_name = wxT("TIFF file");
m_extension = "tif"; m_extension = wxT("tif");
m_type = wxBITMAP_TYPE_TIF; m_type = wxBITMAP_TYPE_TIF;
m_mime = "image/tiff"; m_mime = wxT("image/tiff");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
@@ -42,6 +39,9 @@ public:
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
virtual int GetImageCount( wxInputStream& stream ); virtual int GetImageCount( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxTIFFHandler)
}; };
#endif #endif

View File

@@ -23,23 +23,23 @@
class WXDLLEXPORT wxXPMHandler : public wxImageHandler class WXDLLEXPORT wxXPMHandler : public wxImageHandler
{ {
DECLARE_DYNAMIC_CLASS(wxXPMHandler)
public: public:
inline wxXPMHandler() inline wxXPMHandler()
{ {
m_name = wxT("XPM file"); m_name = wxT("XPM file");
m_extension = wxT("xpm"); m_extension = wxT("xpm");
m_type = wxBITMAP_TYPE_XPM; m_type = wxBITMAP_TYPE_XPM;
m_mime = wxT("image/xpm"); m_mime = wxT("image/xpm");
}; }
#if wxUSE_STREAMS #if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 ); virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool DoCanRead( wxInputStream& stream ); virtual bool DoCanRead( wxInputStream& stream );
#endif #endif
private:
DECLARE_DYNAMIC_CLASS(wxXPMHandler)
}; };

View File

@@ -371,7 +371,7 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
void wxFileConfig::Init() void wxFileConfig::Init()
{ {
m_pCurrentGroup = m_pCurrentGroup =
m_pRootGroup = new wxFileConfigGroup(NULL, "", this); m_pRootGroup = new wxFileConfigGroup(NULL, wxT(""), this);
m_linesHead = m_linesHead =
m_linesTail = NULL; m_linesTail = NULL;

View File

@@ -2095,7 +2095,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule)
#define LNG(wxlang, canonical, winlang, winsublang, desc) \ #define LNG(wxlang, canonical, winlang, winsublang, desc) \
info.Language = wxlang; \ info.Language = wxlang; \
info.CanonicalName = wxT(canonical); \ info.CanonicalName = wxT(canonical); \
info.Description = desc; \ info.Description = wxT(desc); \
SETWINLANG(info, winlang, winsublang) \ SETWINLANG(info, winlang, winsublang) \
AddLanguage(info); AddLanguage(info);

View File

@@ -155,6 +155,19 @@ wxYearSpinCtrl::wxYearSpinCtrl(wxCalendarCtrl *cal)
// wxCalendarCtrl // wxCalendarCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxCalendarCtrl::wxCalendarCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
Init();
(void)Create(parent, id, date, pos, size, style, name);
}
void wxCalendarCtrl::Init() void wxCalendarCtrl::Init()
{ {
m_comboMonth = NULL; m_comboMonth = NULL;

View File

@@ -364,7 +364,7 @@ bool wxMimeTypesManagerImpl::CheckGnomeDirsExist ()
wxString gnomedir; wxString gnomedir;
wxGetHomeDir( &gnomedir ); wxGetHomeDir( &gnomedir );
wxString sTmp = gnomedir; wxString sTmp = gnomedir;
sTmp = sTmp + "/.gnome"; sTmp = sTmp + wxT("/.gnome");
if (! wxDir::Exists ( sTmp ) ) if (! wxDir::Exists ( sTmp ) )
{ {
if (!wxMkdir ( sTmp )) if (!wxMkdir ( sTmp ))
@@ -373,7 +373,7 @@ bool wxMimeTypesManagerImpl::CheckGnomeDirsExist ()
return FALSE; return FALSE;
} }
} }
sTmp = sTmp + "/mime-info"; sTmp = sTmp + wxT("/mime-info");
if (! wxDir::Exists ( sTmp ) ) if (! wxDir::Exists ( sTmp ) )
{ {
if (!wxMkdir ( sTmp )) if (!wxMkdir ( sTmp ))
@@ -393,11 +393,15 @@ bool wxMimeTypesManagerImpl::WriteGnomeKeyFile(int index, bool delete_index)
wxString gnomedir; wxString gnomedir;
wxGetHomeDir( &gnomedir ); wxGetHomeDir( &gnomedir );
wxMimeTextFile outfile ( gnomedir + "/.gnome/mime-info/user.keys"); wxMimeTextFile outfile ( gnomedir + wxT("/.gnome/mime-info/user.keys"));
// if this fails probably Gnome is not installed ?? // if this fails probably Gnome is not installed ??
// create it anyway as a private mime store // create it anyway as a private mime store
#if defined(__WXGTK20__) && wxUSE_UNICODE
if (! outfile.Open ( wxConvUTF8) )
#else
if (! outfile.Open () ) if (! outfile.Open () )
#endif
{ {
if (delete_index) return FALSE; if (delete_index) return FALSE;
if (!CheckGnomeDirsExist() ) return FALSE; if (!CheckGnomeDirsExist() ) return FALSE;
@@ -462,13 +466,13 @@ bool wxMimeTypesManagerImpl::WriteGnomeKeyFile(int index, bool delete_index)
} }
//sOld should also contain the icon //sOld should also contain the icon
if ( !m_aIcons[index].empty() ) if ( !m_aIcons[index].empty() )
sOld.AddOrReplaceVerb ( wxT( "icon-filename"), m_aIcons[index] ); sOld.AddOrReplaceVerb ( wxT("icon-filename"), m_aIcons[index] );
for (i=0; i < sOld.GetCount(); i++) for (i=0; i < sOld.GetCount(); i++)
{ {
sTmp = sOld.GetVerbCmd(i); sTmp = sOld.GetVerbCmd(i);
sTmp.Replace( wxT("%s"), wxT("%f") ); sTmp.Replace( wxT("%s"), wxT("%f") );
sTmp = wxT ( "\t") + sTmp; sTmp = wxT("\t") + sTmp;
nIndex ++; nIndex ++;
outfile.InsertLine ( sTmp, nIndex ); outfile.InsertLine ( sTmp, nIndex );
} }
@@ -484,7 +488,7 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
wxString gnomedir; wxString gnomedir;
wxGetHomeDir( &gnomedir ); wxGetHomeDir( &gnomedir );
wxMimeTextFile outfile ( gnomedir + "/.gnome/mime-info/user.mime"); wxMimeTextFile outfile ( gnomedir + wxT("/.gnome/mime-info/user.mime"));
// if this fails probably Gnome is not installed ?? // if this fails probably Gnome is not installed ??
// create it anyway as a private mime store // create it anyway as a private mime store
if (! outfile.Open () ) if (! outfile.Open () )
@@ -498,7 +502,7 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
if ( nIndex == wxNOT_FOUND ) if ( nIndex == wxNOT_FOUND )
{ {
outfile.AddLine ( strType ); outfile.AddLine ( strType );
outfile.AddLine ( wxT( "\text:") + m_aExtensions.Item(index) ); outfile.AddLine ( wxT("\text:") + m_aExtensions.Item(index) );
} }
else else
{ {
@@ -510,13 +514,13 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
else else
{// check for next line being the right one to replace ?? {// check for next line being the right one to replace ??
wxString sOld = outfile.GetLine(nIndex+1); wxString sOld = outfile.GetLine(nIndex+1);
if (sOld.Contains(wxT("\text: "))) if (sOld.Contains( wxT("\text: ")))
{ {
outfile.GetLine(nIndex+1) = wxT( "\text: ") + m_aExtensions.Item(index); outfile.GetLine(nIndex+1) = wxT("\text: ") + m_aExtensions.Item(index);
} }
else else
{ {
outfile.InsertLine(wxT( "\text: ") + m_aExtensions.Item(index), nIndex + 1 ); outfile.InsertLine( wxT("\text: ") + m_aExtensions.Item(index), nIndex + 1 );
} }
} }
} }
@@ -528,7 +532,11 @@ bool wxMimeTypesManagerImpl::WriteGnomeMimeFile(int index, bool delete_index)
void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename) void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(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 ---"), wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"),
filename.c_str()); filename.c_str());
@@ -615,7 +623,11 @@ 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 ---"), wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"),
filename.c_str()); filename.c_str());
@@ -630,7 +642,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
if ( nLine < nLineCount ) if ( nLine < nLineCount )
{ {
pc = textfile[nLine].c_str(); pc = textfile[nLine].c_str();
if ( *pc == _T('#') ) if ( *pc == wxT('#') )
{ {
// skip comments // skip comments
continue; continue;
@@ -665,13 +677,13 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
} }
// what do we have here? // what do we have here?
if ( *pc == _T('\t') ) if ( *pc == wxT('\t') )
{ {
// 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 = 4; // strlen("ext:")
if ( wxStrncmp(pc, _T("ext:"), lenField) == 0 ) if ( wxStrncmp(pc, wxT("ext:"), lenField) == 0 )
{ {
// skip ' ' which follows and take everything left until the end // skip ' ' which follows and take everything left until the end
// of line // of line
@@ -690,7 +702,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file
curMimeType.Empty(); curMimeType.Empty();
while ( *pc != _T(':') && *pc != _T('\0') ) while ( *pc != wxT(':') && *pc != wxT('\0') )
{ {
curMimeType += *pc++; curMimeType += *pc++;
} }
@@ -705,7 +717,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeFilesFromDir(const wxString& dirbase)
_T("base directory shouldn't end with a slash") ); _T("base directory shouldn't end with a slash") );
wxString dirname = dirbase; wxString dirname = dirbase;
dirname << _T("/mime-info"); dirname << wxT("/mime-info");
if ( !wxDir::Exists(dirname) ) if ( !wxDir::Exists(dirname) )
return; return;
@@ -715,7 +727,7 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeFilesFromDir(const wxString& dirbase)
return; return;
// we will concatenate it with filename to get the full path below // we will concatenate it with filename to get the full path below
dirname += _T('/'); dirname += wxT('/');
wxString filename; wxString filename;
bool cont = dir.GetFirst(&filename, _T("*.mime"), wxDIR_FILES); bool cont = dir.GetFirst(&filename, _T("*.mime"), wxDIR_FILES);
@@ -742,12 +754,12 @@ void wxMimeTypesManagerImpl::GetGnomeMimeInfo(const wxString& sExtraDir)
{ {
wxArrayString dirs; wxArrayString dirs;
dirs.Add(_T("/usr/share")); dirs.Add(wxT("/usr/share"));
dirs.Add(_T("/usr/local/share")); dirs.Add(wxT("/usr/local/share"));
wxString gnomedir; wxString gnomedir;
wxGetHomeDir( &gnomedir ); wxGetHomeDir( &gnomedir );
gnomedir += _T("/.gnome"); gnomedir += wxT("/.gnome");
dirs.Add( gnomedir ); dirs.Add( gnomedir );
if (!sExtraDir.empty()) dirs.Add( sExtraDir ); if (!sExtraDir.empty()) dirs.Add( sExtraDir );
@@ -2032,7 +2044,11 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
strFileName.c_str()); strFileName.c_str());
wxTextFile file(strFileName); wxTextFile file(strFileName);
#if defined(__WXGTK20__) && wxUSE_UNICODE
if ( !file.Open( wxConvUTF8) )
#else
if ( !file.Open() ) if ( !file.Open() )
#endif
return FALSE; return FALSE;
// the information we extract // the information we extract
@@ -2040,7 +2056,8 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
size_t nLineCount = file.GetLineCount(); size_t nLineCount = file.GetLineCount();
const wxChar *pc = NULL; const wxChar *pc = NULL;
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) { for ( size_t nLine = 0; nLine < nLineCount; nLine++ )
{
if ( pc == NULL ) { if ( pc == NULL ) {
// now we're at the start of the line // now we're at the start of the line
pc = file[nLine].c_str(); pc = file[nLine].c_str();
@@ -2306,7 +2323,11 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
strFileName.c_str()); strFileName.c_str());
wxTextFile file(strFileName); wxTextFile file(strFileName);
#if defined(__WXGTK20__) && wxUSE_UNICODE
if ( !file.Open( wxConvUTF8) )
#else
if ( !file.Open() ) if ( !file.Open() )
#endif
return FALSE; return FALSE;
// indices of MIME types (in m_aTypes) we already found in this file // indices of MIME types (in m_aTypes) we already found in this file