From ee0105d74fec9d6bfd236e22e9e1d315e46c568e Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 6 Dec 2000 01:46:43 +0000 Subject: [PATCH] r246: More modifications for MSVC --- include/backprojectors.h | 30 ++++---- include/ctsupport.h | 7 +- include/ezplot.h | 4 +- include/phantom.h | 16 ++--- include/sgp.h | 4 +- include/transformmatrix.h | 7 +- libctgraphics/ezplot.cpp | 32 +++++---- libctgraphics/ezset.cpp | 6 +- libctgraphics/sgp.cpp | 6 +- libctgraphics/transformmatrix.cpp | 14 ++-- libctsim/array2dfile.cpp | 14 ++-- libctsim/backprojectors.cpp | 6 +- libctsim/imagefile.cpp | 48 +++++++------ libctsim/phantom.cpp | 6 +- libctsim/procsignal.cpp | 115 +++++++++++++++++------------- libctsim/projections.cpp | 11 +-- libctsim/reconstruct.cpp | 6 +- libctsim/scanner.cpp | 10 ++- libctsupport/clip.cpp | 4 +- libctsupport/syserror.cpp | 26 +++---- 20 files changed, 203 insertions(+), 169 deletions(-) diff --git a/include/backprojectors.h b/include/backprojectors.h index e3418df..c3196f6 100644 --- a/include/backprojectors.h +++ b/include/backprojectors.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.h,v 1.16 2000/12/03 15:16:17 kevin Exp $ +** $Id: backprojectors.h,v 1.17 2000/12/06 01:46:43 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 @@ -144,10 +144,10 @@ class BackprojectTrig : public Backproject { public: BackprojectTrig (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : Backproject::Backproject (proj, im, interpID, interpFactor) + : Backproject (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); }; @@ -157,7 +157,7 @@ class BackprojectTable : public Backproject BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor); virtual ~BackprojectTable (); - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); protected: Array2d arrayR; @@ -173,7 +173,7 @@ class BackprojectDiff : public Backproject BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor); ~BackprojectDiff (); - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); protected: double start_r; @@ -185,20 +185,20 @@ class BackprojectDiff2 : public BackprojectDiff { public: BackprojectDiff2 (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : BackprojectDiff::BackprojectDiff (proj, im, interpID, interpFactor) + : BackprojectDiff (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); }; class BackprojectIntDiff2 : public BackprojectDiff { public: BackprojectIntDiff2 (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : BackprojectDiff::BackprojectDiff (proj, im, interpID, interpFactor) + : BackprojectDiff (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); }; @@ -206,20 +206,20 @@ class BackprojectIntDiff3 : public BackprojectDiff { public: BackprojectIntDiff3 (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : BackprojectDiff::BackprojectDiff (proj, im, interpID, interpFactor) + : BackprojectDiff (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); }; class BackprojectEquilinear : public BackprojectTable { public: BackprojectEquilinear (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : BackprojectTable::BackprojectTable (proj, im, interpID, interpFactor) + : BackprojectTable (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); virtual ~BackprojectEquilinear() {} @@ -229,10 +229,10 @@ class BackprojectEquiangular : public BackprojectTable { public: BackprojectEquiangular (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) - : BackprojectTable::BackprojectTable (proj, im, interpID, interpFactor) + : BackprojectTable (proj, im, interpID, interpFactor) {} - void BackprojectView (const double* const t, double view_angle); + void BackprojectView (const double* const t, const double view_angle); virtual ~BackprojectEquiangular() {} diff --git a/include/ctsupport.h b/include/ctsupport.h index 14ef13c..60a6c2c 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsupport.h,v 1.7 2000/11/28 14:54:07 kevin Exp $ +** $Id: ctsupport.h,v 1.8 2000/12/06 01:46:43 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -222,6 +222,9 @@ template inline T nearest (double x) { return (x > 0 ? static_cast(x+0.5) : static_cast(x-0.5)); } +inline int imax (int a, int b) +{ return (a >= b ? a : b); } + template inline T clamp (T value, T lowerBounds, T upperBounds) { return (value >= upperBounds ? upperBounds : (value <= lowerBounds ? lowerBounds : value )); } @@ -248,7 +251,7 @@ inline void minmax_array (const T* array, const int n, T& min, T& max) ////////////////////////////////////////////////////////////// // clip.cpp -int clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]); +bool clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]); int clip_segment (double& x1, double& y1, double& x2, double& y2, const double u, const double v); int clip_sector (double& x1, double& y1, double& x2, double& y2, const double u, const double v); int clip_circle (double& x1, double& y1, double& x2, double& y2, const double cx, const double cy, const double radius, double t1, double t2); diff --git a/include/ezplot.h b/include/ezplot.h index 72153bf..11f95ba 100644 --- a/include/ezplot.h +++ b/include/ezplot.h @@ -7,7 +7,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.h,v 1.15 2000/11/28 14:54:07 kevin Exp $ +** $Id: ezplot.h,v 1.16 2000/12/06 01:46:43 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 @@ -139,7 +139,7 @@ class EZPlot { string c_legend;; // current legend specified int o_linestyle, o_color; // style to use for curves all subsequent curves to EZPLOT - bool o_xaxis, o_yaxis; // Specifies where axis & labels are drawn + int o_xaxis, o_yaxis; // Specifies where axis & labels are drawn bool o_grid; // Flag to draw a grid at major ticks bool o_box; // Flag to draw a box around the graph diff --git a/include/phantom.h b/include/phantom.h index bc245ee..651e1eb 100644 --- a/include/phantom.h +++ b/include/phantom.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.h,v 1.15 2000/12/04 05:36:57 kevin Exp $ +** $Id: phantom.h,v 1.16 2000/12/06 01:46:43 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 @@ -28,9 +28,7 @@ #ifndef PHANTOM_H #define PHANTOM_H -#ifndef MSVC -#include -#endif +#include #include "ctsupport.h" using namespace std; @@ -191,8 +189,8 @@ class Phantom const double xmax() const {return m_xmax;} const double ymin() const {return m_ymin;} const double ymax() const {return m_ymax;} - slist& listPElem() {return m_listPElem;} - const slist& listPElem() const {return m_listPElem;} + list& listPElem() {return m_listPElem;} + const list& listPElem() const {return m_listPElem;} const int nPElem() const {return m_nPElem;} static const int getPhantomCount() {return s_iPhantomCount;} @@ -207,7 +205,7 @@ class Phantom int m_nPElem; // number of pelems in phantom double m_xmin, m_xmax, m_ymin, m_ymax; // extent of pelems in pelem coordinates double m_diameter; // diameter of object - mutable slist m_listPElem; // pelem lists + mutable list m_listPElem; // pelem lists string m_name; int m_id; bool m_fail; @@ -223,7 +221,7 @@ class Phantom Phantom& operator= (const Phantom&); // assignment operator }; -typedef slist::iterator PElemIterator; -typedef slist::const_iterator PElemConstIterator; +typedef list::iterator PElemIterator; +typedef list::const_iterator PElemConstIterator; #endif diff --git a/include/sgp.h b/include/sgp.h index 4ee4638..f30f582 100644 --- a/include/sgp.h +++ b/include/sgp.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sgp.h,v 1.19 2000/12/04 04:15:48 kevin Exp $ +** $Id: sgp.h,v 1.20 2000/12/06 01:46:43 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 @@ -47,7 +47,7 @@ extern "C" { #endif #include - +using namespace std; class SGPDriver { private: diff --git a/include/transformmatrix.h b/include/transformmatrix.h index 5274b30..6282b61 100644 --- a/include/transformmatrix.h +++ b/include/transformmatrix.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: transformmatrix.h,v 1.1 2000/07/28 08:28:08 kevin Exp $ +** $Id: transformmatrix.h,v 1.2 2000/12/06 01:46:43 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 @@ -28,7 +28,8 @@ #ifndef __H_TRANSFORMMATRIX #define __H_TRANSFORMMATRIX -class ostream; +#include + class TransformationMatrix2D { public: double mtx[3][3]; @@ -48,7 +49,7 @@ public: void transformPoint (double *pX, double *pY) const; - void print (ostream& ostr) const; + void print (std::ostream& ostr) const; friend const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs); diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index 965ef10..8d7b516 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.cpp,v 1.15 2000/09/09 09:31:12 kevin Exp $ +** $Id: ezplot.cpp,v 1.16 2000/12/06 01:46:43 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 @@ -64,47 +64,52 @@ EZPlotCurve::~EZPlotCurve () void EZPlot::addCurve (const double *y, int n) { - double x [n]; + double* x = new double [n]; for (int i = 0; i < n; i++) x[i] = i; addCurve (x, y, n); + delete x; } void EZPlot::addCurve (const float *y, int n) { - double yDouble [n]; + double* yDouble = new double [n]; for (int i = 0; i < n; i++) yDouble[i] = y[i]; addCurve (yDouble, n); + delete yDouble; } void EZPlot::addCurve (const float x[], const double y[], int num) { - double dx [num]; + double* dx = new double [num]; for (int i = 0; i < num; i++) dx[i] = x[i]; addCurve (dx, y, num); + delete dx; } void EZPlot::addCurve (const double x[], const float y[], int num) { - double dy [num]; + double* dy = new double [num]; for (int i = 0; i < num; i++) dy[i] = y[i]; addCurve (x, dy, num); + + delete dy; } @@ -338,12 +343,13 @@ EZPlot::plot () // calculate legend box boundaries int max_leg = 0; // longest legend in characters int num_leg = 0; // number of legend titles - for (EZPlotCurveConstIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) { - const EZPlotCurve& curve = **iterCurve; + for (EZPlotCurveConstIterator iterCurve2 = m_vecCurves.begin(); iterCurve2 != m_vecCurves.end(); iterCurve2++) { + const EZPlotCurve& curve = **iterCurve2; int nLegend = curve.m_sLegend.length(); if (nLegend > 0) { ++num_leg; - max_leg = max (max_leg, nLegend); + if (nLegend > max_leg) + nLegend = max_leg; } } @@ -521,8 +527,8 @@ EZPlot::plot () double symwidth = charwidth; double symheight = charheight; - for (EZPlotCurveIterator iterCurve = m_vecCurves.begin(); iterCurve != m_vecCurves.end(); iterCurve++) { - const EZPlotCurve& curve = **iterCurve; + for (EZPlotCurveIterator iterCurve3 = m_vecCurves.begin(); iterCurve3 != m_vecCurves.end(); iterCurve3++) { + const EZPlotCurve& curve = **iterCurve3; rSGP.setColor (curve.m_iColor); @@ -908,8 +914,10 @@ EZPlot::make_numfmt (char *fmtstr, int *fldwid, int *nfrac, double minval, doubl double delta = (maxval - minval) / nint; double absmin = fabs(minval); - double absmax = fabs(maxval); - double logt = log10( max(absmin, absmax) ); + double absmax = fabs(maxval); + if (absmin > absmax) + absmax = absmin; + double logt = log10( absmax ); if (fabs(logt) >= 6) { // use exponential format if (fabs(logt) > 99) diff --git a/libctgraphics/ezset.cpp b/libctgraphics/ezset.cpp index 074b287..e4f6abf 100644 --- a/libctgraphics/ezset.cpp +++ b/libctgraphics/ezset.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** - ** $Id: ezset.cpp,v 1.7 2000/07/29 19:50:08 kevin Exp $ + ** $Id: ezset.cpp,v 1.8 2000/12/06 01:46:43 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 @@ -62,7 +62,7 @@ EZPlot::ezcmd (char *comm) int code; bool retval = true; if (! pol_usertok (str, &code)) { - cerr << "Illegal EZSET command: " << str << endl; + sys_error(ERR_WARNING, "Illegal EZSET command: %s", str); pol_reader(); retval = false; } @@ -376,7 +376,7 @@ EZPlot::do_cmd (int lx) void EZPlot::bad_option (char *opt) { - cerr << opt << " is an INVALID option\n"; + sys_error (ERR_WARNING, "INVALID option: %s", opt); } /*----------------------------------------------------------------------*/ diff --git a/libctgraphics/sgp.cpp b/libctgraphics/sgp.cpp index 07e103f..3626555 100644 --- a/libctgraphics/sgp.cpp +++ b/libctgraphics/sgp.cpp @@ -7,7 +7,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sgp.cpp,v 1.16 2000/10/11 08:16:08 kevin Exp $ +** $Id: sgp.cpp,v 1.17 2000/12/06 01:46:43 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 @@ -52,14 +52,14 @@ RGBColor SGP::s_aRGBColor[] = int SGP::s_iRGBColorCount = sizeof(s_aRGBColor) / sizeof(class RGBColor); #ifdef HAVE_WXWINDOWS -SGPDriver::SGPDriver (wxDC* pDC, int xsize = 640, int ysize = 480) +SGPDriver::SGPDriver (wxDC* pDC, int xsize, int ysize) : m_iPhysicalXSize(xsize), m_iPhysicalYSize(ysize), m_idDriver(0), m_pDC(pDC) { m_idDriver |= SGPDRIVER_WXWINDOWS; } #endif -SGPDriver::SGPDriver (const char* szWinTitle = "", int xsize = 640, int ysize = 480) +SGPDriver::SGPDriver (const char* szWinTitle, int xsize, int ysize) : m_iPhysicalXSize(xsize), m_iPhysicalYSize(ysize), m_sWindowTitle(szWinTitle), m_idDriver(0) { #ifdef HAVE_G2_H diff --git a/libctgraphics/transformmatrix.cpp b/libctgraphics/transformmatrix.cpp index 7e3c73d..9edf3aa 100644 --- a/libctgraphics/transformmatrix.cpp +++ b/libctgraphics/transformmatrix.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: transformmatrix.cpp,v 1.2 2000/12/04 04:44:02 kevin Exp $ +** $Id: transformmatrix.cpp,v 1.3 2000/12/06 01:46:43 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 @@ -93,8 +93,8 @@ TransformationMatrix2D::invert () const double determ = determinant (); if (fabs(determ) < 1E-6) { sys_error (ERR_WARNING, "Determinant = %g [TransformationMatrix2D::invert]", determ); - print (cout); - cout << endl; + print (std::cout); + std::cout << std::endl; } b[0][0] = (mtx[1][1] * mtx[2][2] - mtx[2][1] * mtx[1][2]) / determ; @@ -134,11 +134,11 @@ TransformationMatrix2D::transformPoint (double* pX, double *pY) const } void -TransformationMatrix2D::print (ostream& ostr) const +TransformationMatrix2D::print (std::ostream& ostr) const { - cout << mtx[0][0] << " " << mtx[0][1] << " " << mtx[0][2] << endl; - cout << mtx[1][0] << " " << mtx[1][1] << " " << mtx[1][2] << endl; - cout << mtx[2][0] << " " << mtx[2][1] << " " << mtx[2][2] << endl; + std::cout << mtx[0][0] << " " << mtx[0][1] << " " << mtx[0][2] << std::endl; + std::cout << mtx[1][0] << " " << mtx[1][1] << " " << mtx[1][2] << std::endl; + std::cout << mtx[2][0] << " " << mtx[2][1] << " " << mtx[2][2] << std::endl; } diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index 2999470..b16c7d3 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.14 2000/12/04 19:50:57 kevin Exp $ +** $Id: array2dfile.cpp,v 1.15 2000/12/06 01:46:43 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 @@ -392,7 +392,7 @@ Array2dFile::headerWrite (frnetorderstream& fs) fs.writeFloat64 (m_offsetPV); fs.writeFloat64 (m_scalePV); - m_headersize = fs.tellp(); + m_headersize = static_cast(fs.tellp()); fs.seekp (0); fs.writeInt16 (m_headersize); @@ -480,12 +480,12 @@ Array2dFile::labelsRead (frnetorderstream& fs) kuint16 strLength; fs.readInt16 (strLength); - char* labelStr = new char [strLength+1]; - fs.read (labelStr, strLength); - labelStr[strLength] = 0; + char* pszLabelStr = new char [strLength+1]; + fs.read (pszLabelStr, strLength); + pszLabelStr[strLength] = 0; - Array2dFileLabel* pLabel = new Array2dFileLabel(labelType, labelStr, calcTime); - delete labelStr; + Array2dFileLabel* pLabel = new Array2dFileLabel (labelType, pszLabelStr, calcTime); + delete pszLabelStr; pLabel->setDateTime (year, month, day, hour, minute, second); m_labels.push_back (pLabel); diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index 5f674ec..ecdc3fd 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.16 2000/12/04 19:50:57 kevin Exp $ +** $Id: backprojectors.cpp,v 1.17 2000/12/06 01:46:43 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 @@ -359,7 +359,7 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double // Precalculates trigometric function value for each point in image for backprojection. BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) - : Backproject::Backproject (proj, im, interpType, interpFactor) + : Backproject (proj, im, interpType, interpFactor) { arrayR.initSetSize (im.nx(), im.ny()); arrayPhi.initSetSize (im.nx(), im.ny()); @@ -421,7 +421,7 @@ BackprojectTable::BackprojectView (const double* const filteredProj, const doubl // Iterates in x & y direction by adding difference in L position BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) - : Backproject::Backproject (proj, im, interpType, interpFactor) + : Backproject (proj, im, interpType, interpFactor) { // calculate center of first pixel v[0][0] double x = xMin + xInc / 2; diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index 9657755..803347f 100644 --- a/libctsim/imagefile.cpp +++ b/libctsim/imagefile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: imagefile.cpp,v 1.16 2000/12/04 05:36:57 kevin Exp $ +** $Id: imagefile.cpp,v 1.17 2000/12/06 01:46:43 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 @@ -29,24 +29,24 @@ F32Image::F32Image (int nx, int ny) - : Array2dFile::Array2dFile (nx, ny, sizeof(kfloat32), Array2dFile::PIXEL_FLOAT32) + : Array2dFile (nx, ny, sizeof(kfloat32), Array2dFile::PIXEL_FLOAT32) { } -F32Image::F32Image (void)[ - : Array2dFile::Array2dFile() +F32Image::F32Image (void) + : Array2dFile() { setPixelFormat (Array2dFile::PIXEL_FLOAT32); setPixelSize (sizeof(kfloat32)); } F64Image::F64Image (int nx, int ny) - : Array2dFile::Array2dFile (nx, ny, sizeof(kfloat64), Array2dFile::PIXEL_FLOAT64) + : Array2dFile (nx, ny, sizeof(kfloat64), Array2dFile::PIXEL_FLOAT64) { } F64Image::F64Image (void) - : Array2dFile::Array2dFile () + : Array2dFile () { setPixelFormat (PIXEL_FLOAT64); setPixelSize (sizeof(kfloat64)); @@ -159,14 +159,14 @@ ImageFile::comparativeStatistics (const ImageFile& imComp, double& d, double& r, double absErrorSum = 0.; double sqDiffFromMeanSum = 0.; double absValueSum = 0.; - for (unsigned int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix2 = 0; ix2 < m_nx; ix2++) { for (unsigned int iy = 0; iy < m_ny; iy++) { - double diff = v[ix][iy] - vComp[ix][iy]; + double diff = v[ix2][iy] - vComp[ix2][iy]; sqErrorSum += diff * diff; absErrorSum += fabs(diff); - double diffFromMean = v[ix][iy] - myMean; + double diffFromMean = v[ix2][iy] - myMean; sqDiffFromMeanSum += diffFromMean * diffFromMean; - absValueSum += fabs(v[ix][iy]); + absValueSum += fabs(v[ix2][iy]); } } @@ -176,10 +176,10 @@ ImageFile::comparativeStatistics (const ImageFile& imComp, double& d, double& r, int hx = m_nx / 2; int hy = m_ny / 2; double eMax = -1; - for (int ix = 0; ix < hx; ix++) { + for (int ix3 = 0; ix3 < hx; ix3++) { for (int iy = 0; iy < hy; iy++) { - double avgPixel = 0.25 * (v[2*ix][2*iy] + v[2*ix+1][2*iy] + v[2*ix][2*iy+1] + v[2*ix+1][2*iy+1]); - double avgPixelComp = 0.25 * (vComp[2*ix][2*iy] + vComp[2*ix+1][2*iy] + vComp[2*ix][2*iy+1] + vComp[2*ix+1][2*iy+1]); + double avgPixel = 0.25 * (v[2*ix3][2*iy] + v[2*ix3+1][2*iy] + v[2*ix3][2*iy+1] + v[2*ix3+1][2*iy+1]); + double avgPixelComp = 0.25 * (vComp[2*ix3][2*iy] + vComp[2*ix3+1][2*iy] + vComp[2*ix3][2*iy+1] + vComp[2*ix3+1][2*iy+1]); double error = fabs (avgPixel - avgPixelComp); if (error > eMax) eMax = error; @@ -252,9 +252,9 @@ ImageFile::statistics (double& min, double& max, double& mean, double& mode, dou double spread = max - min; mode = 0; stddev = 0; - for (int ix = 0; ix < nx; ix++) { + for (int ix4 = 0; ix4 < nx; ix4++) { for (int iy = 0; iy < ny; iy++) { - int b = static_cast((((v[ix][iy] - min) / spread) * (nbin - 1)) + 0.5); + int b = static_cast((((v[ix4][iy] - min) / spread) * (nbin - 1)) + 0.5); hist[b]++; double diff = (v[ix][iy] - mean); stddev += diff * diff; @@ -274,12 +274,12 @@ ImageFile::statistics (double& min, double& max, double& mean, double& mode, dou mode = (max_binindex * spread / (nbin - 1)) + min; int nPixels = nx * ny; - slist vecImage; - for (int ix = 0; ix < nx; ix++) + list vecImage; + for (int ix5 = 0; ix5 < nx; ix5++) for (int iy = 0; iy < ny; iy++) - vecImage.push_front (v[ix][iy]); + vecImage.push_front (v[ix5][iy]); vecImage.sort(); - slist::const_iterator iter = vecImage.begin(); + list::const_iterator iter = vecImage.begin(); for (int i = 0; i < (nPixels / 2) - 1; i++) iter++; // Advance iterator to (nPixels / 2) - 1; @@ -321,7 +321,7 @@ ImageFile::writeImagePGM (const char *outfile, int nxcell, int nycell, double de int ny = m_ny; ImageFileArray v = getArray(); - unsigned char rowp [nx * nxcell]; + unsigned char* rowp = new unsigned char [nx * nxcell]; if ((fp = fopen (outfile, "wb")) == NULL) return; @@ -344,7 +344,8 @@ ImageFile::writeImagePGM (const char *outfile, int nxcell, int nycell, double de fputc( rowp[ic], fp ); } } - + + delete rowp; fclose(fp); } @@ -356,7 +357,7 @@ ImageFile::writeImagePGMASCII (const char *outfile, int nxcell, int nycell, doub int ny = m_ny; ImageFileArray v = getArray(); - unsigned char rowp [nx * nxcell]; + unsigned char* rowp = new unsigned char [nx * nxcell]; if ((fp = fopen (outfile, "wb")) == NULL) return; @@ -380,7 +381,8 @@ ImageFile::writeImagePGMASCII (const char *outfile, int nxcell, int nycell, doub fprintf(fp, "\n"); } } - + + delete rowp; fclose(fp); } diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 6058ce7..6e3537d 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.20 2000/12/04 05:36:57 kevin Exp $ +** $Id: phantom.cpp,v 1.21 2000/12/06 01:46:43 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 @@ -27,8 +27,8 @@ #include "ct.h" -const int Phantom::POINTS_PER_CIRCLE = 360; -const double Phantom::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% +const int PhantomElement::POINTS_PER_CIRCLE = 360; +const double PhantomElement::SCALE_PELEM_EXTENT=0.005; // increase pelem limits by 0.5% const int Phantom::PHM_INVALID = -1; const int Phantom::PHM_HERMAN = 0; diff --git a/libctsim/procsignal.cpp b/libctsim/procsignal.cpp index 5a52c03..db00df7 100644 --- a/libctsim/procsignal.cpp +++ b/libctsim/procsignal.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: procsignal.cpp,v 1.7 2000/09/07 14:29:05 kevin Exp $ +** $Id: procsignal.cpp,v 1.8 2000/12/06 01:46:43 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 @@ -176,7 +176,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw m_dFilterInc = (m_dFilterMax - m_dFilterMin) / (m_nFilterPoints - 1); SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, m_nFilterPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_FREQUENCY); m_adFilter = new double[ m_nFilterPoints ]; - double adFrequencyFilter [m_nFilterPoints]; + double* adFrequencyFilter = new double [m_nFilterPoints]; filter.copyFilterData (adFrequencyFilter, 0, m_nFilterPoints); #ifdef HAVE_SGP EZPlot* pEZPlot = NULL; @@ -199,6 +199,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw } #endif ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, -1); + delete adFrequencyFilter; #ifdef HAVE_SGP if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order"); @@ -333,7 +334,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw if (m_traceLevel >= Trace::TRACE_CONSOLE) cout << "nFilterPoints = " << m_nFilterPoints << endl; #endif - double adSpatialFilter [m_nFilterPoints]; + double* adSpatialFilter = new double [m_nFilterPoints]; SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL); filter.copyFilterData (adSpatialFilter, 0, nSpatialPoints); #ifdef HAVE_SGP @@ -362,15 +363,18 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw double dScale = 0.5 * sinScale * sinScale; adSpatialFilter[i] *= dScale; } - } - for (int i = nSpatialPoints; i < m_nFilterPoints; i++) + } + int i; + for (i = nSpatialPoints; i < m_nFilterPoints; i++) adSpatialFilter[i] = 0; m_adFilter = new double [m_nFilterPoints]; - complex acInverseFilter [m_nFilterPoints]; + complex* acInverseFilter = new complex [m_nFilterPoints]; finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, 1); - for (int i = 0; i < m_nFilterPoints; i++) - m_adFilter[i] = abs(acInverseFilter[i]) * m_dSignalInc; + delete adSpatialFilter; + for (i = 0; i < m_nFilterPoints; i++) + m_adFilter[i] = abs(acInverseFilter[i]) * m_dSignalInc; + delete acInverseFilter; #ifdef HAVE_SGP if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) { pEZPlot->ezset ("title Spatial Filter: Inverse"); @@ -378,7 +382,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw pEZPlot->ezset ("yporigin 0.50"); pEZPlot->addCurve (m_adFilter, m_nFilterPoints); pEZPlot->plot(); - delete pEZPlot; + delete pEZPlot; } #endif } @@ -386,7 +390,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw // precalculate sin and cosine tables for fourier transform if (m_idFilterMethod == FILTER_METHOD_FOURIER_TABLE) { - int nFourier = max(m_nFilterPoints,m_nOutputPoints) * max(m_nFilterPoints, m_nOutputPoints) + 1; + int nFourier = imax (m_nFilterPoints,m_nOutputPoints) * imax (m_nFilterPoints, m_nOutputPoints) + 1; double angleIncrement = (2. * PI) / m_nFilterPoints; m_adFourierCosTable = new double[ nFourier ]; m_adFourierSinTable = new double[ nFourier ]; @@ -523,8 +527,9 @@ ProcessSignal::convertFilterGenerationIDToTitle (const int fgID) void ProcessSignal::filterSignal (const float constInput[], double output[]) const { - double input [m_nSignalPoints]; - for (int i = 0; i < m_nSignalPoints; i++) + double* input = new double [m_nSignalPoints]; + int i; + for (i = 0; i < m_nSignalPoints; i++) input[i] = constInput[i]; if (m_idGeometry == Scanner::GEOMETRY_EQUILINEAR) { @@ -537,38 +542,44 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const int iDetFromCenter = i - (m_nSignalPoints / 2); input[i] *= m_dFocalLength * cos (iDetFromCenter * m_dSignalInc); } - } + } if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION) { - for (int i = 0; i < m_nSignalPoints; i++) + for (i = 0; i < m_nSignalPoints; i++) output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints); } else if (m_idFilterMethod == FILTER_METHOD_FOURIER) { - double inputSignal[m_nFilterPoints]; - for (int i = 0; i < m_nSignalPoints; i++) + double* inputSignal = new double [m_nFilterPoints]; + for (i = 0; i < m_nSignalPoints; i++) inputSignal[i] = input[i]; - for (int i = m_nSignalPoints; i < m_nFilterPoints; i++) + for (i = m_nSignalPoints; i < m_nFilterPoints; i++) inputSignal[i] = 0; // zeropad - complex fftSignal[m_nFilterPoints]; - finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, -1); - for (int i = 0; i < m_nFilterPoints; i++) + complex* fftSignal = new complex [m_nFilterPoints]; + finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, -1); + delete inputSignal; + for (i = 0; i < m_nFilterPoints; i++) fftSignal[i] *= m_adFilter[i]; - double inverseFourier[m_nFilterPoints]; - finiteFourierTransform (fftSignal, inverseFourier, m_nFilterPoints, 1); - for (int i = 0; i < m_nSignalPoints; i++) - output[i] = inverseFourier[i]; + double* inverseFourier = new double [m_nFilterPoints]; + finiteFourierTransform (fftSignal, inverseFourier, m_nFilterPoints, 1); + delete fftSignal; + for (i = 0; i < m_nSignalPoints; i++) + output[i] = inverseFourier[i]; + delete inverseFourier; } else if (m_idFilterMethod == FILTER_METHOD_FOURIER_TABLE) { - double inputSignal[m_nFilterPoints]; - for (int i = 0; i < m_nSignalPoints; i++) + double* inputSignal = new double [m_nFilterPoints]; + for (i = 0; i < m_nSignalPoints; i++) inputSignal[i] = input[i]; - for (int i = m_nSignalPoints; i < m_nFilterPoints; i++) + for (i = m_nSignalPoints; i < m_nFilterPoints; i++) inputSignal[i] = 0; // zeropad - complex fftSignal[m_nFilterPoints]; - finiteFourierTransform (inputSignal, fftSignal, -1); - for (int i = 0; i < m_nFilterPoints; i++) + complex* fftSignal = new complex [m_nFilterPoints]; + finiteFourierTransform (inputSignal, fftSignal, -1); + delete inputSignal; + for (i = 0; i < m_nFilterPoints; i++) fftSignal[i] *= m_adFilter[i]; - double inverseFourier[m_nFilterPoints]; - finiteFourierTransform (fftSignal, inverseFourier, 1); - for (int i = 0; i < m_nSignalPoints; i++) - output[i] = inverseFourier[i]; + double* inverseFourier = new double [m_nFilterPoints]; + finiteFourierTransform (fftSignal, inverseFourier, 1); + delete fftSignal; + for (i = 0; i < m_nSignalPoints; i++) + output[i] = inverseFourier[i]; + delete inverseFourier; } #if HAVE_FFTW else if (m_idFilterMethod == FILTER_METHOD_RFFTW) { @@ -601,7 +612,8 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const for (int i = 0; i < m_nSignalPoints * m_iPreinterpolationFactor; i++) output[i] = ifftOutput[i].re; } -#endif +#endif + delete input; } @@ -670,11 +682,12 @@ for (int i = 0; i < np; i++) void ProcessSignal::finiteFourierTransform (const double input[], double output[], const int n, int direction) { - complex complexOutput[n]; + complex* complexOutput = new complex [n]; finiteFourierTransform (input, complexOutput, n, direction); for (int i = 0; i < n; i++) - output[i] = complexOutput[i].real(); + output[i] = complexOutput[i].real(); + delete [] complexOutput; } void @@ -848,25 +861,26 @@ ProcessSignal::finiteFourierTransform (const complex input[], double out void ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n) { - double* pdTemp = new double [n]; + double* pdTemp = new double [n]; + int i; if (n % 2) { // Odd int iHalfN = (n - 1) / 2; pdTemp[0] = pdVector[iHalfN]; - for (int i = 0; i < iHalfN; i++) + for (i = 0; i < iHalfN; i++) pdTemp[i + 1] = pdVector[i + 1 + iHalfN]; - for (int i = 0; i < iHalfN; i++) + for (i = 0; i < iHalfN; i++) pdTemp[i + iHalfN + 1] = pdVector[i]; } else { // Even int iHalfN = n / 2; pdTemp[0] = pdVector[iHalfN]; - for (int i = 0; i < iHalfN; i++) + for (i = 0; i < iHalfN; i++) pdTemp[i + 1] = pdVector[i + iHalfN]; - for (int i = 0; i < iHalfN - 1; i++) + for (i = 0; i < iHalfN - 1; i++) pdTemp[i + iHalfN + 1] = pdVector[i]; } - for (int i = 0; i < n; i++) + for (i = 0; i < n; i++) pdVector[i] = pdTemp[i]; delete pdTemp; } @@ -875,25 +889,26 @@ ProcessSignal::shuffleNaturalToFourierOrder (double* pdVector, const int n) void ProcessSignal::shuffleFourierToNaturalOrder (double* pdVector, const int n) { - double* pdTemp = new double [n]; + double* pdTemp = new double [n]; + int i; if (n % 2) { // Odd int iHalfN = (n - 1) / 2; - pdTemp[iHalfN] = pdVector[0]; - for (int i = 0; i < iHalfN; i++) + pdTemp[iHalfN] = pdVector[0]; + for (i = 0; i < iHalfN; i++) pdTemp[i + 1 + iHalfN] = pdVector[i + 1]; - for (int i = 0; i < iHalfN; i++) + for (i = 0; i < iHalfN; i++) pdTemp[i] = pdVector[i + iHalfN + 1]; } else { // Even int iHalfN = n / 2; pdTemp[iHalfN] = pdVector[0]; - for (int i = 0; i < iHalfN; i++) + for (i = 0; i < iHalfN; i++) pdTemp[i] = pdVector[i + iHalfN]; - for (int i = 0; i < iHalfN - 1; i++) + for (i = 0; i < iHalfN - 1; i++) pdTemp[i + iHalfN + 1] = pdVector[i+1]; } - for (int i = 0; i < n; i++) + for (i = 0; i < n; i++) pdVector[i] = pdTemp[i]; delete pdTemp; } diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index ea3074b..7de8203 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.27 2000/12/04 05:36:57 kevin Exp $ +** $Id: projections.cpp,v 1.28 2000/12/06 01:46:43 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 @@ -254,14 +254,15 @@ Projections::headerRead (fnetorderstream& fs) return false; } - char remarkStorage[_remarksize+1]; - fs.read (remarkStorage, _remarksize); + char* pszRemarkStorage = new char [_remarksize+1]; + fs.read (pszRemarkStorage, _remarksize); if (! fs) { sys_error (ERR_SEVERE, "Error reading remark, _remarksize = %d", _remarksize); return false; } - remarkStorage[_remarksize] = 0; - m_remark = remarkStorage; + pszRemarkStorage[_remarksize] = 0; + m_remark = pszRemarkStorage; + delete pszRemarkStorage; off_t _hsizeread = fs.tellg(); if (!fs || _hsizeread != _hsize) { diff --git a/libctsim/reconstruct.cpp b/libctsim/reconstruct.cpp index 8e09a16..58f17bc 100644 --- a/libctsim/reconstruct.cpp +++ b/libctsim/reconstruct.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: reconstruct.cpp,v 1.1 2000/09/02 05:13:57 kevin Exp $ +** $Id: reconstruct.cpp,v 1.2 2000/12/06 01:46:43 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 @@ -139,7 +139,7 @@ Reconstructor::reconstructAllViews () void Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP) { - double adFilteredProj [m_nFilteredProjections]; // filtered projections + double* adFilteredProj = new double [m_nFilteredProjections]; // filtered projections if (iViewCount <= 0) iViewCount = m_rProj.nView() - iStartView; @@ -195,5 +195,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP) } #endif //HAVE_SGP } + + delete adFilteredProj; } diff --git a/libctsim/scanner.cpp b/libctsim/scanner.cpp index 77fbb1e..c8c8663 100644 --- a/libctsim/scanner.cpp +++ b/libctsim/scanner.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: scanner.cpp,v 1.16 2000/12/03 12:22:46 kevin Exp $ +** $Id: scanner.cpp,v 1.17 2000/12/06 01:46:43 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 @@ -260,7 +260,7 @@ Scanner::collectProjections (Projections& proj, const Phantom& phm, const int tr } void -Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iStartView, const int iNumViews, bool bStoreAtViewPosition, const int trace, SGP* pSGP = NULL) +Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iStartView, const int iNumViews, bool bStoreAtViewPosition, const int trace, SGP* pSGP) { m_trace = trace; double start_angle = iStartView * proj.rotInc(); @@ -532,7 +532,11 @@ Scanner::traceShowParamRasterOp (int iRasterOp, const char *szLabel, const char { char szValue[256]; - vsnprintf (szValue, sizeof(szValue), fmt, args); +#ifdef MSVC + vsprintf (szValue, fmt, args); +#else + vnsprintf (szValue, sizeof(szValue), fmt, args); +#endif // cio_set_cpos (raysum_trace_menu_column, row); // cio_set_text_clr (color - 8, 0); diff --git a/libctsupport/clip.cpp b/libctsupport/clip.cpp index f99c20f..2123c29 100644 --- a/libctsupport/clip.cpp +++ b/libctsupport/clip.cpp @@ -14,7 +14,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: clip.cpp,v 1.4 2000/07/23 01:49:03 kevin Exp $ +** $Id: clip.cpp,v 1.5 2000/12/06 01:46:43 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 @@ -331,7 +331,7 @@ tcode (const double x, const double y, const double m, const double b, const int static int rectcode (double x, double y, const double rect[4]); -int +bool clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]) { double x = 0, y = 0; diff --git a/libctsupport/syserror.cpp b/libctsupport/syserror.cpp index 6d0900d..06ee4ee 100644 --- a/libctsupport/syserror.cpp +++ b/libctsupport/syserror.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: syserror.cpp,v 1.6 2000/09/07 04:31:41 kevin Exp $ +** $Id: syserror.cpp,v 1.7 2000/12/06 01:46:43 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 @@ -65,27 +65,27 @@ void sys_verror (int severity, const char *msg, va_list arg) if (nErrorCount > MAX_ERROR_COUNT) return; else if (nErrorCount == MAX_ERROR_COUNT) { - cout << "*****************************************************************" << endl; - cout << "*** M A X I M U M E R R O R C O U N T R E A C H E D ***" << endl; - cout << "*** ***" << endl; - cout << "*** No further errors will be reported ***" << endl; - cout << "*****************************************************************" << endl; + std::cout << "*****************************************************************\n"; + std::cout << "*** M A X I M U M E R R O R C O U N T R E A C H E D ***\n"; + std::cout << "*** ***\n"; + std::cout << "*** No further errors will be reported ***\n"; + std::cout << "*****************************************************************\n"; return; } } switch (severity) { case ERR_FATAL: - cout << "FATAL ERROR: "; + std::cout << "FATAL ERROR: "; break; case ERR_SEVERE: - cout << "SEVERE ERROR: "; + std::cout << "SEVERE ERROR: "; break; case ERR_WARNING: - cout << "WARNING ERROR: "; + std::cout << "WARNING ERROR: "; break; default: - cout << "Illegal error code #" << severity << ": "; + std::cout << "Illegal error code #" << severity << ": "; } char errStr[512]; @@ -95,13 +95,13 @@ void sys_verror (int severity, const char *msg, va_list arg) vsprintf (errStr, msg, arg); #endif - cout << errStr << endl; + std::cout << errStr << std::endl; if (severity == ERR_FATAL) - throw runtime_error (errStr); + throw std::runtime_error (errStr); #if INTERACTIVE_ERROR_DISPLAY - cout << "A - Abort C - Continue W - Turn off warnings? "; + std::cout << "A - Abort C - Continue W - Turn off warnings? "; // fflush(stderr); do { -- 2.34.1