static void
taxtable_reset_refcount (gpointer key, gpointer value, gpointer notused)
{
    GncTaxTable *table = key;
    gint32 count = GPOINTER_TO_INT(value);

    if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table))
    {
        PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
              guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))),
              gncTaxTableGetRefcount(table), count);
        gncTaxTableSetRefcount(table, count);
    }
}
示例#2
0
static void
taxtable_reset_refcount (gpointer key, gpointer value, gpointer notused)
{
    GncTaxTable *table = static_cast<decltype(table)>(key);
    gint32 count = GPOINTER_TO_INT(value);

    if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table))
    {
        gchar guidstr[GUID_ENCODING_LENGTH+1];
        guid_to_string_buff(qof_instance_get_guid(QOF_INSTANCE(table)),guidstr);
        PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
              guidstr,gncTaxTableGetRefcount(table), count);
        gncTaxTableSetRefcount(table, count);
    }
}
static xmlNodePtr
taxtable_dom_tree_create (GncTaxTable *table)
{
    xmlNodePtr ret, entries;
    GList *list;
    kvp_frame *kf;

    ret = xmlNewNode(NULL, BAD_CAST gnc_taxtable_string);
    xmlSetProp(ret, BAD_CAST "version", BAD_CAST taxtable_version_string);

    maybe_add_guid(ret, taxtable_guid_string, table);
    xmlAddChild(ret, text_to_dom_tree (taxtable_name_string,
                                       gncTaxTableGetName (table)));

    xmlAddChild(ret, int_to_dom_tree (taxtable_refcount_string,
                                      gncTaxTableGetRefcount (table)));
    xmlAddChild(ret, int_to_dom_tree (taxtable_invisible_string,
                                      gncTaxTableGetInvisible (table)));

    /* We should not be our own child */
    if (gncTaxTableGetChild(table) != table)
        maybe_add_guid(ret, taxtable_child_string, gncTaxTableGetChild (table));

    maybe_add_guid(ret, taxtable_parent_string, gncTaxTableGetParent (table));

    entries = xmlNewChild (ret, NULL, BAD_CAST taxtable_entries_string, NULL);
    for (list = gncTaxTableGetEntries (table); list; list = list->next)
    {
        GncTaxTableEntry *entry = list->data;
        xmlAddChild(entries, ttentry_dom_tree_create (entry));
    }

    kf = qof_instance_get_slots (QOF_INSTANCE(table));
    if (kf)
    {
        xmlNodePtr kvpnode = kvp_frame_to_dom_tree(taxtable_slots_string, kf);
        if (kvpnode)
        {
            xmlAddChild(ret, kvpnode);
        }
    }

    return ret;
}
示例#4
0
static xmlNodePtr
taxtable_dom_tree_create (GncTaxTable *table)
{
    xmlNodePtr ret, entries;
    GList *list;

    ret = xmlNewNode(NULL, BAD_CAST gnc_taxtable_string);
    xmlSetProp(ret, BAD_CAST "version", BAD_CAST taxtable_version_string);

    maybe_add_guid(ret, taxtable_guid_string, table);
    xmlAddChild(ret, text_to_dom_tree (taxtable_name_string,
                                       gncTaxTableGetName (table)));

    xmlAddChild(ret, int_to_dom_tree (taxtable_refcount_string,
                                      gncTaxTableGetRefcount (table)));
    xmlAddChild(ret, int_to_dom_tree (taxtable_invisible_string,
                                      gncTaxTableGetInvisible (table)));

    /* We should not be our own child */
    if (gncTaxTableGetChild(table) != table)
        maybe_add_guid(ret, taxtable_child_string, gncTaxTableGetChild (table));

    maybe_add_guid(ret, taxtable_parent_string, gncTaxTableGetParent (table));

    entries = xmlNewChild (ret, NULL, BAD_CAST taxtable_entries_string, NULL);
    for (list = gncTaxTableGetEntries (table); list; list = list->next)
    {
        GncTaxTableEntry *entry = static_cast<decltype(entry)>(list->data);
        xmlAddChild(entries, ttentry_dom_tree_create (entry));
    }

    /* xmlAddChild won't do anything with a NULL, so tests are superfluous. */
    xmlAddChild(ret, qof_instance_slots_to_dom_tree(taxtable_slots_string,
                                                    QOF_INSTANCE(table)));
    return ret;
}