prediction.c:1077 Expression 'FIT_POWER == fit' is always true.

XMLWordPrintable

    • Type: Problem report
    • Resolution: Won't fix
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:






      Expression 'FIT_POWER == fit' is always true.

      Hello! I am trying to help for Project Zabbix. Check source code Zabbix by PVS-Studio. PVS-Studio have many issue, but some issue is interesting.

      	if (FIT_LINEAR == fit || FIT_EXPONENTIAL == fit || FIT_LOGARITHMIC == fit || FIT_POWER == fit)
      	{
      		/* fit is monotone, therefore maximum and minimum are either at now or at now + time */
      		if (SUCCEED != zbx_calculate_value(now, coefficients, fit, &left) ||
      				SUCCEED != zbx_calculate_value(now + time, coefficients, fit, &right))
      		{
      			res = FAIL;
      			goto out;
      		}
       
      		if (MODE_MAX == mode)
      		{
      			result = (left > right ? left : right);
      		}
      		else if (MODE_MIN == mode)
      		{
      			result = (left < right ? left : right);
      		}
      		else if (MODE_DELTA == mode)
      		{
      			result = (left > right ? left - right : right - left);
      		}
      		else if (MODE_AVG == mode)
      		{
      			if (FIT_LINEAR == fit)
      			{
      				result = 0.5 * (left + right);
      			}
      			else if (FIT_EXPONENTIAL == fit)
      			{
      				result = (right - left) / time / ZBX_MATRIX_EL(coefficients, 1, 0);
      			}
      			else if (FIT_LOGARITHMIC == fit)
      			{
      				result = right + ZBX_MATRIX_EL(coefficients, 1, 0) *
      						(log(1.0 + time / now) * now / time - 1.0);
      			}
      			else if (FIT_POWER == fit)
      

       
      Expression 'FIT_POWER == fit' is always true.

       

            Assignee:
            Zabbix Support Team
            Reporter:
            Anton
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: