[sac-dev] bug fix: read write header
Brian Savage
savage13 at dtm.ciw.edu
Thu Feb 16 07:17:47 PST 2006
Chad,
You are correct. Thanks.
Cheers,
Brian
Chad wrote:
>
> Hi Brian,
>
> I was throwing together a quick SAC to Mini-SEED converter and looked at
> your recent patch for detecting byte order from the SAC header (thanks).
> I think I see an error (see below), feel free to tell me I'm wrong.
>
> cheers,
> Chad
>
>> Index: src/dff/wrsac.c
>> ===================================================================
>> RCS file: /export/home/cvs/repository/SAC/src/dff/wrsac.c,v
> ...
>> + hdrVer = (long *) (header + versionLocation * 4);
>> + if(hdrVer < 1 || *hdrVer > cmhdr.nvhdrc) {
>
> Testing (hdrVer < 1) here but probably want (*hdrVer < 1), heck this
> test is probably always true, the pointer should always be more than 1 :)
>
>> + byteswap( (void *) hdrVer, 4);
>> + if(*hdrVer < 1 || *hdrVer > cmhdr.nvhdrc) {
>
> The first test should be like this one, no?
>
>> + *nerr = 1317;
>> + setmsg("ERROR", *nerr);
>> + /* apcmsg2(&kmdfm.kdflrq[ic1 - 1], ic2-ic1+1); */
>> + aplmsg("not is sac format, nor byteswapped sac format.", 62);
>> + free(header);
>> + goto L_8888;
>> + } else {
>> + free(header);
>> + lswap = TRUE;
>> + }
>> + }
>
More information about the sac-dev
mailing list