Changeset 11017
- Timestamp:
- 06/13/11 22:25:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Converter.cc
r10666 r11017 782 782 format.second.first = cnt == 0 ? 1 : cnt; 783 783 784 /* 784 785 if (strict && t[0]=='C' && cnt>0) 785 786 { 786 787 out << kRed << "Dim doesn't support the format C with N>0!" << endl; 787 788 return FormatList(); 788 } 789 }*/ 789 790 790 791 // Check if the format is just C (without a number) … … 869 870 for (Converter::FormatList::const_iterator i=fList.begin(); i!=fList.end(); i++) 870 871 { 871 //ETIENNE this check fails for very fine cases. Disabled it 872 // FIXME: This is still not really safe 873 // if (charDest-size>=dest) 874 // { 875 // ostringstream err; 876 // err << "Format description [fmt=" << fFormat << "] exceeds available data size (" << size << ")"; 877 // throw runtime_error(err.str()); 878 // } 872 if (charDest-size>dest) 873 { 874 ostringstream err; 875 err << "Format description [fmt=" << fFormat << "] exceeds available data size (" << size << ")"; 876 throw runtime_error(err.str()); 877 } 879 878 880 879 const char type = i->first.first->name()[0]; 880 if (type=='v') 881 break; 881 882 882 883 // string types 883 if (type=='S' || type=='O' || type=='W') 884 { 885 // copy string until termination 886 while (*charSrc) 887 *charDest++ = *charSrc++; 888 889 // Copy \0-termination 890 //ETIENNE: Do not copy the \0 as it must not be written to fits files. just increment charSrc instead 891 // *charDest++ = *charSrc++; 892 charSrc++; 893 continue; 894 } 884 if (string("bsilfdx").find_first_of(type)==string::npos) 885 throw runtime_error(string("Type '")+type+"' not supported converting to FITS."); 895 886 896 887 const int s = i->first.second; // size of element … … 917 908 vector<char> Converter::ToFits(const void *src, size_t size) const 918 909 { 919 vector<char> dest(size);920 ToFits(&dest[0], src, size);921 return dest;910 vector<char> dest(size); 911 ToFits(dest.data(), src, size); 912 return dest; 922 913 } 923 914
Note:
See TracChangeset
for help on using the changeset viewer.