Opened 13 years ago

Closed 13 years ago

#3933 closed defect (fixed)

Certain ESRI FLTs broken by update to ehdrdataset.cpp

Reported by: rprinceley Owned by: warmerdam
Priority: normal Milestone: 1.8.1
Component: GDAL_Raster Version: 1.8.0
Severity: major Keywords: EHDR
Cc: gaopeng, Even Rouault

Description

Some FLT files (those that don't specify nbits in the header) no longer work with recent changes (r21238). Pixel size check is skipped, returns as byte instead of float.

    /* If we have a negative nodata value, let's assume that the */
    /* pixel type is signed. This is necessary for datasets from */
    /* http://www.worldclim.org/futdown.htm */
    if( bNoDataSet && dfNoData < 0 && chPixelType == 'N' )
    {
        chPixelType = 'S';
    }

Since chPixelType is set, size check is not performed:

    if( nBits == -1 && chPixelType == 'N' )
    {
        VSIStatBufL sStatBuf;
        if( VSIStatL( poOpenInfo->pszFilename, &sStatBuf ) == 0 )
        {
            size_t nBytes = sStatBuf.st_size/nCols/nRows/nBands;
            if( nBytes > 0 && nBytes != 3 )
                nBits = nBytes*8;

            if( nBytes == 4 )
                chPixelType = 'F';
        }
    }

FLT header:

ncols         1620
nrows         1195
xllcorner     4487961
yllcorner     5477345
cellsize      2
NODATA_value  -9999
byteorder     LSBFIRST

Change History (1)

comment:1 by warmerdam, 13 years ago

Cc: Even Rouault added
Keywords: EHDR added
Milestone: 1.8.1
Resolution: fixed
Status: newclosed

I have made some adjustments to the order in which the unknown pixel type tests are done, and added some tests of floating point detection based on file size and extension in the test suite. Done in trunk (r21622) and 1.8 branch (r21623).

Note: See TracTickets for help on using tickets.