Skip to content

Commit d4b13fd

Browse files
committed
Return unsigned int from nplurals()
Fix type mismatch warnings with MSVC in some places after 87127df.
1 parent 8f45d2c commit d4b13fd

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/catalog_po.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ bool POCatalog::DoSaveOnly(wxTextBuffer& f, wxTextFileType crlf)
14661466
SaveMultiLines(f, pohdr);
14671467
f.AddLine(wxEmptyString);
14681468

1469-
auto pluralsCount = std::max((int)GetPluralFormsCountPresentInItems(), GetPluralForms().nplurals());
1469+
auto pluralsCount = std::max(GetPluralFormsCountPresentInItems(), GetPluralForms().nplurals());
14701470

14711471
for (auto& data_: m_items)
14721472
{

src/editing_area.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,9 @@ void EditingArea::RecreatePluralTextCtrls(CatalogPtr catalog)
764764
m_textTransSingularForm = NULL;
765765

766766
auto plurals = catalog->GetPluralForms();
767-
int formsCount = plurals.nplurals();
767+
unsigned formsCount = plurals.nplurals();
768768

769-
for (int form = 0; form < formsCount; form++)
769+
for (unsigned form = 0; form < formsCount; form++)
770770
{
771771
// find example number that would use this plural form:
772772
static const int maxExamplesCnt = 5;

src/language.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ PluralFormsExpr Language::DefaultPluralFormsExpr() const
563563
}
564564

565565

566-
int Language::nplurals() const
566+
unsigned Language::nplurals() const
567567
{
568568
return DefaultPluralFormsExpr().nplurals();
569569
}
@@ -776,7 +776,7 @@ PluralFormsExpr::~PluralFormsExpr()
776776
{
777777
}
778778

779-
int PluralFormsExpr::nplurals() const
779+
unsigned PluralFormsExpr::nplurals() const
780780
{
781781
if (m_nplurals != -1)
782782
return m_nplurals;
@@ -863,10 +863,10 @@ bool PluralFormsExpr::operator==(const PluralFormsExpr& other) const
863863
return true;
864864
}
865865

866-
int PluralFormsExpr::evaluate_for_n(int n) const
866+
unsigned PluralFormsExpr::evaluate_for_n(int n) const
867867
{
868868
auto c = calc();
869-
return c ? c->evaluate(n) : 0;
869+
return c ? (unsigned)c->evaluate(n) : 0;
870870
}
871871

872872
PluralFormsExpr PluralFormsExpr::English()

src/language.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Language
106106
PluralFormsExpr DefaultPluralFormsExpr() const;
107107

108108
/// Count of plural forms for this language
109-
int nplurals() const;
109+
unsigned nplurals() const;
110110

111111
/// Returns language's text writing direction
112112
TextDirection Direction() const { return m_direction; }
@@ -228,9 +228,9 @@ class PluralFormsExpr
228228
bool operator!=(const PluralFormsExpr& other) const { return !(*this == other); }
229229
explicit operator bool() const { return !m_expr.empty() && calc() != nullptr; }
230230

231-
int nplurals() const;
231+
unsigned nplurals() const;
232232

233-
int evaluate_for_n(int n) const;
233+
unsigned evaluate_for_n(int n) const;
234234

235235
private:
236236
std::shared_ptr<PluralFormsCalculator> calc() const;

0 commit comments

Comments
 (0)