Opened 13 years ago

Closed 13 years ago

Last modified 9 years ago

#3256 closed defect (fixed)

[OGR-BNA]: the driver outputs incorrect line endings on Windows.

Reported by: ash Owned by: Even Rouault
Priority: normal Milestone:
Component: OGR_SF Version: 1.6.2
Severity: major Keywords: BNA
Cc:

Description

OGR BNA driver writes incorrect line endings on Windows, probably due to specific behavior of fpintf. Here's the relevant code from OGRBNALayer::CreateFeature():

    if (poDS->GetUseCRLF())
    {	
	// this branch will get executed on windows
        eol[0] = 13; // this will result in CR
        eol[1] = 10; // this will result in CRLF
        eol[2] = 0;
    }
    else
    {
        eol[0] = 10;
        eol[1] = 0;
    }

Compiled using VC 2003, tested on Windows XP SP2.

Change History (5)

comment:1 by warmerdam, 13 years ago

Cc: Even Rouault added
Keywords: BNA added

Andrey,

I'm afraid I am not clear on what problem you are seeing. Is the driver writing out CRCRLF or something like that? A brief inspection of the driver suggests that the output file is being opened in binary mode in ogrbnalayer.cpp with VSIFOpen(), and so I would not expected any automatic conversion of \n to CRLF.

comment:2 by ash, 13 years ago

Frank, indeed, the problem is in the autoconversion of the newline char, because the output file is being opened in the text mode in OGRBNADataSource::Create():

  fpOutput = VSIFOpen( pszFilename, "w" );

Changing the mode to binary fixes the problem.

comment:3 by warmerdam, 13 years ago

Cc: Even Rouault removed
Owner: changed from warmerdam to Even Rouault

Gotcha, turning over to Even since this appears to be his driver and me may be aware of any special circumstances.

comment:4 by Even Rouault, 13 years ago

Milestone: 1.6.4
Resolution: fixed
Status: newclosed

Andrey, thanks for spotting this.

Frank, no special circumstances in fact. The driver was just developped & tested on Linux where binary mode is the default...

Fixed in trunk (r18139) and in branches/1.6 (r18140). Test added in r18141

comment:5 by Even Rouault, 9 years ago

Milestone: 1.6.4

Milestone 1.6.4 deleted

Note: See TracTickets for help on using tickets.