Details

[Home]

Issue of the Implementation # D0057

Brief

Inconsistency between standard and implementation of the interface "g_key_file_set_boolean_list"

Detailed Description

Documentation for the interface g_key_file_set_boolean_list states: "Associates a list of boolean values with key under group_name. If key cannot be found then it is created. 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_set_boolean_list: 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-set-boolean-list

Example

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

char *boolText="# this is just an example \n[First Group]\nNumbers=10,20,1,0\n"\
    " True=true \n False=false \n BooleanList=true,false,true,true\n\n# "\
    "another group \n[Another Group]\n True=true \n False=false \n "\
    "BooleanList=true,false,true,true\nNumbers=10,20,1,0\n ";

#define KEY "BooleanList"

int main ()
{
    GKeyFile *gkf = NULL;
    gboolean bool_list[] = {TRUE, FALSE, TRUE, FALSE, TRUE};

    gkf=g_key_file_new ();
    g_key_file_load_from_data (gkf, boolText, strlen (boolText), 
        G_KEY_FILE_KEEP_COMMENTS, NULL);

    g_key_file_set_boolean_list (gkf, NULL, KEY, bool_list, 5);
    return 0;
}

Component

gtk-glib 2.6.2 or later

Accepted

Gnome Bugzilla 481158

Status

Fixed in gtk-glib - 2.16

[Home]