Thread: bug fix: read write header

Started: 2006-02-13 17:46:55
Last activity: 2006-02-15 00:21:15
Topics: SAC Developers
Brian Savage
2006-02-13 17:46:55
All,

I have created a patch for the read header / write header bug discovered
a while back. It effectively handles big and small endian files.

This patch determines the file's endianness and writes the appropriate
header. During a write header, this is the logic:

- Open file to be written (file must already exist)
- Read in Old Header
- Examine Version Number
- If version number between 1 and current version (6)
- Write header
- If version number not between 1 and current version (6)
- Swap version number
- If version number not between 1 and current verison (6)
Issue Error
- If version number between 1 and current version (6)
Write swapped header
- Close File

Based on the current CVS version, please test and get back to me.

Cheers,
Brian
savage13<at>dtm.ciw.edu

  • Brian Savage
    2006-02-15 00:21:15
    All,

    In checking the read write header bug, Arthur Snoke found a abnormality
    in the Mac OSX build. The Mac OSX bug would not write the file on a
    writehdr call. In detail, an lseek call was not defined (the header
    file was missing) and the return value was also not checked properly. I
    created a new patch to fix this along with the read write header bug.
    It is attached below. Testing is, as always, appreciated.

    Cheers,
    Brian

    All,

    I have created a patch for the read header / write header bug discovered
    a while back. It effectively handles big and small endian files.

    This patch determines the file's endianness and writes the appropriate
    header. During a write header, this is the logic:

    - Open file to be written (file must already exist)
    - Read in Old Header
    - Examine Version Number
    - If version number between 1 and current version (6)
    - Write header
    - If version number not between 1 and current version (6)
    - Swap version number
    - If version number not between 1 and current verison (6)
    Issue Error
    - If version number between 1 and current version (6)
    Write swapped header
    - Close File

    Based on the current CVS version, please test and get back to me.

    Cheers,
    Brian
    savage13<at>dtm.ciw.edu

14:35:59 v.01697673