Details

[Home]

Issue of the Implementation # D0056

Brief

Inconsistency between standard and implementation of the interface "g_key_file_get_integer"

Detailed Description

Documentation for the interface g_key_file_get_integer states: "Returns the value associated with key under group_name as an integer. If group_name is NULL, the start_group is used.". But invocation of the interface with the parameter "group_name" = NULL returns with the following error message "GLib-CRITICAL **: g_key_file_get_integer: assertion `group_name != NULL' failed".

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-integer

Example

#include <stdio.h>
#include <string.h>
#include <glib.h>

char *text = "[Another Group]\nNumbers=2;20;-200;0\n\nInteger=200\n\n"\
    "IntegerList=-10;3;0;100\n\nBooleanList=true;false;true;true\n\n "\
    "False=false\nTrue=true\n\nString=String\n\nStringList=Hello;Hi\n"\
    "StringList[it]=Ciao;Hi";

#define KEY "Integer"

int main ()
{
    GKeyFile *gkf = NULL;

    gkf=g_key_file_new ();
    g_key_file_load_from_data (gkf, text, strlen (text), G_KEY_FILE_NONE, NULL);

    g_key_file_get_integer (gkf, NULL, KEY, NULL);
    return 0;
}

Component

gtk-glib 2.6.2 or later

Accepted

Gnome Bugzilla 477658

Status

Fixed in gtk-glib - 2.16

[Home]