GNOME Bugzilla – Bug 573251
documentation for g_seekable_truncate() needs some love
Last modified: 2017-11-06 08:59:29 UTC
Documentation Section: Over at gtk.org the generated documentation for function g_seekable_truncate() doesn't really tell me anything about that the function does. It sort of just repeats the name of the function. Maybe for people born next to a PDP-11 this is useful info, but it just makes me confused? The current documentation is: "Truncates a stream with a given offset." I wonder for example: * What does "truncate" mean in thus context? * Does it truncate the beginning or the end of the stream? * Is this also written to disk right away or even I close the stream? * On which types of streams is this operation application? (input/output or both?) * What properties of the stream changes when I run this method? For example, is it true that stream.current_position always becomes zero? * If I do .seek(5) and then truncate() will the file now be 5 bytes long? The docs have a huge room for improvement here. As I said, I'm working mostly in higher level languages and they don't have a truncate() function and I've never heard of this function and/or system call and/or fopen mode before and it's _not_ obvious. If someone could just add one more sentence that would still be very useful. PS. The master copy of the documentation is located at glib/gio/gseekable.c on line 183 in case someone wants to contribute a patch. DS. kthxbye Correct version: Other information:
Created attachment 362754 [details] [review] GSeekable: improve g_seekable_[can_]truncate docs I was not born next to a PDP-11, either, but I think this is marginally more informative!
Review of attachment 362754 [details] [review]: A++ suitable substitute for a PDP-11-child.
Attachment 362754 [details] pushed as 41112ef - GSeekable: improve g_seekable_[can_]truncate docs
Created attachment 362990 [details] [review] GSeekable: Fix g_seekable_truncate invoker reference
Review of attachment 362990 [details] [review]: Looks good to me. ::: gio/gseekable.c @@ +161,2 @@ /** + * g_seekable_truncate: (virtual truncate_fn) Ah, sorry! I removed the "Virtual: truncate_fn" annotation because I couldn't see what would consume it (it just looked like human-readable documentation) but I see this style documented here: https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Support_for_GObject_objects
Comment on attachment 362990 [details] [review] GSeekable: Fix g_seekable_truncate invoker reference Attachment 362990 [details] pushed as df66b25 - GSeekable: Fix g_seekable_truncate invoker reference