~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Utilities/MetaIO/metaArray.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-05-31 12:07:29 UTC
  • mfrom: (3.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080531120729-7g7layn480le43ko
Tags: 3.6.0-3
* debian/patches/gccxml-workaround.patch: New.  Work around gccxml issue
  with #include_next; c.f. http://www.gccxml.org/Bug/view.php?id=7134.  
* debian/patches/gcc43.patch: include <cstring> in itkNeighbourhood.h.
  This only showed up in the tcl wrapping step.

* Above two entries fix FTBFS for GCC 4.3-based systems.
  Closes: #478500.

* debian/patches/sharedforward.patch: New.  Ensure that linux/sparc
  systems are not also configured as a SUN sparc system, which requires
  SUN header sys/isa_defs.h.  Closes: #478940, #483312.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   MetaIO
4
4
  Module:    $RCSfile: metaArray.cxx,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2006/11/17 14:54:08 $
7
 
  Version:   $Revision: 1.6 $
 
6
  Date:      $Date: 2008-04-09 01:44:28 $
 
7
  Version:   $Revision: 1.9 $
8
8
 
9
9
  Copyright (c) Insight Software Consortium. All rights reserved.
10
10
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
16
16
=========================================================================*/
17
17
#include "metaArray.h"
18
18
 
 
19
#ifdef _MSC_VER
 
20
#pragma warning(disable:4702)
 
21
#endif
 
22
 
19
23
#include <stdio.h>
20
24
#include <ctype.h>
21
25
#include <string>
623
627
  // Now check the file content
624
628
  METAIO_STREAM::ifstream inputStream;
625
629
 
 
630
#ifdef __sgi
 
631
  inputStream.open( _headerName, METAIO_STREAM::ios::in );
 
632
#else
626
633
  inputStream.open( _headerName, METAIO_STREAM::ios::in |
627
634
                                 METAIO_STREAM::ios::binary );
 
635
#endif
628
636
 
629
 
  if( !inputStream.is_open() )
 
637
  if( !inputStream.rdbuf()->is_open() )
630
638
    {
631
639
    return false;
632
640
    }
650
658
 
651
659
  METAIO_STREAM::ifstream * tmpStream = new METAIO_STREAM::ifstream;
652
660
 
 
661
#ifdef __sgi
 
662
  tmpStream->open(m_FileName, METAIO_STREAM::ios::in );
 
663
#else
653
664
  tmpStream->open(m_FileName, METAIO_STREAM::ios::in |
654
665
                              METAIO_STREAM::ios::binary);
 
666
#endif
655
667
 
656
 
  if(!tmpStream->is_open())
 
668
  if(!tmpStream->rdbuf()->is_open())
657
669
    {
658
670
    METAIO_STREAM::cout << "MetaArray: Read: Cannot open file _" 
659
671
                        << m_FileName << "_" << METAIO_STREAM::endl;
750
762
        strcpy(fName, m_ElementDataFileName);
751
763
        }
752
764
      METAIO_STREAM::ifstream* readStreamTemp = new METAIO_STREAM::ifstream;
 
765
 
 
766
#ifdef __sgi
 
767
      readStreamTemp->open(fName, METAIO_STREAM::ios::in);
 
768
#else
753
769
      readStreamTemp->open(fName, METAIO_STREAM::ios::binary |
754
770
                                  METAIO_STREAM::ios::in);
755
 
      if(!readStreamTemp->is_open())
 
771
#endif
 
772
      if(!readStreamTemp->rdbuf()->is_open())
756
773
        {
757
774
        METAIO_STREAM::cout << "MetaArray: Read: Cannot open data file" 
758
775
                            << METAIO_STREAM::endl;
846
863
// that requires a file to exist for output
847
864
#ifdef __sgi
848
865
  {
849
 
  METAIO_STREAM::ofstream tFile(m_FileName, METAIO_STREAM::ios::binary |
850
 
                                            METAIO_STREAM::ios::out);
 
866
  METAIO_STREAM::ofstream tFile(m_FileName, METAIO_STREAM::ios::out);
851
867
  tFile.close();                    
852
868
  }
853
 
#endif
854
 
 
 
869
  tmpWriteStream->open(m_FileName, METAIO_STREAM::ios::out);
 
870
#else
855
871
  tmpWriteStream->open(m_FileName, METAIO_STREAM::ios::binary |
856
872
                                   METAIO_STREAM::ios::out);
857
 
  if(!tmpWriteStream->is_open())
 
873
#endif
 
874
 
 
875
  if(!tmpWriteStream->rdbuf()->is_open())
858
876
    {
859
877
    if(tmpDataFileName)
860
878
      {
1150
1168
      for(int i=0; i<_dataQuantity*m_ElementNumberOfChannels; i++)
1151
1169
        {
1152
1170
        *_fstream >> tf;
1153
 
        std::cout << "tf = " << tf << std::endl;
1154
1171
        MET_DoubleToValue(tf, m_ElementType, _data, i);
1155
1172
        _fstream->get();
1156
1173
        }
1210
1227
// that requires a file to exist for output
1211
1228
#ifdef __sgi
1212
1229
    {
1213
 
    METAIO_STREAM::ofstream tFile(dataFileName, METAIO_STREAM::ios::binary |
1214
 
                                                METAIO_STREAM::ios::out);
 
1230
    METAIO_STREAM::ofstream tFile(dataFileName, METAIO_STREAM::ios::out);
1215
1231
    tFile.close();                    
1216
1232
    }
1217
 
#endif
1218
 
 
 
1233
    tmpWriteStream->open(dataFileName, METAIO_STREAM::ios::out);
 
1234
#else
1219
1235
    tmpWriteStream->open(dataFileName, METAIO_STREAM::ios::binary |
1220
1236
                                       METAIO_STREAM::ios::out);
 
1237
#endif
1221
1238
    }
1222
1239
 
1223
1240
  if(!m_BinaryData)