Ticket URL: <
http://trac.wxwidgets.org/ticket/14725>
#14725: suspicious code in file.cpp
------------------------------------------+---------------------------------
Reporter: ghostvoodooman | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: base | Version: 2.9-svn
Keywords: file wxFile loop for ReadAll | Blockedby:
Patch: 0 | Blocking:
------------------------------------------+---------------------------------
There is suspicious code in ReadAll() function:
http://svn.wxwidgets.org/viewvc/wx/wxWidgets/trunk/src/common/file.cpp?view=markup
RealAll() function:
{{{
for ( ;; )
{
static const unsigned READSIZE = 4096;
ssize_t nread = Read(p, length > READSIZE ? READSIZE : length);
if ( nread == wxInvalidOffset )
return false;
p += nread;
}
*p = 0;
wxString strTmp(buf, conv);
str->swap(strTmp);
return true;
}}}
compiler warns about line 314 saying non-reachable code
{{{
*p = 0;
}}}
the code is not reachable, since there is infinite loop [namely "for(;;)"
construct], and inside of it there is only conditional "return" statement,
but no "break" statement. It is assumed the loop either loops infinitely
or returns "false".
--
Ticket URL: <
http://trac.wxwidgets.org/ticket/14725>