From 0fd97a2f44764117b637de53e09b8a329ca133f8 Mon Sep 17 00:00:00 2001 From: malaterre Date: Thu, 4 Nov 2004 18:14:34 +0000 Subject: [PATCH] BUG: Remove demangle code this was seg faulting on some linux gcc 3.3.2 machine --- src/gdcmDocument.cxx | 20 +++++++++++++++----- src/gdcmException.cxx | 10 +++++----- src/gdcmException.h | 8 ++++---- src/gdcmPixelConvert.cxx | 6 +++--- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 8f9f1382..615f8acd 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/11/03 18:14:52 $ - Version: $Revision: 1.115 $ + Date: $Date: 2004/11/04 18:14:34 $ + Version: $Revision: 1.116 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -2292,7 +2292,7 @@ uint16_t Document::ReadInt16() Fp->read ((char*)&g, (size_t)2); if ( Fp->fail() ) { - throw FormatError( "Document::ReadInt16()", " file error." ); + throw FormatError( "Document::ReadInt16()", " file error." ); } if( Fp->eof() ) { @@ -2685,8 +2685,18 @@ bool Document::ReadTag(uint16_t testGroup, uint16_t testElement) //// Read the Item Tag group and element, and make // sure they are what we expected: - uint16_t itemTagGroup = ReadInt16(); - uint16_t itemTagElement = ReadInt16(); + uint16_t itemTagGroup; + uint16_t itemTagElement; + try + { + itemTagGroup = ReadInt16(); + itemTagElement = ReadInt16(); + } + catch ( FormatError e ) + { + //std::cerr << e << std::endl; + return false; + } if ( itemTagGroup != testGroup || itemTagElement != testElement ) { std::ostringstream s; diff --git a/src/gdcmException.cxx b/src/gdcmException.cxx index ee39112f..3bda375a 100644 --- a/src/gdcmException.cxx +++ b/src/gdcmException.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmException.cxx,v $ Language: C++ - Date: $Date: 2004/10/28 19:58:05 $ - Version: $Revision: 1.21 $ + Date: $Date: 2004/11/04 18:14:34 $ + Version: $Revision: 1.22 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -80,7 +80,7 @@ std::string Exception::getName() const throw() { try { -#ifdef __GNUC__ // GNU C++ compiler class name demangling +#if defined(__GNUC__) && 0 // GNU C++ compiler class name demangling unsigned int nested = 1, i, nb; int offset; std::string one; @@ -102,8 +102,8 @@ std::string Exception::getName() const throw() } return name; #else // no class name demangling - //name = typeid(*this).name(); - return "Exception"; + std::string name = typeid(*this).name(); + return name; #endif } catch(...) { diff --git a/src/gdcmException.h b/src/gdcmException.h index 1fb07a96..b1875b58 100644 --- a/src/gdcmException.h +++ b/src/gdcmException.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmException.h,v $ Language: C++ - Date: $Date: 2004/10/12 04:35:46 $ - Version: $Revision: 1.17 $ + Date: $Date: 2004/11/04 18:14:34 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -108,7 +108,7 @@ public: /// @param from name of the thrower /// @param error error description string explicit FormatUnexpected(const std::string &from, - const std::string &error = "Unexpected file format") + const std::string &error = "Unexpected file format") throw() : Exception( from, error ) { } }; @@ -124,7 +124,7 @@ public: /// @param from name of the thrower /// @param error error description string explicit FormatError(const std::string &from, - const std::string &error = "Invalid file format") + const std::string &error = "Invalid file format") throw() : FormatUnexpected( from, error ) { } }; diff --git a/src/gdcmPixelConvert.cxx b/src/gdcmPixelConvert.cxx index 5abd6c4e..dccf178e 100644 --- a/src/gdcmPixelConvert.cxx +++ b/src/gdcmPixelConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelConvert.cxx,v $ Language: C++ - Date: $Date: 2004/10/28 22:21:57 $ - Version: $Revision: 1.22 $ + Date: $Date: 2004/11/04 18:14:34 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -755,7 +755,7 @@ void PixelConvert::GrabInformationsFromHeader( Header* header ) { // Just in case some access to a Header element requires disk access. // Note: gdcmDocument::Fp is leaved open after OpenFile. - std::ifstream* fp = header->OpenFile(); + std::ifstream* fp = header->OpenFile(); // Number of Bits Allocated for storing a Pixel is defaulted to 16 // when absent from the header. BitsAllocated = header->GetBitsAllocated(); -- 2.46.1