Examples of errors detected by the V537 diagnostic.


V537. Consider reviewing the correctness of 'X' item's usage.


IPP Samples

V537 Consider reviewing the correctness of 'sprite_left_coordinate' item's usage. mpeg4_enc mp4_enc_misc.cpp 387


Ipp32s ippVideoEncoderMPEG4::Init(mp4_Param *par)
{
  ...
  VOL.obmc_disable = par->obmc_disable;
  VOL.sprite_enable = par->sprite_enable;
  VOL.sprite_width = par->sprite_width;
  VOL.sprite_height = par->sprite_height;
  VOL.sprite_left_coordinate = par->sprite_left_coordinate;
  VOL.sprite_top_coordinate = par->sprite_left_coordinate;
  ...
}

An object copying error. The programmer made a misprint and typed a wrong variable.


Miranda IM

V537 Consider reviewing the correctness of 'maxX' item's usage. clist_modern modern_skinengine.cpp 2898


static BOOL ske_DrawTextEffect(....)
{
  ...
  minX=max(0,minX+mcLeftStart-2);
  minY=max(0,minY+mcTopStart-2);
  maxX=min((int)width,maxX+mcRightEnd-1);
  maxY=min((int)height,maxX+mcBottomEnd-1);
  ...
}

Most likely this is what should be written here: maxY=min((int)height,maxY+mcBottomEnd-1);


ReactOS

V537 Consider reviewing the correctness of 'x' item's usage. win32k bitblt.c 670


BOOL APIENTRY
GreStretchBltMask(....)
{
  ...
  MaskPoint.x += DCMask->ptlDCOrig.x;
  MaskPoint.y += DCMask->ptlDCOrig.x;
  ...
}

Most likely this is what should be written here: MaskPoint.y += DCMask->ptlDCOrig.y;


ReactOS

V537 Consider reviewing the correctness of 'X' item's usage. gdiplus region.c 715


GpStatus WINGDIPAPI GdipGetRegionBoundsI()
{
  ...
  if(status == Ok){
    rect->X = roundr(rectf.X);
    rect->Y = roundr(rectf.X);
    rect->Width  = roundr(rectf.Width);
    rect->Height = roundr(rectf.Height);
  }
  ...
}

This is what should have been written here: rect->Y = roundr(rectf.Y);


Quake-III-Arena

V537 Consider reviewing the correctness of 'scale_x' item's usage. Radiant terrain.cpp 1408


void Terrain_AddMovePoint(....) {
  ...
  x = ( v[ 0 ] - p->origin[ 0 ] ) / p->scale_x;
  y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_x;
  ...
}

This is what should have been written here: y = ( v[ 1 ] - p->origin[ 1 ] ) / p->scale_y;


Trinity Core

V537 Consider reviewing the correctness of 'y' item's usage. g3dlib vector3int32.h 77


inline Vector3int32& operator+=(const Vector3int32& other) {
  x += other.x;
  y += other.y;
  z += other.y;    // <=
  return *this;
}

Blender

V537 Consider reviewing the correctness of 'x0' item's usage. extern_openjpeg tcd.c 650


void tcd_malloc_decode(....) {
  ...
  x0 = j == 0 ? tilec->x0 :
                int_min(x0, (unsigned int) tilec->x0);
  y0 = j == 0 ? tilec->y0 :
                int_min(y0, (unsigned int) tilec->x0);  // <=
  x1 = j == 0 ? tilec->x1 :
                int_max(x1, (unsigned int) tilec->x1);
  y1 = j == 0 ? tilec->y1 :
                int_max(y1, (unsigned int) tilec->y1);
  ...
}

Source Engine SDK

V537 Consider reviewing the correctness of 'y' item's usage. Raytrace trace2.cpp 189


class ALIGN16 FourVectors
{
public:
  fltx4 x, y, z;
  ....
};

FourVectors BackgroundColor;

void RayTracingEnvironment::RenderScene(....)
{
  ....
  intens.x=OrSIMD(AndSIMD(BackgroundColor.x,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.x));
  intens.y=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.y));
  intens.z=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask),
                  AndNotSIMD(no_hit_mask,intens.z));

  ....
}

This is what should have been written here: intens.z=OrSIMD(AndSIMD(BackgroundColor.z,no_hit_mask), AndNotSIMD(no_hit_mask,intens.z));


Expat

V537 Consider reviewing the correctness of 'att1' item's usage. - ADDITIONAL IN CURRENT xmlwf.c 160


static int
nsattcmp(const void *p1, const void *p2)
{
  const XML_Char *att1 = *(const XML_Char **)p1;
  const XML_Char *att2 = *(const XML_Char **)p2;
  int sep1 = (tcsrchr(att1, NSSEP) != 0);
  int sep2 = (tcsrchr(att1, NSSEP) != 0);
  if (sep1 != sep2)
    return sep1 - sep2;
  return tcscmp(att1, att2);
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;