typedef char tchar;
#endif
+#ifdef __WXWINCE__
+#undef LINKAGEMODE
+#define LINKAGEMODE __cdecl
+#endif
+
static wxUint16* LINKAGEMODE GetEncTable(wxFontEncoding enc)
{
for (int i = 0; encodings_list[i].table != NULL; i++)
wxUint8 c;
} CharsetItem;
-
-
extern "C" int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2)
{
return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u );
m_Table[out_tbl[i]] = (tchar)(128 + i);
m_UnicodeInput = TRUE;
- return TRUE;
}
-
- else
+ else // input !Unicode
{
if ((in_tbl = GetEncTable(input_enc)) == NULL) return FALSE;
if (output_enc != wxFONTENCODING_UNICODE)
for (i = 0; i < 128; i++) m_Table[128 + i] = (tchar)in_tbl[i];
return TRUE;
}
- else
+ // FIXME: write a substitute for bsearch
+#ifndef __WXWINCE__
+ else // output !Unicode
{
CharsetItem *rev = BuildReverseTable(out_tbl);
CharsetItem *item;
}
delete[] rev;
- return TRUE;
}
+#endif // !__WXWINCE__
}
+
+ return TRUE;
}
wxString s;
const wxChar *i;
- wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_MSG(m_Table != NULL, s,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
if (m_UnicodeInput)
{
};
-
+static bool FindEncoding(const wxFontEncodingArray& arr, wxFontEncoding f)
+{
+ for (wxFontEncodingArray::const_iterator it = arr.begin(), en = arr.end();
+ it != en; ++it)
+ if (*it == f)
+ return true;
+ return false;
+}
wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding enc, int platform)
{
if (EquivalentEncodings[clas][i][e] == enc)
{
for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++)
- if (*f == enc) arr.Add(enc);
+ if (*f == enc) arr.push_back(enc);
for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++)
- if (arr.Index(*f) == wxNOT_FOUND) arr.Add(*f);
+ if (!FindEncoding(arr, *f)) arr.push_back(*f);
i = NUM_OF_PLATFORMS/*hack*/; break;
}
clas++;
{
for (j = 0; j < NUM_OF_PLATFORMS; j++)
for (f = EquivalentEncodings[clas][j]; *f != STOP; f++)
- if (arr.Index(*f) == wxNOT_FOUND) arr.Add(*f);
+ if (!FindEncoding(arr, *f)) arr.push_back(*f);
i = NUM_OF_PLATFORMS/*hack*/; break;
}
clas++;