PVS-StudioWarnings

PVS-Studio warning V501 for ReactOS

Nov 20th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. struct util_format_channel_description
  2. {
  3.    unsigned type:5;
  4.    unsigned normalized:1;
  5.    unsigned pure_integer:1;
  6.    unsigned size:9;
  7. };
  8.  
  9. static boolean
  10. is_legal_int_format_combo(
  11.   const struct util_format_description *src,
  12.   const struct util_format_description *dst )
  13. {
  14.   ....
  15.   for (i = 0; i < nr; i++) {
  16.     /* The signs must match. */
  17.     if (src->channel[i].type != src->channel[i].type) {
  18.       return FALSE;
  19.     }
  20.   ....
  21. }
  22.  
  23. This is what should have been written here: src->channel[i].type != dst->channel[i].type
  24.  
  25. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V501 There are identical sub-expressions 'src->channel[i].type' to the left and to the right of the '!=' operator. translate_generic.c 776
  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