GTK+3 gtk_text_buffer_deserialize

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GTK+3 gtk_text_buffer_deserialize

Gtk+ - General mailing list
Hello list,

I need to save the rtf content of a gtk text buffer into an ASCII file
with some other info. So to avoid the \0 string terminator weirdly
inserted into the gtk text buffer content (why this, developers) and
have only the string 'GTKTEXTBUFFERCONTENTS-0001' saved I replace the
content with spaces and then when loading it BEFORE putting it back
into the gtk text buffer with the function in the subject I replace
the bytes with the original ones after GTKTEXTBUFFERCONTENTS-0001 so,
0,0,2,122 I also add 10 at the of the content. When I use the above
function I get the error:

Serialised data is malformed

I went into the sources of gtk_text_buffer_serialize to try to
understand what originates this error but with no luck as I couldn't
find that string into the sources.

Can anyone help please?

Thanks
Giuseppe
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: GTK+3 gtk_text_buffer_deserialize

Gtk+ - General mailing list
Ok, solved. The lenght of the whole buffer is stored after the header GTKTEXTBUFFERCONTENTS-0001 minus 30 that is the length of header itself.

KInd regards

On Mon, 31 Dec 2018 at 17:41, Giuseppe Torelli <[hidden email]> wrote:
Hello list,

I need to save the rtf content of a gtk text buffer into an ASCII file
with some other info. So to avoid the \0 string terminator weirdly
inserted into the gtk text buffer content (why this, developers) and
have only the string 'GTKTEXTBUFFERCONTENTS-0001' saved I replace the
content with spaces and then when loading it BEFORE putting it back
into the gtk text buffer with the function in the subject I replace
the bytes with the original ones after GTKTEXTBUFFERCONTENTS-0001 so,
0,0,2,122 I also add 10 at the of the content. When I use the above
function I get the error:

Serialised data is malformed

I went into the sources of gtk_text_buffer_serialize to try to
understand what originates this error but with no luck as I couldn't
find that string into the sources.

Can anyone help please?

Thanks
Giuseppe

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list