PVS-StudioWarnings

PVS-Studio warning V501 for Chromium

Nov 18th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. std::string TestAudioConfig::TestValidConfigs() {
  2.   ....
  3.   static const uint32_t kRequestFrameCounts[] = {
  4.     PP_AUDIOMINSAMPLEFRAMECOUNT,
  5.     PP_AUDIOMAXSAMPLEFRAMECOUNT,
  6.     1024,
  7.     2048,
  8.     4096
  9.   };
  10.   ....
  11.   for (size_t j = 0;
  12.     j < sizeof(kRequestFrameCounts)/sizeof(kRequestFrameCounts);
  13.     j++) {
  14.   ....
  15. }
  16.  
  17. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V501 There are identical sub-expressions 'sizeof (kRequestFrameCounts)' to the left and to the right of the '/' operator. test_audio_config.cc 56
  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