Ticket #92 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

MarkupSTL.cpp - always true comparison

Reported by: mloskot Owned by:
Priority: major Milestone: 3.2.0
Component: tests Version: 2.2.2
Severity: Content Keywords: imported,phpbugtracker
Cc:

Description (last modified by mloskot) (diff)

g++ with -pedantic option reports following warning that may significantly influence logic of this code:

/home/mloskot/dev/geos/_cvs/geos/tests/xmltester/markup/MarkupSTL.cpp:884: 
 warning: comparison is always true due to limited range of data type

Here is this comparison:

int nEndCDATA = m_strDoc.find( "]]>",
                  token.nNext );
if ( (unsigned int)nEndCDATA != string::npos
&& nEndCDATA < m_aPos[iPos].nEndL )
{
   return m_strDoc.substr(token.nL+9,
          nEndCDATA-token.nL-9 );
}

Attachments

MarkupSTL_cpp-ticket-92.patch Download (2.6 KB) - added by mloskot 3 years ago.
Patch fixing compilation warnings thrown by GCC 4.3.x

Change History

  Changed 4 years ago by mloskot

  • description modified (diff)
  • reporter changed from mateusz@… to mloskot

  Changed 4 years ago by mloskot

  • milestone imported deleted

  Changed 4 years ago by mloskot

  • priority changed from 2 to major
  • severity changed from Significant to Content

  Changed 4 years ago by mloskot

  • owner strk@… deleted
  • status changed from assigned to new
  • description modified (diff)

  Changed 3 years ago by pramsey

  • milestone set to 3.2.0

in reply to: ↑ description   Changed 3 years ago by strk

warning: comparison is always true due to limited range of data type

int nEndCDATA = m_strDoc.find( "]]>", token.nNext ); if ( (unsigned int)nEndCDATA != string::npos && nEndCDATA < m_aPos[iPos].nEndL )

Does casting to 'string::size_type' instead of 'unsigned int' fix the problem ?

Changed 3 years ago by mloskot

Patch fixing compilation warnings thrown by GCC 4.3.x

  Changed 3 years ago by mloskot

Sandro,

More or less. See MarkupSTL_cpp-ticket-92.patch for all fixes necessary to silent GCC.

  Changed 3 years ago by strk

  • status changed from new to closed
  • resolution set to fixed

Committed, thanks.

Note: See TracTickets for help on using tickets.