Ignore:
Timestamp:
05/30/12 16:36:39 (12 years ago)
Author:
lyard
Message:
fixed checksum issues with the ofits class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/ofits.h

    r13115 r13987  
    326326        SetInt("TFIELDS",                    0, "number of fields in each row");
    327327        SetStr("EXTNAME", "", "name of extension table");
    328         SetStr("CHECKSUM", "{0000000000000000}", "Checksum for the whole file");
    329         SetInt("DATASUM",                    0, "Checksum for the data block");
     328        SetStr("CHECKSUM", "0000000000000000", "Checksum for the whole HDU");
     329        SetStr("DATASUM",  "         0", "Checksum for the data block");
    330330
    331331        ofstream::open(filename);
     
    608608        h.SetInt ("NAXIS",     0, "number of data axes");
    609609        h.SetBool("EXTEND", true, "FITS dataset may contain extensions");
    610 
     610        h.SetStr ("CHECKSUM","4AcB48bA4AbA45bA", "Checksum for the whole HDU");
     611        h.SetStr ("DATASUM", "         0", "Checksum for the data block");
    611612        h.AddComment("FITS (Flexible Image Transport System) format is defined in 'Astronomy");
    612613        h.AddComment("and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H");
     
    733734        if (tellp()%(80*36)>0)
    734735        {
    735             //cout << "fill" << endl;
    736736            const vector<char> filler(80*36-tellp()%(80*36));
    737737            write(filler.data(), filler.size());
    738738        }
    739739
    740         // We don't hav eto jump back to the end of the file
     740        // We don't have to jump back to the end of the file
    741741        SetInt("NAXIS2",  fTable.num_rows);
    742         SetInt("DATASUM", fDataSum.val());
     742
     743        ostringstream dataSumStr;
     744        dataSumStr << fDataSum.val();
     745        SetStr("DATASUM", dataSumStr.str());
    743746
    744747        const Checksum sum = WriteHeader();
     748
    745749        //sum += headersum;
    746750
    747         SetStr("CHECKSUM", "{"+(sum+fDataSum).str()+"}");
     751        SetStr("CHECKSUM", (sum+fDataSum).str());
    748752
    749753        const Checksum chk = WriteHeader();
Note: See TracChangeset for help on using the changeset viewer.