Avoid truncation of expression assigned to larger type

This commit is contained in:
Paul Cornett
2019-04-05 09:55:49 -07:00
parent 1a90833839
commit 7cbe23830f
3 changed files with 5 additions and 5 deletions

View File

@@ -650,7 +650,7 @@ bool TextValidatorDialog::StyleValidator::TransferToWindow()
if ( !cb ) if ( !cb )
return false; return false;
const long style = 1 << (cb->GetId()-wxID_HIGHEST-1); const long style = 1L << (cb->GetId()-wxID_HIGHEST-1);
cb->SetValue((*m_style & style) != 0); cb->SetValue((*m_style & style) != 0);
} }
@@ -668,7 +668,7 @@ bool TextValidatorDialog::StyleValidator::TransferFromWindow()
if ( !cb ) if ( !cb )
return false; return false;
const long style = 1 << (cb->GetId()-wxID_HIGHEST-1); const long style = 1L << (cb->GetId()-wxID_HIGHEST-1);
if ( cb->IsChecked() ) if ( cb->IsChecked() )
*m_style |= style; *m_style |= style;

View File

@@ -3453,7 +3453,7 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const
unsigned long size, nentries, key; unsigned long size, nentries, key;
p = GetData(); p = GetData();
size = GetWidth() * GetHeight(); size = static_cast<unsigned long>(GetWidth()) * GetHeight();
nentries = 0; nentries = 0;
for (unsigned long j = 0; (j < size) && (nentries <= stopafter) ; j++) for (unsigned long j = 0; (j < size) && (nentries <= stopafter) ; j++)
@@ -3481,7 +3481,7 @@ unsigned long wxImage::ComputeHistogram( wxImageHistogram &h ) const
h.clear(); h.clear();
const unsigned long size = GetWidth() * GetHeight(); const unsigned long size = static_cast<unsigned long>(GetWidth()) * GetHeight();
unsigned char r, g, b; unsigned char r, g, b;
for ( unsigned long n = 0; n < size; n++ ) for ( unsigned long n = 0; n < size; n++ )

View File

@@ -233,7 +233,7 @@ int ReadTGA(wxImage* image, wxInputStream& stream)
const short pixelSize = bpp / 8; const short pixelSize = bpp / 8;
const unsigned long imageSize = width * height * pixelSize; const unsigned long imageSize = static_cast<unsigned long>(width) * height * pixelSize;
wxScopedArray<unsigned char> imageData(imageSize); wxScopedArray<unsigned char> imageData(imageSize);