Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ethan (3163)

  reversethis-{ed. ... rap.nov.olissat}

Being a 25-year old chap living in the western-most town of Germany. Stuying communication and information science and being a huge fan of XS-related things.

Journal of ethan (3163)

Wednesday March 10, 2004
05:02 AM

Getting portable

[ #17843 ]

I am right now testing Device::CDROM on a NetBSD machine. The tests that worked so splendidly on my Linux box kept
failing there.

The source of the problem is the fact that BSDs use big-endian format for LBA-addressing on CDs (unlike Linux which uses host-byteorder). That means that I have defined some macros that do the necessary byte-swapping. In code this looks like this:

minute (self)
                CDROM_ADDR *self;
                int lba;
                char min, sec, frame;
                lba = self->ADDRaddr.lba;
#if _BSDISH__
                lba_to_msf(lba, &min, &sec, &frame);
                RETVAL = min;

I couldn't the hell figure out why it didn't work on BSD until I spotted a subtle but disastrous typo: It is supposed to be __BSDISH__ and not _BSDISH__. So in this particular XSUB the byte-swapping never happened.

I really wish there were strictures for the C preprocessor directives!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.