From: Kevin M. Rosenberg Date: Tue, 20 Mar 2018 20:57:03 +0000 (-0600) Subject: Fix compiler warnings X-Git-Tag: v6.0.2~24 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=ad33b48a7dda3726daf74a910a97d1f5006b68c4 Fix compiler warnings --- diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index 4f32d63..684e39b 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -997,42 +997,43 @@ EZPlot::drawAxes() m_pSGP->setColor (clr_axis); m_pSGP->moveAbs (x, xaxispos); m_pSGP->lineAbs (x, xaxispos + xticklen); - if (i != x_nint) + if (i != x_nint) { for (j = 1; j <= o_xminortick; j++) { x2 = x + minorinc * j; m_pSGP->moveAbs (x2, xaxispos); m_pSGP->lineAbs (x2, xaxispos + TICKRATIO * xticklen); } - axis_near = FALSE; - if (xaxispos + xtl_ofs > ya_min && o_yaxis != NOAXIS) { - double xw = xgw_min + i * xw_tickinc; - double x = convertWorldToNDC_X (xw); - double d = x - yaxispos; - if (o_yticks == RIGHT && d >= 0 && d < 0.9 * xn_tickinc) - axis_near = TRUE; - if (o_yticks == LEFT && d <= 0 && d > -0.9 * xn_tickinc) - axis_near = TRUE; - } + } + axis_near = FALSE; + if (xaxispos + xtl_ofs > ya_min && o_yaxis != NOAXIS) { + double xw = xgw_min + i * xw_tickinc; + double x = convertWorldToNDC_X (xw); + double d = x - yaxispos; + if (o_yticks == RIGHT && d >= 0 && d < 0.9 * xn_tickinc) + axis_near = TRUE; + if (o_yticks == LEFT && d <= 0 && d > -0.9 * xn_tickinc) + axis_near = TRUE; + } - if (o_xtlabel == TRUE && axis_near == FALSE) { - snprintf (str, sizeof(str), x_numfmt, xgw_min + xw_tickinc * i); - numstr = str_skip_head (str, " "); - double xExtent, yExtent; - m_pSGP->getTextExtent (numstr, &xExtent, &yExtent); - m_pSGP->moveAbs (x - xExtent/2, xaxispos + xtl_ofs); - m_pSGP->setTextColor (clr_number, -1); - m_pSGP->drawText (numstr); - } + if (o_xtlabel == TRUE && axis_near == FALSE) { + snprintf (str, sizeof(str), x_numfmt, xgw_min + xw_tickinc * i); + numstr = str_skip_head (str, " "); + double xExtent, yExtent; + m_pSGP->getTextExtent (numstr, &xExtent, &yExtent); + m_pSGP->moveAbs (x - xExtent/2, xaxispos + xtl_ofs); + m_pSGP->setTextColor (clr_number, -1); + m_pSGP->drawText (numstr); + } } } // X - Axis - - + + /*--------*/ /* y-axis */ /*--------*/ - + if (o_yaxis == LINEAR) { - + m_pSGP->setColor (clr_axis); if (o_tag && !o_grid && !o_box && s_ycross) { m_pSGP->moveAbs (yaxispos - charwidth, ya_min); @@ -1073,33 +1074,34 @@ EZPlot::drawAxes() m_pSGP->setColor (clr_axis); m_pSGP->moveAbs (yaxispos, y); m_pSGP->lineAbs (yaxispos + yticklen, y); - if (i != y_nint) + if (i != y_nint) { for (j = 1; j <= o_yminortick; j++) { y2 = y + minorinc * j; m_pSGP->moveAbs (yaxispos, y2); m_pSGP->lineAbs (yaxispos + TICKRATIO * yticklen, y2); } - axis_near = FALSE; - if (yaxispos + ytl_ofs > xa_min && o_xaxis != NOAXIS) { - double yw = ygw_min + i * yw_tickinc; - double y = convertWorldToNDC_Y (yw); - double d = y - xaxispos; - if (o_xticks == ABOVE && d >= 0 && d < 0.9 * yn_tickinc) - axis_near = TRUE; - if (o_xticks == BELOW && d <= 0 && d > -0.9 * yn_tickinc) - axis_near = TRUE; - } - if (o_ytlabel == TRUE && axis_near == FALSE) { - snprintf (str, sizeof(str), y_numfmt, ygw_min + yw_tickinc * i); - double xExtent, yExtent; - m_pSGP->getTextExtent (str, &xExtent, &yExtent); - if (o_yticks == LEFT) - m_pSGP->moveAbs (yaxispos - 1.5 * charwidth - xExtent, y + 0.5 * yExtent); - else - m_pSGP->moveAbs (yaxispos + 1.5 * charwidth, y + 0.5 * yExtent); - m_pSGP->setTextColor (clr_number, -1); - m_pSGP->drawText (str); - } + } + axis_near = FALSE; + if (yaxispos + ytl_ofs > xa_min && o_xaxis != NOAXIS) { + double yw = ygw_min + i * yw_tickinc; + double y = convertWorldToNDC_Y (yw); + double d = y - xaxispos; + if (o_xticks == ABOVE && d >= 0 && d < 0.9 * yn_tickinc) + axis_near = TRUE; + if (o_xticks == BELOW && d <= 0 && d > -0.9 * yn_tickinc) + axis_near = TRUE; + } + if (o_ytlabel == TRUE && axis_near == FALSE) { + snprintf (str, sizeof(str), y_numfmt, ygw_min + yw_tickinc * i); + double xExtent, yExtent; + m_pSGP->getTextExtent (str, &xExtent, &yExtent); + if (o_yticks == LEFT) + m_pSGP->moveAbs (yaxispos - 1.5 * charwidth - xExtent, y + 0.5 * yExtent); + else + m_pSGP->moveAbs (yaxispos + 1.5 * charwidth, y + 0.5 * yExtent); + m_pSGP->setTextColor (clr_number, -1); + m_pSGP->drawText (str); + } } } // Y - Axis } diff --git a/libctgraphics/ezset.cpp b/libctgraphics/ezset.cpp index eae4c28..8cde00a 100644 --- a/libctgraphics/ezset.cpp +++ b/libctgraphics/ezset.cpp @@ -217,25 +217,33 @@ EZPlot::do_cmd (int lx) o_grid = FALSE; break; case S_XLENGTH: - if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) - if (f > 0.0 && f <= 1.0) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (f > 0.0 && f <= 1.0) { o_xlength = f; - break; + } + } + break; case S_YLENGTH: - if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) - if (f > 0.0 && f <= 1.0) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (f > 0.0 && f <= 1.0) { o_ylength = f; - break; + } + } + break; case S_XPORIGIN: - if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) - if (f >= 0.0 && f < 1.0) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (f >= 0.0 && f < 1.0) { o_xporigin = f; - break; + } + } + break; case S_YPORIGIN: - if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) - if (f >= 0.0 && f < 1.0) + if (m_pol.readFloat (&f, POL::TT_REAL, FALSE, 0.0, 0.0) == TRUE) { + if (f >= 0.0 && f < 1.0) { o_yporigin = f; - break; + } + } + break; case S_TAG: if (m_pol.readWord("no", 2) == TRUE) o_tag = FALSE; @@ -327,10 +335,12 @@ EZPlot::do_cmd (int lx) if (n > 1 && n < 100) o_xmajortick = n; } else if (lx == S_MINOR) - if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) - if (n >= 0 && n < 100) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (n >= 0 && n < 100) { o_xminortick = n; - break; + } + } + break; case S_YTICKS: if (m_pol.readUserToken(str,&lx) == FALSE) break; @@ -343,14 +353,18 @@ EZPlot::do_cmd (int lx) else if (lx == S_LABEL) o_ytlabel = TRUE; else if (lx == S_MAJOR) { - if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) - if (n > 1 && n < 100) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (n > 1 && n < 100) { o_ymajortick = n; - } else if (lx == S_MINOR) - if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) - if (n >= 0 && n < 100) + } + } + } else if (lx == S_MINOR) + if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { + if (n >= 0 && n < 100) { o_yminortick = n; - break; + } + } + break; case S_LXFRAC: if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) { if (n >= 0) {