~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/hdf4/hdf4dataset.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: hdf4dataset.cpp 18946 2010-02-27 20:39:51Z rouault $
 
2
 * $Id: hdf4dataset.cpp 22838 2011-07-30 17:55:35Z rouault $
3
3
 *
4
4
 * Project:  Hierarchical Data Format Release 4 (HDF4)
5
5
 * Purpose:  HDF4 Datasets. Open HDF4 file, fetch metadata and list of
39
39
#include "hdf4compat.h"
40
40
#include "hdf4dataset.h"
41
41
 
42
 
CPL_CVSID("$Id: hdf4dataset.cpp 18946 2010-02-27 20:39:51Z rouault $");
 
42
CPL_CVSID("$Id: hdf4dataset.cpp 22838 2011-07-30 17:55:35Z rouault $");
43
43
 
44
44
CPL_C_START
45
45
void    GDALRegister_HDF4(void);
755
755
    int         nCount;
756
756
    int32       aiDimSizes[H4_MAX_VAR_DIMS];
757
757
    int32       iRank, iNumType, nAttrs;
758
 
 
 
758
    bool        bIsHDF = true;
 
759
    
759
760
    // Sometimes "HDFEOSVersion" attribute is not defined and we will
760
761
    // determine HDF-EOS datasets using other records
761
762
    // (see ReadGlobalAttributes() method).
762
763
    if ( poDS->bIsHDFEOS
763
764
         || CSLFetchNameValue(poDS->papszGlobalMetadata, "HDFEOSVersion") )
764
765
    {
 
766
        bIsHDF  = false;
 
767
 
765
768
        int32   nSubDatasets, nStrBufSize;
766
769
 
767
770
/* -------------------------------------------------------------------- */
768
771
/*  Process swath layers.                                               */
769
772
/* -------------------------------------------------------------------- */
770
773
        hHDF4 = SWopen( poOpenInfo->pszFilename, DFACC_READ );
 
774
        if( hHDF4 < 0)
 
775
        {
 
776
            delete poDS;
 
777
            CPLError( CE_Failure, CPLE_OpenFailed, "Failed to open HDF4 `%s'.\n", poOpenInfo->pszFilename );
 
778
            return NULL;
 
779
        } 
771
780
        nSubDatasets = SWinqswath(poOpenInfo->pszFilename, NULL, &nStrBufSize);
772
781
#if DEBUG
773
782
        CPLDebug( "HDF4", "Number of HDF-EOS swaths: %d", (int)nSubDatasets );
978
987
            GDclose( hHDF4 );
979
988
        }
980
989
        GDclose( hHDF4 );
 
990
 
 
991
        bIsHDF = ( nSubDatasets == 0 ); // Try to read as HDF
981
992
    }
982
993
 
983
 
    else
 
994
    if( bIsHDF )
984
995
    {
985
996
 
986
997
/* -------------------------------------------------------------------- */
1088
1099
        pszSDSName = CPLStrdup( CSLFetchNameValue( poDS->papszSubDatasets,
1089
1100
                            "SUBDATASET_1_NAME" ));
1090
1101
        delete poDS;
1091
 
        poDS = (HDF4Dataset *) GDALOpen( pszSDSName, poOpenInfo->eAccess );
 
1102
        poDS = NULL;
 
1103
 
 
1104
        GDALDataset* poRetDS = (GDALDataset*) GDALOpen( pszSDSName, poOpenInfo->eAccess );
1092
1105
        CPLFree( pszSDSName );
 
1106
 
 
1107
        if (poRetDS)
 
1108
        {
 
1109
            poRetDS->SetDescription(poOpenInfo->pszFilename);
 
1110
        }
 
1111
 
 
1112
        return poRetDS;
1093
1113
    }
1094
1114
    else
1095
1115
    {