After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 573251 - documentation for g_seekable_truncate() needs some love
documentation for g_seekable_truncate() needs some love
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-02-26 10:38 UTC by Martin Olsson
Modified: 2017-11-06 08:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GSeekable: improve g_seekable_[can_]truncate docs (2.03 KB, patch)
2017-11-01 14:44 UTC, Will Thompson
committed Details | Review
GSeekable: Fix g_seekable_truncate invoker reference (789 bytes, patch)
2017-11-04 19:06 UTC, Rico Tzschichholz
committed Details | Review

Description Martin Olsson 2009-02-26 10:38: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:
Comment 1 Will Thompson 2017-11-01 14:44:50 UTC
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!
Comment 2 Philip Withnall 2017-11-01 15:28:58 UTC
Review of attachment 362754 [details] [review]:

A++ suitable substitute for a PDP-11-child.
Comment 3 Philip Withnall 2017-11-01 15:31:15 UTC
Attachment 362754 [details] pushed as 41112ef - GSeekable: improve g_seekable_[can_]truncate docs
Comment 4 Rico Tzschichholz 2017-11-04 19:06:53 UTC
Created attachment 362990 [details] [review]
GSeekable: Fix g_seekable_truncate invoker reference
Comment 5 Will Thompson 2017-11-06 08:17:47 UTC
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 6 Will Thompson 2017-11-06 08:17:50 UTC
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 7 Rico Tzschichholz 2017-11-06 08:59:29 UTC
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