glib/gio/gvdb/gvdb-format.h
2010-04-13 15:39:12 -04:00

62 lines
1.1 KiB
C

#include <glib.h>
typedef struct { guint16 __value; } guint16_le;
typedef struct { guint32 __value; } guint32_le;
struct gvdb_pointer {
guint32_le start;
guint32_le end;
};
struct gvdb_hash_header {
guint32_le n_bloom_words;
guint32_le n_buckets;
};
struct gvdb_hash_item {
guint32_le hash_value;
guint32_le parent;
guint32_le key_start;
guint16_le key_size;
gchar type;
gchar unused;
union
{
struct gvdb_pointer pointer;
gchar direct[8];
} value;
struct gvdb_pointer options;
};
struct gvdb_header {
guint32 signature[2];
guint32_le version;
guint32_le options;
struct gvdb_pointer root;
};
static inline guint32_le guint32_to_le (guint32 value) {
guint32_le result = { GUINT32_TO_LE (value) };
return result;
}
static inline guint32 guint32_from_le (guint32_le value) {
return GUINT32_FROM_LE (value.__value);
}
static inline guint16_le guint16_to_le (guint16 value) {
guint16_le result = { GUINT16_TO_LE (value) };
return result;
}
static inline guint16 guint16_from_le (guint16_le value) {
return GUINT16_FROM_LE (value.__value);
}
#define GVDB_SIGNATURE0 1918981703
#define GVDB_SIGNATURE1 1953390953