Details
[Home]
Issue of the Implementation # D0025
Brief
The "g_key_file_get_comment" interface returns comment with unexpected new line symbol at the end
Detailed Description
Invocation of the interface g_key_file_get_comment returns comment with added new line symbol at the end. This is caused by inner function "g_key_file_parse_value_as_comment" which adds '\n' symbol at the end of the comment.
Problem location(s) in the standard
Linux Standard Base Desktop Specification 3.1, Chapter 12. Libraries, 12.2 Interfaces for libglib-2.0; http://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html#g-key-file-get-comment
Example
#include <stdio.h>
#include <string.h>
#include <glib.h>
char *textComment="#First Comment";
int main ()
{
GKeyFile *gkf=NULL;
gchar *cmnt=NULL;
gkf=g_key_file_new();
g_key_file_load_from_data(gkf, textComment, strlen(textComment),
G_KEY_FILE_KEEP_COMMENTS, NULL);
cmnt=g_key_file_get_comment(gkf, NULL, NULL, NULL);
printf ("comment = \"%s\" end of comment\n", cmnt);
return 0;
}
Component
gtk-glib 2.6.2 or later
Accepted
Gnome Bugzilla 479725
[Home]
»