]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
Some checking added
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 19c473391b7e7062c3a43ad1dd062cd0a0b92cb3..56f5646b85814d3ae0bbb79aa6b1cabc31154077 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/04/15 21:41:43 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2005/04/19 10:05:36 $
+  Version:   $Revision: 1.39 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -20,7 +20,6 @@
 #include "gdcmFileHelper.h"
 
 #include <iostream>
-#include <fstream>
 
 //Generated file:
 #include "gdcmDataImages.h"
@@ -76,19 +75,19 @@ private:
    bool WriteFileData(std::ofstream *fp);
 
    uint8_t  ReadInt8 (std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
- throw( std::ofstream::failure );
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
+ throw( std::ios::failure );
 #else
  ;
 #endif
    uint16_t ReadInt16(std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
   throw( std::ios::failure );
 #else
  ;
 #endif
    uint32_t ReadInt32(std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
   throw( std::ios::failure );
 #else
  ;
@@ -103,8 +102,8 @@ private:
    int sizeX;
    int sizeY;
    int sizeZ;
-   int scalarSize;
-   int components;
+   uint16_t scalarSize;
+   uint16_t components;
    uint8_t *data;
    int swapCode;
 
@@ -248,7 +247,7 @@ bool TestFile::ReadFileHeader(std::ifstream *fp)
    sizeY = ReadInt32(fp); // Size Y
    sizeZ = ReadInt32(fp); // Size Z
    scalarSize = ReadInt16(fp)/8; // bits per scalar
-   components = ReadInt16(fp); // Number of components
+   components = ReadInt16(fp);   // Number of components
 
    return(true);
 }
@@ -294,7 +293,7 @@ bool TestFile::WriteFileHeader(std::ofstream *fp)
    WriteInt32(fp,sizeY); // Size Y
    WriteInt32(fp,sizeZ); // Size Z
    WriteInt16(fp,scalarSize*8); // bits per scalar
-   WriteInt16(fp,components); // number of components
+   WriteInt16(fp,components);   // number of components
 
    return(true);
 }
@@ -307,13 +306,13 @@ bool TestFile::WriteFileData(std::ofstream *fp)
 }
 
 uint8_t  TestFile::ReadInt8 (std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    throw( std::ios::failure )
 #endif
 {
    uint8_t g;
    fp->read ((char*)&g, (size_t)1);
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    if ( fp->fail() )
       throw std::ios::failure( "TestFile::ReadInt8() - file error." );
    if( fp->eof() )
@@ -323,13 +322,13 @@ uint8_t  TestFile::ReadInt8 (std::ifstream *fp)
 }
 
 uint16_t TestFile::ReadInt16(std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    throw( std::ios::failure )
 #endif
 {
    uint16_t g;
    fp->read ((char*)&g, (size_t)2);
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    if ( fp->fail() )
       throw std::ios::failure( "TestFile::ReadInt16() - file error." );
    if( fp->eof() )
@@ -343,13 +342,13 @@ uint16_t TestFile::ReadInt16(std::ifstream *fp)
 }
 
 uint32_t TestFile::ReadInt32(std::ifstream *fp)
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    throw( std::ios::failure )
 #endif
 {
    uint32_t g;
    fp->read ((char*)&g, (size_t)4);
-#if !(__GNUC__==2  && __GNUC_MINOR__==96)
+#if !(__GNUC__==2  && __GNUC_MINOR__<=96)
    if ( fp->fail() )
       throw std::ios::failure( "TestFile::ReadInt32() - file error." );
    if( fp->eof() )