From e889924bc17d9e57b850c6ce90e920b6caafe2f9 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 22 Dec 2020 15:44:24 +0100 Subject: [PATCH] Fix sign-compare warning --- src/html/chm.cpp | 4 ++-- src/osx/cocoa/filedlg.mm | 2 +- src/osx/cocoa/glcanvas.mm | 4 ++-- src/osx/cocoa/msgdlg.mm | 2 +- src/osx/cocoa/textctrl.mm | 10 +++++----- src/osx/cocoa/window.mm | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/html/chm.cpp b/src/html/chm.cpp index 9391bde450..a1d7e6be90 100644 --- a/src/html/chm.cpp +++ b/src/html/chm.cpp @@ -464,14 +464,14 @@ bool wxChmInputStream::Eof() const return (m_content==NULL || m_contentStream==NULL || m_contentStream->Eof() || - m_pos>m_size); + (size_t)m_pos>m_size); } 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; return 0; diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index a267942860..99536113ee 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -419,7 +419,7 @@ int wxFileDialog::ShowModal() m_firstFileTypeFilter = -1; 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; } diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index f6bff5b1fb..d92f7d4494 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -87,7 +87,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, if ( GLAttrs && n1 > 1 ) { n1--; // skip the ending '0' - while ( p < n1 ) + while ( p < (unsigned)n1 ) { data[p] = (NSOpenGLPixelFormatAttribute) GLAttrs[p]; p++; @@ -98,7 +98,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, { n2--; // skip the ending '0' unsigned p2 = 0; - while ( p2 < n2 ) + while ( p2 < (unsigned)n2 ) data[p++] = (NSOpenGLPixelFormatAttribute) ctxAttrs[p2++]; } diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 85eae7320d..f5e23a01e7 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -316,7 +316,7 @@ void* wxMessageDialog::ConstructNSAlert() 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; } diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 56d17d5e15..f8cf958591 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -168,7 +168,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; if ( maxLength > 0 ) { - if ( [*partialStringPtr length] > maxLength ) + if ( [*partialStringPtr length] > (unsigned)maxLength ) { field->SendMaxLenEvent(); 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") ); NSString* txt = [m_textView string]; - if ( pos > [txt length] ) + if ( (unsigned)pos > [txt length] ) return false; // 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 // is past the line. - if ( x >= lineRng.length ) + if ( (unsigned)x >= lineRng.length ) return -1; 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") ); - if ( pos > [[m_textField stringValue] length] ) + if ( (unsigned)pos > [[m_textField stringValue] length] ) return false; 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") ); // 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 x; diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index b6d6a0f64f..bd249c3e3c 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -2025,7 +2025,7 @@ void wxCocoaGesturesImpl::TouchesMoved(NSEvent* event) // Iterate through all moving touches to check if the touch corresponding to "press" // 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]; @@ -2108,7 +2108,7 @@ void wxCocoaGesturesImpl::TouchesEnded(NSEvent* event) bool isPressTouch = false; // 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];