X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctgraphics%2Fezplot.cpp;h=ed1ca233d26ef8e8c02e967e78717935a77b64bd;hp=b59d92dde5a8f5723aae5f338253761a7400c017;hb=3f6c94c6bd432ad7b7a55ad991d3b8223fb44f18;hpb=17644359b085e5c2be7d71f8c0fb6dacd3cbd681 diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index b59d92d..ed1ca23 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ezplot.cpp,v 1.30 2001/01/28 19:10:18 kevin Exp $ +** $Id: ezplot.cpp,v 1.31 2001/02/20 04:48:45 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -36,14 +36,12 @@ static const int DEF_CURVE_CLR = C_RED; EZPlotCurve::EZPlotCurve (const double* xData, const double* yData, int n) -: x(NULL), y(NULL) +: x(new double[n]), y(new double[n]) { - x = new double [n]; - y = new double [n]; - - int copyCount = n * sizeof(double); - memcpy (x, xData, copyCount); - memcpy (y, yData, copyCount); + for (int i = 0; i < n; i++) { + x[i] = xData[i]; + y[i] = yData[i]; + } m_iPointCount = n; } @@ -94,7 +92,7 @@ EZPlot::addCurve (const float x[], const double y[], int num) } void -EZPlot::addCurve (const double x[], const float y[], int num) +EZPlot::addCurve (const double* const x, const float* const y, int num) { double* dy = new double [num]; @@ -108,7 +106,7 @@ EZPlot::addCurve (const double x[], const float y[], int num) void -EZPlot::addCurve (const double x[], const double y[], int num) +EZPlot::addCurve (const double* const x, const double* const y, int num) { if (num < 1) return;