applied patch 404136 which is supposed to fix BC5.5 crashes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -206,7 +206,7 @@ private:
|
|||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
// calculate the hash value of given string
|
// calculate the hash value of given string
|
||||||
static inline size_t32 GetHash(const char *sz);
|
static size_t32 GetHash(const char *sz);
|
||||||
// big<->little endian
|
// big<->little endian
|
||||||
inline size_t32 Swap(size_t32 ui) const;
|
inline size_t32 Swap(size_t32 ui) const;
|
||||||
|
|
||||||
@@ -436,19 +436,17 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const
|
|||||||
|
|
||||||
size_t32 nIncr = 1 + (nHashVal % (m_nHashSize - 2));
|
size_t32 nIncr = 1 + (nHashVal % (m_nHashSize - 2));
|
||||||
|
|
||||||
#if defined(__VISAGECPP__)
|
for ( ;; ) {
|
||||||
// VA just can't stand while(1) or while(TRUE)
|
|
||||||
bool bOs2var = TRUE;
|
|
||||||
while(bOs2var) {
|
|
||||||
#else
|
|
||||||
while (1) {
|
|
||||||
#endif
|
|
||||||
size_t32 nStr = Swap(m_pHashTable[nIndex]);
|
size_t32 nStr = Swap(m_pHashTable[nIndex]);
|
||||||
if ( nStr == 0 )
|
if ( nStr == 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( strcmp(szOrig, StringAtOfs(m_pOrigTable, nStr - 1)) == 0 )
|
if ( strcmp(szOrig, StringAtOfs(m_pOrigTable, nStr - 1)) == 0 ) {
|
||||||
return StringAtOfs(m_pTransTable, nStr - 1);
|
// work around for BC++ 5.5 bug: without a temp var, the optimizer
|
||||||
|
// breaks the code and the return value is incorrect
|
||||||
|
const char *tmp = StringAtOfs(m_pTransTable, nStr - 1);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
if ( nIndex >= m_nHashSize - nIncr)
|
if ( nIndex >= m_nHashSize - nIncr)
|
||||||
nIndex -= m_nHashSize - nIncr;
|
nIndex -= m_nHashSize - nIncr;
|
||||||
@@ -467,8 +465,11 @@ const char *wxMsgCatalog::GetString(const char *szOrig) const
|
|||||||
top = current;
|
top = current;
|
||||||
else if ( res > 0 )
|
else if ( res > 0 )
|
||||||
bottom = current + 1;
|
bottom = current + 1;
|
||||||
else // found!
|
else { // found!
|
||||||
return StringAtOfs(m_pTransTable, current);
|
// work around the same BC++ 5.5 bug as above
|
||||||
|
const char *tmp = StringAtOfs(m_pTransTable, current);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,11 +490,16 @@ void wxMsgCatalog::ConvertEncoding()
|
|||||||
|
|
||||||
// first, find encoding header:
|
// first, find encoding header:
|
||||||
const char *hdr = StringAtOfs(m_pOrigTable, 0);
|
const char *hdr = StringAtOfs(m_pOrigTable, 0);
|
||||||
if (hdr == NULL) return; // not supported by this catalog, does not have non-fuzzy header
|
if ( hdr == NULL || hdr[0] != 0 ) {
|
||||||
if (hdr[0] != 0) return; // ditto
|
// not supported by this catalog, does not have non-fuzzy header
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* we support catalogs with header (msgid "") that is _not_ marked as "#, fuzzy" (otherwise
|
/*
|
||||||
the string would not be included into compiled catalog) */
|
we support catalogs with header (msgid "") that is _not_ marked as "#,
|
||||||
|
fuzzy" (otherwise the string would not be included into compiled
|
||||||
|
catalog)
|
||||||
|
*/
|
||||||
wxString header(StringAtOfs(m_pTransTable, 0));
|
wxString header(StringAtOfs(m_pTransTable, 0));
|
||||||
wxString charset;
|
wxString charset;
|
||||||
int pos = header.Find(wxT("Content-Type: text/plain; charset="));
|
int pos = header.Find(wxT("Content-Type: text/plain; charset="));
|
||||||
@@ -519,7 +525,7 @@ void wxMsgCatalog::ConvertEncoding()
|
|||||||
converter.Init(enc, a[0]);
|
converter.Init(enc, a[0]);
|
||||||
for (size_t i = 0; i < m_numStrings; i++)
|
for (size_t i = 0; i < m_numStrings; i++)
|
||||||
converter.Convert((char*)StringAtOfs(m_pTransTable, i));
|
converter.Convert((char*)StringAtOfs(m_pTransTable, i));
|
||||||
#endif
|
#endif // wxUSE_GUI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user