#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 , 15 years ago
Cc: | added |
---|---|
Keywords: | BNA added |
comment:2 by , 15 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 , 15 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
Gotcha, turning over to Even since this appears to be his driver and me may be aware of any special circumstances.
comment:4 by , 15 years ago
Milestone: | → 1.6.4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.