Ticket #14725 (closed defect: fixed)
suspicious code in file.cpp
| Reported by: | ghostvoodooman | Owned by: | vadz |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | base | Version: | 2.9-svn |
| Keywords: | file wxFile loop for ReadAll | Cc: | |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
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".
Change History
Note: See
TracTickets for help on using
tickets.
