PVS-StudioWarnings

PVS-Studio warning V612 for pcsx2

Nov 18th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. int DvdRead(u32 lsn, u32 sectors, void *buf,
  2.             CdRMode *mode)
  3. {
  4.   u32 i;
  5.   u8* buff;
  6.  
  7.   for (i=lsn; i<(lsn+sectors); i++)
  8.   {
  9.     if (CDVDreadTrack(i, CDVD_MODE_2048)==-1)
  10.       return 0;
  11.     buff = CDVDgetBuffer();
  12.     if (buff==NULL) return 0;
  13. //    switch (mode->datapattern){
  14. //      case CdSecS2064:
  15.       ((u32*)buf)[0] = i + 0x30000;
  16.       memcpy_fast((u8*)buf+12, buff, 2048);
  17.       buf = (char*)buf + 2064; break;           <<<---
  18. //    default:
  19. //      return 0;
  20. //    }
  21.   }
  22.   return 1;
  23. }
  24.  
  25. This suspicious code was found in pcsx2 project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V612 An unconditional 'break' within a loop. pcsx2 cdvdiso.cpp 218
  28.  
  29. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment