]> Creatis software - gdcm.git/commitdiff
BUG: Remove demangle code this was seg faulting on some linux gcc 3.3.2 machine
authormalaterre <malaterre>
Thu, 4 Nov 2004 18:14:34 +0000 (18:14 +0000)
committermalaterre <malaterre>
Thu, 4 Nov 2004 18:14:34 +0000 (18:14 +0000)
src/gdcmDocument.cxx
src/gdcmException.cxx
src/gdcmException.h
src/gdcmPixelConvert.cxx

index 8f9f138208e923c543fe4c33b9db2fb025722db2..615f8acd32386d3703f8d1e159e26483061d2c54 100644 (file)
@@ -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;
index ee39112f1178e873ebb7c26fccf61abfd79f2a89..3bda375a2ef15153a1818bf4b258164be3006973 100644 (file)
@@ -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(...) {
index 1fb07a96e55e3cc1ca7c4fd83403f7a6b9dc26e7..b1875b5880a8840c0b8bbcd2660aabff9916f6fc 100644 (file)
@@ -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 ) { }
 };
 
index 5abd6c4ef99cb8ca080c10fe28bf4300a9cc478d..dccf178e9ae5cb32fcce25680d1fb8a88e761873 100644 (file)
@@ -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();