Changeset 17607


Ignore:
Timestamp:
03/12/14 14:34:37 (11 years ago)
Author:
lyard
Message:
Fixed bug that wrongly calculated the checksum of compressed files. Weird that I did not notice it ealier...
Location:
trunk/Mars/mcore
Files:
2 edited

Legend:

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

    r17392 r17607  
    265265            num_rows      = is_compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2");
    266266            num_cols      = Get<size_t>("TFIELDS");
    267             datasum       = is_compressed ? Get<int64_t>("ZDATASUM", -1) : Get<int64_t>("DATASUM", -1);
     267            datasum       = is_compressed ? Get<int64_t>("DATASUM", -1) : Get<int64_t>("DATASUM", -1);
    268268//cout << "IS COMPRESSED =-========= " << is_compressed << " " << Get<size_t>("NAXIS1") << endl;
    269269            size_t bytes = 0;
  • trunk/Mars/mcore/zfits.h

    r17402 r17607  
    2020    // Basic constructor
    2121    zfits(const std::string& fname, const std::string& tableName="", bool force=false)
    22         : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-2), fHeapOff(0), fTileSize(0)
     22        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
    2323    {
    2424        open(fname.c_str());
     
    2929    // Alternative contstructor
    3030    zfits(const std::string& fname, const std::string& fout, const std::string& tableName, bool force=false)
    31         : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-2), fHeapOff(0), fTileSize(0)
     31        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
    3232    {
    3333        open(fname.c_str());
     
    316316            // seek for the sub tile. If we were just reading the previous one
    317317            // we can skip that.
    318             if (!isNextTile)
     318            if (!isNextTile || requestedTile==0)
    319319            {
    320320                // step to the beginnig of the super tile
     
    335335            // this is now the beginning of the sub-tile we want to read
    336336            const int64_t subTileStart = tellg() - fHeapOff;
    337 
    338337            // calculate the 32 bits offset of the current tile.
    339338            const uint32_t offset = (subTileStart + fHeapFromDataStart)%4;
     
    387386            if (isNextTile)
    388387            {
     388//                std::cout << "Updating checksum" << std::endl;
    389389                // Padding for checksum calculation
    390390                memset(fCompressedBuffer.data(),   0, offset);
Note: See TracChangeset for help on using the changeset viewer.