fix - write empty chunks. need them for corner case. see comments.

SVN revision: 41810
This commit is contained in:
Carsten Haitzler 2009-08-16 07:06:22 +00:00
parent 2a06a861d5
commit 65c50a0a4e
1 changed files with 6 additions and 2 deletions

View File

@ -868,7 +868,10 @@ eet_data_chunk_put(Eet_Dictionary *ed, Eet_Data_Chunk *chnk, Eet_Data_Stream *ds
int string_ret = 0;
unsigned char buf[4] = "CHK";
if (!chnk->data && chnk->type != EET_T_NULL) return;
/* disable this check - it will allow empty chunks to be written. this is
* right for corner-cases when y have a struct with empty fields (empty
* strings or empty list ptrs etc.) */
/* if (!chnk->data && chnk->type != EET_T_NULL) return; */
/* chunk head */
/* eet_data_stream_write(ds, "CHnK", 4);*/
@ -896,7 +899,8 @@ eet_data_chunk_put(Eet_Dictionary *ed, Eet_Data_Chunk *chnk, Eet_Data_Stream *ds
eet_data_stream_write(ds, string, string_ret);
/* write payload */
eet_data_stream_write(ds, chnk->data, chnk->size);
if (chnk->data)
eet_data_stream_write(ds, chnk->data, chnk->size);
free(string);
on_error: