Opened 14 years ago

Closed 14 years ago

#3213 closed defect (fixed)

ESRI ArcInfo ASCII driver not Mac-compatible

Reported by: rayg Owned by: chaitanya
Priority: normal Milestone: 1.7.0
Component: GDAL_Raster Version: 1.6.2
Severity: normal Keywords: AAIGRID
Cc: warmerdam

Description

Near line 530 in frmts/aaigriddataset.cpp, function AAIGDataset::Open, this code:

if( poOpenInfo->pabyHeader[i-1] == '\n'

poOpenInfo->pabyHeader[i-2] == '\n' )

{

if( !isalpha(poOpenInfo->pabyHeader[i]) ) {

nStartOfData = i; /* Beginning of real data found. */ break;

}

}

fails to find the start of data if the input file uses only carriage return (0x0D) line termination, because it assumes that 0x0A characters are present. The if() statement should read:

if( poOpenInfo->pabyHeader[i-1] == '\n'

poOpenInfo->pabyHeader[i-2] == '\n'
poOpenInfo->pabyHeader[i-1] == '\r'
poOpenInfo->pabyHeader[i-2] == '\r' )

Change History (4)

comment:1 by warmerdam, 14 years ago

Cc: warmerdam added
Keywords: AAIGRID added
Milestone: 1.7.0
Owner: changed from warmerdam to chaitanya

Chaitanya,

Please review and apply in trunk.

comment:2 by chaitanya, 14 years ago

Resolution: fixed
Status: newclosed

Applied the patch in trunk (r17973).

comment:3 by Even Rouault, 14 years ago

Resolution: fixed
Status: closedreopened

Chaitanya,

the patch is incorrect in its current form. It breaks several test cases of autotest on all platforms. See http://buildbot.osgeo.org:8500/builders/telascience-full/builds/97/steps/test/logs/stdio (it would be good if you check that the autotest suite still passes before commiting code)

It fails when the line terminator is 0x0d 0x0a, which is the case of pixel_per_line.asc for example (if i points to 0x0a, pabyHeader[i-1] == 0x0d and isalpha(poOpenInfo->pabyHeader[i]) is false...). Once you get it fixed, it would be good also to add a test with a file whose line terminator = 0x0d (the 2 other cases are already tested)

in reply to:  3 comment:4 by chaitanya, 14 years ago

Resolution: fixed
Status: reopenedclosed

Replying to rouault:

(it would be good if you check that the autotest suite still passes before commiting code)

Thanks rouault, I must have used the wrong library for the test.

Fixed the patch r17973 in r17974 (in trunk).

Note: See TracTickets for help on using tickets.