Ticket #48 (closed defect: fixed)
Read/write operations fail on big-endian architectures
| Reported by: | mloskot | Owned by: | mloskot |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0.0 |
| Component: | Base Library | Version: | svn-trunk |
| Keywords: | endianness big-endian little-endian | Cc: | warmerdam |
| LAS Format Version: | Not Applicable |
Description (last modified by hobu) (diff)
When we started to work on libLAS, we've decided to defer implementation of robust endiannes support for after 1.0 release.
From libLAS FAQ:
According to the LAS Format Standard, all data is stored in little-endian format. The implication is that on little-endian architectures multi-byte data of LAS file can be read (or write) directly and bytes reordering is not required. On big endian machines, however, bytes of multi-byte data must reordered between big-endian and little-endian format.
Thus, problems with reading/writing LAS files on big-endian machines are expected. This ticket dedicated for discussion on this subject and should serve as a reminder.
Here is result of make check execution on Power PC machine (Apple PowerBook? G4 running Mac OS X 10.4):
libLAS Test Suite:
==================
liblas::LASError: ...
liblas::LASFile: .[2=F]....[7=F][8=F]..
liblas::LASHeader: ...........
liblas::LASPoint: ...............
liblas::LASReader: .[2=F].end of file encountered
[4=F][5=X][6=X].
liblas::LASRecordHeader: ......
liblas::LASWriter: ....
liblas::guid: .......
---> group: liblas::LASFile, test: test<2>
problem: assertion failed
failed assertion: " expected '229' actual '3841982464'"
---> group: liblas::LASFile, test: test<7>
problem: assertion failed
failed assertion: " expected '229' actual '3841982464'"
---> group: liblas::LASFile, test: test<8>
problem: assertion failed
failed assertion: " expected '229' actual '3841982464'"
---> group: liblas::LASReader, test: test<2>
problem: assertion failed
failed assertion: " expected '229' actual '3841982464'"
---> group: liblas::LASReader, test: test<4>
problem: assertion failed
failed assertion: " expected (630262 - 630262) actual '0'"
---> group: liblas::LASReader, test: test<5>
problem: unexpected exception
exception typeid: St13runtime_error
message: "detail::liblas::read_n input stream is not readable"
---> group: liblas::LASReader, test: test<6>
problem: unexpected exception
exception typeid: St13runtime_error
message: "detail::liblas::read_n input stream is not readable"
tests summary: exceptions:2 failures:5 ok:56
The tests output confirms the need for fixes in near future.
