Ticket #48 (closed defect: fixed)

Opened 14 months ago

Last modified 11 months ago

Read/write operations fail on big-endian architectures

Reported by: mloskot Owned by: mloskot
Priority: major Milestone: 1.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.

Change History

Changed 14 months ago by hobu

  • cc warmerdam added
  • description modified (diff)
  • milestone set to Future

Changed 14 months ago by mloskot

  • las_format set to Not Applicable
  • status changed from new to closed
  • resolution set to fixed

Fixed in trunk (r746, r748).

I've successfully run all unit tests on Intel Xeon (little-endian) and Power PC (big-endian). Hobu, I'd be thankful if you can run tests on your machines too and confirm it works.

Changed 14 months ago by mloskot

  • status changed from closed to reopened
  • resolution fixed deleted

Added big endian byte swapping for members of VLRHeader type (r750)

Changed 14 months ago by mloskot

  • status changed from reopened to new

Changed 14 months ago by mloskot

  • status changed from new to assigned

Changed 13 months ago by hobu

  • status changed from assigned to closed
  • resolution set to fixed

All tests pass for me on epimetheus and my intel box. Declaring this one done...

Changed 11 months ago by hobu

  • milestone changed from Future to 1.0
Note: See TracTickets for help on using tickets.