Commit c409b85d authored by seb's avatar seb
Browse files

- Big bug fixed for Cbf saving


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@298 45c4679d-1946-429d-baad-37912b19538b
parent 8ce68dbe
......@@ -6,6 +6,64 @@ using namespace lima;
static const char *DEFAULT_CATEGORY = "Misc";
static const char LIMA_HEADER_KEY_SEPARATOR = '/';
#ifdef DEBUG
static inline void outerror(int err)
{
if ((err&CBF_FORMAT)==CBF_FORMAT)
fprintf(stderr, " cbf: The file format is invalid.\n");
if ((err&CBF_ALLOC)==CBF_ALLOC)
fprintf(stderr, " cbf Memory allocation failed.\n");
if ((err&CBF_ARGUMENT)==CBF_ARGUMENT)
fprintf(stderr, " cbf: Invalid function argument.\n");
if ((err&CBF_ASCII)==CBF_ASCII)
fprintf(stderr, " cbf: The value is ASCII (not binary).\n");
if ((err&CBF_BINARY)==CBF_BINARY)
fprintf(stderr, " cbf: The value is binary (not ASCII).\n");
if ((err&CBF_BITCOUNT)==CBF_BITCOUNT)
fprintf(stderr, " cbf: The expected number of bits does"
" not match the actual number written.\n");
if ((err&CBF_ENDOFDATA)==CBF_ENDOFDATA)
fprintf(stderr, " cbf: The end of the data was reached"
" before the end of the array.\n");
if ((err&CBF_FILECLOSE)==CBF_FILECLOSE)
fprintf(stderr, " cbf: File close error.\n");
if ((err&CBF_FILEOPEN)==CBF_FILEOPEN)
fprintf(stderr, " cbf: File open error.\n");
if ((err&CBF_FILEREAD)==CBF_FILEREAD)
fprintf(stderr, " cbf: File read error.\n");
if ((err&CBF_FILESEEK)==CBF_FILESEEK)
fprintf(stderr, " cbf: File seek error.\n");
if ((err&CBF_FILETELL)==CBF_FILETELL)
fprintf(stderr, " cbf: File tell error.\n");
if ((err&CBF_FILEWRITE)==CBF_FILEWRITE)
fprintf(stderr, " cbf: File write error.\n");
if ((err&CBF_IDENTICAL)==CBF_IDENTICAL)
fprintf(stderr, " cbf: A data block with the new name already exists.\n");
if ((err&CBF_NOTFOUND)==CBF_NOTFOUND)
fprintf(stderr, " cbf: The data block, category, column or"
" row does not exist.\n");
if ((err&CBF_OVERFLOW)==CBF_OVERFLOW)
fprintf(stderr, " cbf: The number read cannot fit into the"
"destination argument.\n The destination has been set to the nearest value.\n");
if ((err& CBF_UNDEFINED)==CBF_UNDEFINED)
fprintf(stderr, " cbf: The requested number is not defined (e.g. 0/0).\n");
if ((err&CBF_NOTIMPLEMENTED)==CBF_NOTIMPLEMENTED)
fprintf(stderr, " cbf: The requested functionality is not yet implemented.\n");
}
#undef cbf_failnez
#define cbf_failnez(x) \
{int err; \
err = (x); \
if (err) { \
fprintf(stderr," cbf: CBFlib fatal error %d\n",err); \
outerror(err); \
return err;\
} \
}
#endif
SaveContainerCbf::SaveContainerCbf(CtSaving &aCtSaving) :
CtSaving::SaveContainer(aCtSaving),
m_fout(NULL)
......@@ -74,6 +132,11 @@ int SaveContainerCbf::_writeCbfHeader(Data &aData,
{
DEB_MEMBER_FUNCT();
char imageBuffer[64];
snprintf(imageBuffer,sizeof(imageBuffer),"image_%d",m_written_frames);
cbf_failnez(cbf_new_datablock (m_cbf, imageBuffer));
aData.header.lock();
Data::HeaderContainer::Header &aDataHeader = aData.header.header();
aHeader.insert(aDataHeader.begin(),aDataHeader.end());
......@@ -125,7 +188,7 @@ int SaveContainerCbf::_writeCbfData(Data &aData)
aData.data(),
aData.depth(),
aData.is_signed(),
aData.size(),
aData.size()/aData.depth(),
"little_endian",
aData.height,
aData.width,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment