Skip to content

Commit

Permalink
aaigriddataset: Improve search for float data. (#2972)
Browse files Browse the repository at this point in the history
Only scan the bytes actually read by VSIFReadL.

Fixes #2970
  • Loading branch information
schwehr authored and rouault committed Sep 25, 2020
1 parent c332dc9 commit 8b12521
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gdal/frmts/aaigrid/aaigriddataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,11 @@ GDALDataset *AAIGDataset::CommonOpen( GDALOpenInfo *poOpenInfo,
// Scan for dot in subsequent chunks of data.
while( !VSIFEofL(poDS->fp) )
{
CPL_IGNORE_RET_VAL(VSIFReadL(pabyChunk, nChunkSize, 1, poDS->fp));
const size_t nLen = VSIFReadL(pabyChunk, 1, nChunkSize, poDS->fp);

for( int i = 0; i < static_cast<int>(nChunkSize); i++)
for( size_t i = 0; i < nLen; i++)
{
GByte ch = pabyChunk[i];
const GByte ch = pabyChunk[i];
if (ch == '.' || ch == ',' || ch == 'e' || ch == 'E')
{
poDS->eDataType = GDT_Float32;
Expand Down

0 comments on commit 8b12521

Please sign in to comment.