Don't use size_t for plural forms parameter.
size_t should be used for size of objects, which wxGetTranslation() and wxTranslations::GetString() 'n' argument isn't -- it's just a regular integer. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -302,7 +302,7 @@ public:
|
||||
// plural form version of the same:
|
||||
const wxString& GetString(const wxString& origString,
|
||||
const wxString& origString2,
|
||||
size_t n,
|
||||
unsigned n,
|
||||
const wxString& domain = wxEmptyString) const
|
||||
{
|
||||
return wxGetTranslation(origString, origString2, n, domain);
|
||||
|
@@ -102,7 +102,7 @@ public:
|
||||
const wxString& domain = wxEmptyString) const;
|
||||
const wxString& GetString(const wxString& origString,
|
||||
const wxString& origString2,
|
||||
size_t n,
|
||||
unsigned n,
|
||||
const wxString& domain = wxEmptyString) const;
|
||||
|
||||
wxString GetHeaderValue(const wxString& header,
|
||||
@@ -202,7 +202,7 @@ inline const wxString& wxGetTranslation(const wxString& str,
|
||||
|
||||
inline const wxString& wxGetTranslation(const wxString& str1,
|
||||
const wxString& str2,
|
||||
size_t n,
|
||||
unsigned n,
|
||||
const wxString& domain = wxEmptyString)
|
||||
{
|
||||
wxTranslations *trans = wxTranslations::Get();
|
||||
|
@@ -361,10 +361,10 @@ public:
|
||||
const wxString& domain = wxEmptyString) const;
|
||||
|
||||
/**
|
||||
Calls wxTranslations::GetString(const wxString&, const wxString&, size_t, const wxString&) const.
|
||||
Calls wxTranslations::GetString(const wxString&, const wxString&, unsigned, const wxString&) const.
|
||||
*/
|
||||
virtual const wxString& GetString(const wxString& origString,
|
||||
const wxString& origString2, size_t n,
|
||||
const wxString& origString2, unsigned n,
|
||||
const wxString& domain = wxEmptyString) const;
|
||||
|
||||
/**
|
||||
|
@@ -226,7 +226,7 @@ public:
|
||||
*/
|
||||
const wxString& GetString(const wxString& origString,
|
||||
const wxString& origString2,
|
||||
size_t n,
|
||||
unsigned n,
|
||||
const wxString& domain = wxEmptyString) const;
|
||||
|
||||
/**
|
||||
@@ -436,7 +436,7 @@ protected:
|
||||
extracted to the message catalog. Instead, use the _() and wxPLURAL()
|
||||
macro for all literal strings.
|
||||
|
||||
@see wxGetTranslation(const wxString&, const wxString&, size_t, const wxString&)
|
||||
@see wxGetTranslation(const wxString&, const wxString&, unsigned, const wxString&)
|
||||
|
||||
@header{wx/intl.h}
|
||||
*/
|
||||
@@ -466,7 +466,7 @@ const wxString& wxGetTranslation(const wxString& string,
|
||||
@header{wx/intl.h}
|
||||
*/
|
||||
const wxString& wxGetTranslation(const wxString& string,
|
||||
const wxString& plural, size_t n,
|
||||
const wxString& plural, unsigned n,
|
||||
const wxString& domain = wxEmptyString);
|
||||
|
||||
/**
|
||||
|
@@ -320,10 +320,10 @@ class wxPluralFormsNode
|
||||
public:
|
||||
wxPluralFormsNode(const wxPluralFormsToken& token) : m_token(token) {}
|
||||
const wxPluralFormsToken& token() const { return m_token; }
|
||||
const wxPluralFormsNode* node(size_t i) const
|
||||
const wxPluralFormsNode* node(unsigned i) const
|
||||
{ return m_nodes[i].get(); }
|
||||
void setNode(size_t i, wxPluralFormsNode* n);
|
||||
wxPluralFormsNode* releaseNode(size_t i);
|
||||
void setNode(unsigned i, wxPluralFormsNode* n);
|
||||
wxPluralFormsNode* releaseNode(unsigned i);
|
||||
wxPluralFormsToken::Number evaluate(wxPluralFormsToken::Number n) const;
|
||||
|
||||
private:
|
||||
@@ -351,12 +351,12 @@ void wxPluralFormsNodePtr::reset(wxPluralFormsNode *p)
|
||||
}
|
||||
|
||||
|
||||
void wxPluralFormsNode::setNode(size_t i, wxPluralFormsNode* n)
|
||||
void wxPluralFormsNode::setNode(unsigned i, wxPluralFormsNode* n)
|
||||
{
|
||||
m_nodes[i].reset(n);
|
||||
}
|
||||
|
||||
wxPluralFormsNode* wxPluralFormsNode::releaseNode(size_t i)
|
||||
wxPluralFormsNode* wxPluralFormsNode::releaseNode(unsigned i)
|
||||
{
|
||||
return m_nodes[i].release();
|
||||
}
|
||||
@@ -917,7 +917,7 @@ public:
|
||||
wxString GetDomain() const { return m_domain; }
|
||||
|
||||
// get the translated string: returns NULL if not found
|
||||
const wxString *GetString(const wxString& sz, size_t n = size_t(-1)) const;
|
||||
const wxString *GetString(const wxString& sz, unsigned n = UINT_MAX) const;
|
||||
|
||||
// public variable pointing to the next element in a linked list (or NULL)
|
||||
wxMsgCatalog *m_pNext;
|
||||
@@ -1232,10 +1232,10 @@ bool wxMsgCatalog::LoadData(const wxScopedCharTypeBuffer<char>& data,
|
||||
return true;
|
||||
}
|
||||
|
||||
const wxString *wxMsgCatalog::GetString(const wxString& str, size_t n) const
|
||||
const wxString *wxMsgCatalog::GetString(const wxString& str, unsigned n) const
|
||||
{
|
||||
int index = 0;
|
||||
if (n != size_t(-1))
|
||||
if (n != UINT_MAX)
|
||||
{
|
||||
index = m_pluralFormsCalculator->evaluate(n);
|
||||
}
|
||||
@@ -1541,12 +1541,12 @@ const wxString& wxTranslations::GetUntranslatedString(const wxString& str)
|
||||
const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
const wxString& domain) const
|
||||
{
|
||||
return GetString(origString, origString, size_t(-1), domain);
|
||||
return GetString(origString, origString, UINT_MAX, domain);
|
||||
}
|
||||
|
||||
const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
const wxString& origString2,
|
||||
size_t n,
|
||||
unsigned n,
|
||||
const wxString& domain) const
|
||||
{
|
||||
if ( origString.empty() )
|
||||
@@ -1586,7 +1586,7 @@ const wxString& wxTranslations::GetString(const wxString& origString,
|
||||
m_lang
|
||||
);
|
||||
|
||||
if (n == size_t(-1))
|
||||
if (n == UINT_MAX)
|
||||
return GetUntranslatedString(origString);
|
||||
else
|
||||
return GetUntranslatedString(n == 1 ? origString : origString2);
|
||||
@@ -1613,14 +1613,14 @@ wxString wxTranslations::GetHeaderValue(const wxString& header,
|
||||
if ( pMsgCat == NULL )
|
||||
return wxEmptyString;
|
||||
|
||||
trans = pMsgCat->GetString(wxEmptyString, (size_t)-1);
|
||||
trans = pMsgCat->GetString(wxEmptyString, UINT_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
// search in all domains
|
||||
for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext )
|
||||
{
|
||||
trans = pMsgCat->GetString(wxEmptyString, (size_t)-1);
|
||||
trans = pMsgCat->GetString(wxEmptyString, UINT_MAX);
|
||||
if ( trans != NULL ) // take the first found
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user