Changeset 15125
- Timestamp:
- 03/19/13 18:23:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/ofits.h
r14960 r15125 121 121 } 122 122 123 bool check( )123 bool check(bool trim=false) 124 124 { 125 125 if (!FormatKey()) … … 129 129 return false; 130 130 131 const size_t sz = CalcSize(); 132 if (sz>80) 131 size_t sz = CalcSize(); 132 if (sz<=80) 133 return true; 134 135 if (!trim) 133 136 { 134 137 ostringstream sout; … … 138 141 #else 139 142 gLog << ___err___ << "ERROR - " << sout.str() << endl; 143 #endif 140 144 return false; 141 #endif142 145 } 143 146 144 return true; 147 //looks like something went wrong. Maybe entry is too long ? 148 //try to remove the comment 149 comment = ""; 150 151 sz = CalcSize(); 152 if (sz<=80) 153 { 154 #ifndef __EXCEPTIONS 155 ostringstream sout; 156 sout << "Size " << sz << " of entry for key '" << key << "' exceeds 80 characters... removed comment."; 157 gLog << ___warn___ << "WARNING - " << sout.str() << endl; 158 #endif 159 return true; 160 } 161 162 ostringstream sout; 163 sout << "Size " << sz << " of entry for key '" << key << "' exceeds 80 characters even without comment."; 164 #ifdef __EXCEPTIONS 165 throw runtime_error(sout.str()); 166 #else 167 gLog << ___err___ << "ERROR - " << sout.str() << endl; 168 return false; 169 #endif 145 170 } 146 171 … … 257 282 entry.changed = true; 258 283 259 if (!entry.check()) 260 { 261 if (!fCommentTrimming) 262 return false; 263 264 //looks like something went wrong. Maybe entry is too long ? 265 //try to remove the comment 266 entry.comment = ""; 267 if (!entry.check()) 268 return false; 269 270 #ifdef __MARS__ 271 gLog << ___warn___ << "WARNING - Removed comment from over-sized entry " << key << endl; 272 #endif 273 } 284 if (!entry.check(fCommentTrimming)) 285 return false; 274 286 275 287 fKeys.push_back(entry); … … 460 472 { 461 473 ostringstream sout; 462 sout << "Header already written m, no new column can be defined... ignoring column '" << name << "'";474 sout << "Header already written, no new column can be defined... ignoring column '" << name << "'"; 463 475 #ifdef __EXCEPTIONS 464 476 throw runtime_error(sout.str());
Note:
See TracChangeset
for help on using the changeset viewer.