mail-cache-fields.c revision bc793bfcee945ce8871edfa298fe7235744425b6
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (C) 2004 Timo Sirainen */
86bea1f8bffc2d98196f8655eecea9174c4f458aTimo Sirainenstatic bool field_has_fixed_size(enum mail_cache_field_type type)
b321df9603081896b70ec44635af96d674a9839aTimo Sirainenstatic bool field_decision_is_valid(enum mail_cache_decision_type type)
7d6389e4053c2dac1fb37180b5756b00785983dcTimo Sirainenstatic int field_type_verify(struct mail_cache *cache, unsigned int idx,
35136dd2baf8dc30e4e754294ed81ff48e8c1e64Timo Sirainen enum mail_cache_field_type type, unsigned int size)
35136dd2baf8dc30e4e754294ed81ff48e8c1e64Timo Sirainen const struct mail_cache_field *field = &cache->fields[idx].field;
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen "registered field %s type changed", field->name);
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainen if (field->field_size != size && field_has_fixed_size(type)) {
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainen "registered field %s size changed", field->name);
25ee72451d16374ed27fdbf829f4ec756c778352Timo Sirainenvoid mail_cache_register_fields(struct mail_cache *cache,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen unsigned int new_idx;
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen unsigned int i, j;
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen for (i = 0; i < fields_count; i++) {
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen if (hash_lookup_full(cache->field_name_hash, fields[i].name,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen i_assert(fields[i].type < MAIL_CACHE_FIELD_COUNT);
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen /* check if the same header is being registered in the
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen same field array */
43a66a0b16299bd4f7615acd85e98bd3832c54d5Timo Sirainen for (j = 0; j < i; j++) {
43a66a0b16299bd4f7615acd85e98bd3832c54d5Timo Sirainen if (strcasecmp(fields[i].name, fields[j].name) == 0) {
for (i = 0; i < fields_count; i++) {
const struct mail_cache_field *
unsigned int *count_r)
return list;
*offset_r = 0;
offset = 0;
while (next_offset != 0) {
sizeof(*field_hdr) +
unsigned int new_fields_count;
if (offset == 0) {
sizeof(*field_hdr) +
if (new_fields_count != 0) {
new_fields_count * sizeof(unsigned int));
decisions[i];
const void *data;
unsigned int i, field;
const int *data;
unsigned int i, field;
int ret = 0;
t_push();
sizeof(uint32_t));
if (ret == 0) {
if (ret == 0) {
t_pop();
if (ret == 0)
return ret;
int ret;
return ret;
unsigned int field;
const char *name;
uint32_t i;
sizeof(uint32_t));
sizeof(uint32_t));
if (*offset_r == 0) {