Changeset 17304


Ignore:
Timestamp:
10/22/13 10:24:02 (11 years ago)
Author:
lyard
Message:
Adapted compilation on older Gcc
Location:
trunk/Mars/mcore
Files:
3 edited

Legend:

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

    r17264 r17304  
    88#ifndef FACTOFITS_H_
    99#define FACTOFITS_H_
     10
     11#define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100  + __GNUC_PATCHLEVEL__)
    1012
    1113#include "zofits.h"
     
    235237            Checksum rawsum;
    236238            rawsum.add((char*)(fOffsetCalibration.data()), 1024*1440*sizeof(int16_t));
     239#if GCC_VERSION < 40603
     240            c.SetStr("RAWSUM", std::to_string((long long unsigned int)(rawsum.val())));
     241#else
    237242            c.SetStr("RAWSUM", std::to_string(rawsum.val()));
     243#endif
    238244
    239245            //compress data and calculate final, compressed size
     
    245251
    246252            //Write tile header
    247             FITS::TileHeader th;
     253            FITS::TileHeader th(0, 0);
    248254            std::vector<uint16_t> seq(1, FITS::kFactHuffman16);
    249255            FITS::Compression bh(seq, FITS::kOrderByRow);
     
    275281            c.SetFloat("ZRATIO", (float)(1024*1440*2)/(float)(compressed_size));
    276282            c.SetInt("PCOUNT", compressed_size + catalog_size);
     283
     284#if GCC_VERSION < 40603
     285            c.SetStr("DATASUM", std::to_string((long long unsigned int)(datasum.val())));
     286#else
    277287            c.SetStr("DATASUM", std::to_string(datasum.val()));
     288#endif
    278289
    279290            datasum += c.WriteHeader(*this);
  • trunk/Mars/mcore/fits.h

    r17293 r17304  
    1010#include <algorithm>
    1111#include <stdexcept>
     12
     13#define GCC_VERSION (__GNUC__ * 10000  + __GNUC_MINOR__ * 100  + __GNUC_PATCHLEVEL__)
    1214
    1315#ifndef __CINT__
     
    549551    std::string Compile(const std::string &key, int16_t i=-1) const
    550552    {
     553#if GCC_VERSION < 40603
     554        return i<0 ? key : key+std::to_string((long long int)(i));
     555#else
    551556        return i<0 ? key : key+std::to_string(i);
     557#endif
    552558    }
    553559
  • trunk/Mars/mcore/ofits.h

    r17298 r17304  
    1313#include <stdexcept>
    1414
     15#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
     16
    1517#ifdef __CINT__
    1618#define off_t size_t
     
    9597
    9698            //transform(key.begin(), key.end(), key.begin(), toupper);
    97 
     99#if GCC_VERSION < 40603
     100            for (std::string::const_iterator c=key.begin(); c<key.end(); c++)
     101#else
    98102            for (std::string::const_iterator c=key.cbegin(); c<key.cend(); c++)
     103#endif
    99104                if ((*c<'A' || *c>'Z') && (*c<'0' || *c>'9') && *c!='-' && *c!='_')
    100105                {
     
    116121            comment = Trim(comment);
    117122
     123#if GCC_VERSION < 40603
     124            for (std::string::const_iterator c=key.begin(); c<key.end(); c++)
     125#else
    118126            for (std::string::const_iterator c=key.cbegin(); c<key.cend(); c++)
     127#endif
    119128                if (*c<32 || *c>126)
    120129                {
     
    587596
    588597        static const std::string allow("LABIJKEDQ");
     598#if GCC_VERSION < 40603
     599        if (std::find(allow.begin(), allow.end(), typechar)==allow.end())
     600#else
    589601        if (std::find(allow.cbegin(), allow.cend(), typechar)==allow.end())
     602#endif
    590603        {
    591604            std::ostringstream sout;
     
    610623        if (addHeaderKeys)
    611624        {
     625#if GCC_VERSION < 40603
     626            const std::string nc = std::to_string((long long int)(fTable.num_cols));
     627#else
    612628            const std::string nc = std::to_string(fTable.num_cols);
    613 
     629#endif
    614630            SetStr("TFORM"+nc, type.str(), "format of "+name+" "+CommentFromType(typechar));
    615631            SetStr("TTYPE"+nc, name, comment);
Note: See TracChangeset for help on using the changeset viewer.