diff options
author | Ryan Lortie <desrt@desrt.ca> | 2015-05-11 09:25:36 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2015-05-11 09:25:36 -0400 |
commit | 1f83033caba9030b9f5464cfe617431e222bcb3b (patch) | |
tree | 107fe38bf3cf89dc322bf310986c3d951ad65b8a /src/dfi-builder.c | |
parent | 5c13169e53b30a0f8f78bb01b6655ebe220cd95f (diff) |
randomwip/dfi
Diffstat (limited to 'src/dfi-builder.c')
-rw-r--r-- | src/dfi-builder.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/dfi-builder.c b/src/dfi-builder.c index fd5c6c5..36769a8 100644 --- a/src/dfi-builder.c +++ b/src/dfi-builder.c @@ -117,6 +117,21 @@ dfi_builder_write_uint32 (DfiBuilder *builder, return offset; } +static guint +dfi_builder_write_uint64 (DfiBuilder *builder, + guint64 value) +{ + guint offset = dfi_builder_get_offset (builder); + + dfi_builder_check_alignment (builder, sizeof (guint64)); + + value = GUINT64_TO_LE (value); + + g_string_append_len (builder->string, (gpointer) &value, sizeof value); + + return offset; +} + #if 0 static guint dfi_builder_write_raw_string (DfiBuilder *builder, @@ -164,6 +179,20 @@ dfi_builder_write_string_list (DfiBuilder *builder, } static guint +dfi_builder_write_uint64_list (DfiBuilder *builder, + const guint64 *items, + guint n_items) +{ + guint offset = dfi_builder_get_aligned (builder, sizeof (guint64)); + guint i; + + for (i = 0; i < n_items; i++) + dfi_builder_write_uint64 (builder, items[i]); + + return offset; +} + +static guint dfi_builder_write_id (DfiBuilder *builder, DfiStringList *string_list, const gchar *string) @@ -337,6 +366,8 @@ dfi_builder_write_text_index (DfiBuilder *builder, enum { + DFI_ITEM_SUBDIRS, + DFI_ITEM_TIMESTAMPS, DFI_ITEM_APP_NAMES, DFI_ITEM_KEY_NAMES, DFI_ITEM_LOCALE_NAMES, @@ -382,6 +413,8 @@ dfi_builder_serialise (DfiBuilder *builder) * refer to strings in the C locale. */ { + items[DFI_ITEM_SUBDIRS] = dfi_builder_write_string_list (builder, builder->subdirs); + items[DFI_ITEM_TIMESTMAPS] = dfi_builder_write_ items[DFI_ITEM_APP_NAMES] = dfi_builder_write_string_list (builder, builder->app_names); items[DFI_ITEM_KEY_NAMES] = dfi_builder_write_string_list (builder, builder->key_names); items[DFI_ITEM_LOCALE_NAMES] = dfi_builder_write_string_list (builder, builder->locale_names); |