Fix sign-compare warning

This commit is contained in:
Maarten Bent
2020-12-22 15:44:24 +01:00
parent da455f3c0b
commit e889924bc1
6 changed files with 13 additions and 13 deletions

View File

@@ -464,14 +464,14 @@ bool wxChmInputStream::Eof() const
return (m_content==NULL || return (m_content==NULL ||
m_contentStream==NULL || m_contentStream==NULL ||
m_contentStream->Eof() || m_contentStream->Eof() ||
m_pos>m_size); (size_t)m_pos>m_size);
} }
size_t wxChmInputStream::OnSysRead(void *buffer, size_t bufsize) size_t wxChmInputStream::OnSysRead(void *buffer, size_t bufsize)
{ {
if ( m_pos >= m_size ) if ( (size_t)m_pos >= m_size )
{ {
m_lasterror = wxSTREAM_EOF; m_lasterror = wxSTREAM_EOF;
return 0; return 0;

View File

@@ -419,7 +419,7 @@ int wxFileDialog::ShowModal()
m_firstFileTypeFilter = -1; m_firstFileTypeFilter = -1;
if ( m_useFileTypeFilter if ( m_useFileTypeFilter
&& m_filterIndex >= 0 && m_filterIndex < m_filterExtensions.GetCount() ) && m_filterIndex >= 0 && (size_t)m_filterIndex < m_filterExtensions.GetCount() )
{ {
m_firstFileTypeFilter = m_filterIndex; m_firstFileTypeFilter = m_filterIndex;
} }

View File

@@ -87,7 +87,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs,
if ( GLAttrs && n1 > 1 ) if ( GLAttrs && n1 > 1 )
{ {
n1--; // skip the ending '0' n1--; // skip the ending '0'
while ( p < n1 ) while ( p < (unsigned)n1 )
{ {
data[p] = (NSOpenGLPixelFormatAttribute) GLAttrs[p]; data[p] = (NSOpenGLPixelFormatAttribute) GLAttrs[p];
p++; p++;
@@ -98,7 +98,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs,
{ {
n2--; // skip the ending '0' n2--; // skip the ending '0'
unsigned p2 = 0; unsigned p2 = 0;
while ( p2 < n2 ) while ( p2 < (unsigned)n2 )
data[p++] = (NSOpenGLPixelFormatAttribute) ctxAttrs[p2++]; data[p++] = (NSOpenGLPixelFormatAttribute) ctxAttrs[p2++];
} }

View File

@@ -316,7 +316,7 @@ void* wxMessageDialog::ConstructNSAlert()
m_buttonId[ m_buttonCount++ ] = wxID_HELP; m_buttonId[ m_buttonCount++ ] = wxID_HELP;
} }
wxASSERT_MSG( m_buttonCount <= WXSIZEOF(m_buttonId), "Too many buttons" ); wxASSERT_MSG( m_buttonCount <= (int)WXSIZEOF(m_buttonId), "Too many buttons" );
return alert; return alert;
} }

View File

@@ -168,7 +168,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
if ( maxLength > 0 ) if ( maxLength > 0 )
{ {
if ( [*partialStringPtr length] > maxLength ) if ( [*partialStringPtr length] > (unsigned)maxLength )
{ {
field->SendMaxLenEvent(); field->SendMaxLenEvent();
return NO; return NO;
@@ -909,7 +909,7 @@ bool wxNSTextViewControl::PositionToXY(long pos, long *x, long *y) const
wxCHECK_MSG( pos >= 0, false, wxS("Invalid character position") ); wxCHECK_MSG( pos >= 0, false, wxS("Invalid character position") );
NSString* txt = [m_textView string]; NSString* txt = [m_textView string];
if ( pos > [txt length] ) if ( (unsigned)pos > [txt length] )
return false; return false;
// Last valid position is past the last character // Last valid position is past the last character
@@ -987,7 +987,7 @@ long wxNSTextViewControl::XYToPosition(long x, long y) const
// Return error if given x position // Return error if given x position
// is past the line. // is past the line.
if ( x >= lineRng.length ) if ( (unsigned)x >= lineRng.length )
return -1; return -1;
return lineRng.location + x; return lineRng.location + x;
@@ -1452,7 +1452,7 @@ bool wxNSTextFieldControl::PositionToXY(long pos, long *x, long *y) const
{ {
wxCHECK_MSG( pos >= 0, false, wxS("Invalid character position") ); wxCHECK_MSG( pos >= 0, false, wxS("Invalid character position") );
if ( pos > [[m_textField stringValue] length] ) if ( (unsigned)pos > [[m_textField stringValue] length] )
return false; return false;
if ( y ) if ( y )
@@ -1469,7 +1469,7 @@ long wxNSTextFieldControl::XYToPosition(long x, long y) const
wxCHECK_MSG( x >= 0 && y >= 0, -1, wxS("Invalid line/column number") ); wxCHECK_MSG( x >= 0 && y >= 0, -1, wxS("Invalid line/column number") );
// Last valid position is after the last character. // Last valid position is after the last character.
if ( y != 0 || x > [[m_textField stringValue] length] ) if ( y != 0 || (unsigned)x > [[m_textField stringValue] length] )
return -1; return -1;
return x; return x;

View File

@@ -2025,7 +2025,7 @@ void wxCocoaGesturesImpl::TouchesMoved(NSEvent* event)
// Iterate through all moving touches to check if the touch corresponding to "press" // Iterate through all moving touches to check if the touch corresponding to "press"
// in Press and Tap event is moving. // in Press and Tap event is moving.
for ( int i = 0; i < [array count]; ++i ) for ( unsigned i = 0; i < [array count]; ++i )
{ {
NSTouch* touch = [array objectAtIndex:i]; NSTouch* touch = [array objectAtIndex:i];
@@ -2108,7 +2108,7 @@ void wxCocoaGesturesImpl::TouchesEnded(NSEvent* event)
bool isPressTouch = false; bool isPressTouch = false;
// Iterate through all ended touches // Iterate through all ended touches
for( int i = 0; i < [array count]; ++i ) for( unsigned i = 0; i < [array count]; ++i )
{ {
NSTouch* touch = [array objectAtIndex:i]; NSTouch* touch = [array objectAtIndex:i];