Changeset 12889 for trunk


Ignore:
Timestamp:
02/13/12 11:10:33 (13 years ago)
Author:
tbretz
Message:
Improved grouping. Write more than just a single \0 to end the ascii strings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/datalogger.cc

    r12827 r12889  
    20932093    const unsigned int n = 8 + 3 + 2*maxCharLength + 1 + 8; //+1 for trailling character
    20942094
    2095     vector<unsigned char> realBuffer;
    2096     realBuffer.resize(n);
    2097     unsigned char* fitsBuffer = &realBuffer[0];
    2098     memset(fitsBuffer, 0, n);
    2099 
    2100     char* startOfExtension = reinterpret_cast<char*>(fitsBuffer);
    2101     char* startOfURI       = reinterpret_cast<char*>(&fitsBuffer[8]);
    2102     char* startOfLocation  = reinterpret_cast<char*>(&fitsBuffer[8 + 3]);
    2103     char* startOfName      = reinterpret_cast<char*>(&fitsBuffer[8+3+maxCharLength]);
     2095    vector<char> realBuffer(n);
     2096
     2097    char *startOfExtension = realBuffer.data();
     2098    char *startOfURI       = realBuffer.data()+8;
     2099    char *startOfLocation  = realBuffer.data()+8+3;
     2100    char *startOfName      = realBuffer.data()+8+3+maxCharLength;
    21042101 //   char* startOfMemVer    = reinterpret_cast<char*>(&fitsBuffer[8+3+2*maxCharLength]);
    21052102 //   char* startOfMemPos    = reinterpret_cast<char*>(&fitsBuffer[8+3+2*maxCharLength+1]);
     
    21072104    strcpy(startOfExtension, "BINTABLE");
    21082105    strcpy(startOfURI,       "URL");
    2109     fitsBuffer[8+3+2*maxCharLength+3] = 1;
    2110     fitsBuffer[8+3+2*maxCharLength+7] = 1;
     2106
     2107    realBuffer[8+3+2*maxCharLength+3] = 1;
     2108    realBuffer[8+3+2*maxCharLength+7] = 1;
    21112109
    21122110    int i=1;
     
    21142112        for (vector<string>::const_iterator jt=it->second.begin(); jt != it->second.end(); jt++, i++)
    21152113        {
     2114            memset(startOfLocation, 0, 2*maxCharLength+1+8;
     2115
    21162116            strcpy(startOfLocation, it->first.c_str());
    2117             strcpy(startOfName, jt->c_str());
     2117            strcpy(startOfName,     jt->c_str());
    21182118
    21192119            if (fDebugIsOn)
     
    21252125
    21262126            int status = 0;
    2127             fits_write_tblbytes(groupFile->fitsPointer(), i, 1, 8+3+2*maxCharLength +8, fitsBuffer, &status);
     2127            fits_write_tblbytes(groupFile->fitsPointer(), i, 1, 8+3+2*maxCharLength +8, realBuffer.data(), &status);
    21282128            if (status)
    21292129            {
Note: See TracChangeset for help on using the changeset viewer.