From c18918976d098c542e4675ddebe5b59525277525 Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 14 Dec 2018 12:12:54 -0500 Subject: avoid segv --- tksao/fitsy++/hist.C | 5 +++-- tksao/frame/grid25d.C | 11 +++++------ tksao/frame/grid25d.h | 2 +- tksao/frame/grid2d.C | 11 +++++------ tksao/frame/grid2d.h | 2 +- tksao/frame/grid3d.C | 9 ++++----- tksao/frame/grid3d.h | 2 +- 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tksao/fitsy++/hist.C b/tksao/fitsy++/hist.C index 2c831fa..970bc02 100644 --- a/tksao/fitsy++/hist.C +++ b/tksao/fitsy++/hist.C @@ -476,10 +476,11 @@ void FitsHist::mapWCSString(FitsHead* head, char* w, ostr1 << out << "1" << w << ends; ostr2 << out << "2" << w << ends; - if (head->find(istr1.str().c_str()) || - head->find(istr2.str().c_str())) { + if (head->find(istr1.str().c_str())) { char* cc1 = head->getString(istr1.str().c_str()); head_->appendString(ostr1.str().c_str(), cc1, NULL); + } + if (head->find(istr2.str().c_str())) { char* cc2 = head->getString(istr2.str().c_str()); head_->appendString(ostr2.str().c_str(), cc2, NULL); } diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 53712fa..7d4d039 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -19,7 +19,7 @@ Grid25d::Grid25d(Widget* p, Coord::CoordSystem sys, Coord::SkyFrame sky, Grid25d::~Grid25d() {} -int Grid25d::doit(RenderMode rm) +void Grid25d::doit(RenderMode rm) { Frame3dBase* pp = (Frame3dBase*)parent_; astGrid25dPtr =NULL; @@ -32,7 +32,7 @@ int Grid25d::doit(RenderMode rm) Context* context = pp->keyContext; FitsImage* fits = context->fits; if (!fits) - return 1; + return; astClearStatus; // just to make sure astBegin; // start memory management @@ -58,13 +58,13 @@ int Grid25d::doit(RenderMode rm) // ast_ maybe NULL if (!fits->ast_) { astEnd; // now, clean up memory - return 1; + return; } // set desired skyformat if (!fits->wcsInv()) { astEnd; // now, clean up memory - return 1; + return; } AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); @@ -77,7 +77,7 @@ int Grid25d::doit(RenderMode rm) case 1: // error astEnd; // now, clean up memory - return 0; + return; case 2: break; case 3: @@ -133,7 +133,6 @@ int Grid25d::doit(RenderMode rm) astEnd; // now, clean up memory astGrid25dPtr =NULL; - return 1; } void Grid25d::matrixMap(void* frameSet, Matrix& mx, const char* str) diff --git a/tksao/frame/grid25d.h b/tksao/frame/grid25d.h index 269197e..61b1389 100644 --- a/tksao/frame/grid25d.h +++ b/tksao/frame/grid25d.h @@ -12,7 +12,7 @@ class Grid25d : public Grid, public Grid25dBase { private: void matrixMap(void*, Matrix&, const char*); - int doit(RenderMode); + void doit(RenderMode); public: Grid25d(Widget*, Coord::CoordSystem, Coord::SkyFrame, diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index 499e4d0..cafd702 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -19,7 +19,7 @@ Grid2d::Grid2d(Widget* p, Coord::CoordSystem sys, Coord::SkyFrame sky, Grid2d::~Grid2d() {} -int Grid2d::doit(RenderMode rm) +void Grid2d::doit(RenderMode rm) { FrameBase* pp = (FrameBase*)parent_; astGrid2dPtr =NULL; @@ -32,7 +32,7 @@ int Grid2d::doit(RenderMode rm) Context* context = pp->keyContext; FitsImage* fits = context->fits; if (!fits) - return 1; + return; astClearStatus; // just to make sure astBegin; // start memory management @@ -58,13 +58,13 @@ int Grid2d::doit(RenderMode rm) // ast_ maybe NULL if (!fits->ast_) { astEnd; // now, clean up memory - return 1; + return; } // set desired skyformat if (!fits->wcsInv()) { astEnd; // now, clean up memory - return 1; + return; } AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); @@ -77,7 +77,7 @@ int Grid2d::doit(RenderMode rm) case 1: // error astEnd; // now, clean up memory - return 0; + return; case 2: break; case 3: @@ -154,7 +154,6 @@ int Grid2d::doit(RenderMode rm) astEnd; // now, clean up memory astGrid2dPtr =NULL; - return 1; } void Grid2d::matrixMap(void* frameSet, Matrix& mx, const char* str) diff --git a/tksao/frame/grid2d.h b/tksao/frame/grid2d.h index 6b093a0..52b4328 100644 --- a/tksao/frame/grid2d.h +++ b/tksao/frame/grid2d.h @@ -12,7 +12,7 @@ class Grid2d : public Grid, public Grid2dBase { private: void matrixMap(void*, Matrix&, const char*); - int doit(RenderMode); + void doit(RenderMode); public: Grid2d(Widget*, Coord::CoordSystem, Coord::SkyFrame, diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index 91cfb69..877a457 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -19,7 +19,7 @@ Grid3d::Grid3d(Widget* p, Coord::CoordSystem sys, Coord::SkyFrame sky, Grid3d::~Grid3d() {} -int Grid3d::doit(RenderMode rm) +void Grid3d::doit(RenderMode rm) { Frame3dBase* pp = (Frame3dBase*)parent_; astGrid3dPtr =NULL; @@ -41,7 +41,7 @@ int Grid3d::doit(RenderMode rm) Context* context = pp->keyContext; FitsImage* fits = context->fits; if (!fits) - return 1; + return; astClearStatus; // just to make sure astBegin; // start memory management @@ -60,12 +60,12 @@ int Grid3d::doit(RenderMode rm) // ast_ maybe NULL if (!fits->ast_) { astEnd; // now, clean up memory - return 1; + return; } if (!fits->wcsInv()) { astEnd; // now, clean up memory - return 1; + return; } AstFrameSet* ast = (AstFrameSet*)astCopy(fits->ast_); @@ -151,7 +151,6 @@ int Grid3d::doit(RenderMode rm) astEnd; // now, clean up memory astGrid3dPtr =NULL; - return 1; } void Grid3d::matrixMap(void* frameSet, Matrix3d& mx, const char* str) diff --git a/tksao/frame/grid3d.h b/tksao/frame/grid3d.h index 642df14..f8af24b 100644 --- a/tksao/frame/grid3d.h +++ b/tksao/frame/grid3d.h @@ -12,7 +12,7 @@ class Grid3d : public Grid, public Grid3dBase { private: void matrixMap(void*, Matrix3d&, const char*); - int doit(RenderMode); + void doit(RenderMode); public: Grid3d(Widget*, Coord::CoordSystem, Coord::SkyFrame, -- cgit v0.12