PVS-StudioWarnings

PVS-Studio warning V519 for icu

Nov 27th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. void RBBIRuleScanner::error(UErrorCode e) {
  2.   if (U_SUCCESS(*fRB->fStatus))
  3.   {
  4.     *fRB->fStatus = e;
  5.     if (fRB->fParseError)
  6.     {
  7.       fRB->fParseError->line  = fLineNum;
  8.       fRB->fParseError->offset = fCharNum;
  9.       fRB->fParseError->preContext[0] = 0;
  10.       fRB->fParseError->preContext[0] = 0;
  11.     }
  12.   }
  13. }
  14.  
  15. Most likely this is what should be written here: fRB->fParseError->preContext[0] = 0; fRB->fParseError->postContext[0] = 0;
  16.  
  17. This suspicious code was found in icu project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V519 The 'fRB->fParseError->preContext[0]' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 582, 583. rbbiscan.cpp 583
  20.  
  21. 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