mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 03:02:10 +01:00
move byteswapping from reader to gsettingsschema
This commit is contained in:
parent
d0b4953423
commit
71c30304ea
@ -118,7 +118,7 @@ g_settings_schema_get_string (GSettingsSchema *schema,
|
||||
const gchar *result = NULL;
|
||||
GVariant *value;
|
||||
|
||||
if ((value = g_settings_schema_get_value (schema, key, NULL)))
|
||||
if ((value = gvdb_table_get_value (schema->priv->table, key, NULL)))
|
||||
{
|
||||
result = g_variant_get_string (value, NULL);
|
||||
g_variant_unref (value);
|
||||
@ -166,7 +166,25 @@ g_settings_schema_get_value (GSettingsSchema *schema,
|
||||
const gchar *key,
|
||||
GVariant **options)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
GVariant *variant, *tmp;
|
||||
|
||||
tmp = gvdb_table_get_value (schema->priv->table, key, options);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
variant = g_variant_byteswap (tmp);
|
||||
g_variant_unref (tmp);
|
||||
}
|
||||
else
|
||||
variant = NULL;
|
||||
|
||||
/* NOTE: no options have byteswapped data in them at the moment */
|
||||
|
||||
return variant;
|
||||
#else
|
||||
return gvdb_table_get_value (schema->priv->table, key, options);
|
||||
#endif
|
||||
}
|
||||
|
||||
const gchar *
|
||||
|
@ -413,13 +413,6 @@ gvdb_table_get_value (GvdbTable *file,
|
||||
value = g_variant_get_variant (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
if (file->byteswapped)
|
||||
{
|
||||
GVariant *tmp = g_variant_byteswap (value);
|
||||
g_variant_unref (value);
|
||||
value = tmp;
|
||||
}
|
||||
|
||||
if (options != NULL)
|
||||
{
|
||||
data = gvdb_table_dereference (file, &item->options, 8, &size);
|
||||
@ -431,13 +424,6 @@ gvdb_table_get_value (GvdbTable *file,
|
||||
(GDestroyNotify) g_mapped_file_unref,
|
||||
g_mapped_file_ref (file->mapped));
|
||||
g_variant_ref_sink (*options);
|
||||
|
||||
if (file->byteswapped)
|
||||
{
|
||||
GVariant *tmp = g_variant_byteswap (*options);
|
||||
g_variant_unref (*options);
|
||||
*options = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
*options = NULL;
|
||||
@ -479,6 +465,7 @@ gvdb_table_get_table (GvdbTable *file,
|
||||
|
||||
new = g_slice_new0 (GvdbTable);
|
||||
new->mapped = g_mapped_file_ref (file->mapped);
|
||||
new->byteswapped = file->byteswapped;
|
||||
new->trusted = file->trusted;
|
||||
new->data = file->data;
|
||||
new->size = file->size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user