// - perhaps common encodings to objects ("UTF8" -> wxConvUTF8)
// - move wxEncodingConverter meat in here
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
#include "wx/msw/registry.h"
// this should work if M$ Internet Exploiter is installed
static long CharsetToCodepage(const wxChar *name)
};
#endif
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
class CP_CharSet : public wxCharacterSet
{
public:
{
size_t len =
MultiByteToWideChar(CodePage, 0, psz, -1, buf, buf ? n : 0);
- //VS: returns # of written chars for buf!=NULL and *size*
+ //VS: returns # of written chars for buf!=NULL and *size*
// needed buffer for buf==NULL
return len ? (buf ? len : len-1) : (size_t)-1;
}
{
size_t len = WideCharToMultiByte(CodePage, 0, psz, -1, buf,
buf ? n : 0, NULL, NULL);
- //VS: returns # of written chars for buf!=NULL and *size*
+ //VS: returns # of written chars for buf!=NULL and *size*
// needed buffer for buf==NULL
return len ? (buf ? len : len-1) : (size_t)-1;
}
public:
long CodePage;
};
-#endif
+#endif // __WIN32__
+
+#if wxUSE_FONTMAP
class EC_CharSet : public wxCharacterSet
{
wxEncodingConverter m2w, w2m;
};
+#endif // wxUSE_FONTMAP
+
static wxCharacterSet *wxGetCharacterSet(const wxChar *name)
{
wxCharacterSet *cset = NULL;
}
}
- if (cset && cset->usable()) return cset;
+ if (cset && cset->usable())
+ return cset;
+
if (cset)
{
delete cset;
cset = NULL;
}
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
cset = new CP_CharSet(name); // may take NULL
if (cset->usable())
return cset;
delete cset;
#endif // __WIN32__
+#if wxUSE_FONTMAP
cset = new EC_CharSet(name);
if (cset->usable())
return cset;
+#endif // wxUSE_FONTMAP
delete cset;
wxLogError(_("Unknown encoding '%s'!"), name);
SetName(name);
}
- m_cset = wxGetCharacterSet(m_name);
+ // wxGetCharacterSet() complains about NULL name
+ m_cset = m_name ? wxGetCharacterSet(m_name) : NULL;
m_deferred = FALSE;
}
}
class EC_CharSetConverter
{
public:
- EC_CharSetConverter(EC_CharSet*from,EC_CharSet*to)
+ EC_CharSetConverter(EC_CharSet* from,EC_CharSet* to)
{ cnv.Init(from->enc,to->enc); }
- size_t Convert(char*buf, const char*psz, size_t n)
+ size_t Convert(char* buf, const char* psz, size_t n)
{
size_t inbuf = strlen(psz);
if (buf) cnv.Convert(psz,buf);