summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/generic/mhdriver_message.c
Unidiff
Diffstat (limited to 'kmicromail/libetpan/generic/mhdriver_message.c') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/generic/mhdriver_message.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kmicromail/libetpan/generic/mhdriver_message.c b/kmicromail/libetpan/generic/mhdriver_message.c
index 2c023e7..aafd2d9 100644
--- a/kmicromail/libetpan/generic/mhdriver_message.c
+++ b/kmicromail/libetpan/generic/mhdriver_message.c
@@ -123,50 +123,51 @@ static inline struct mh_session_state_data * get_data(mailmessage * msg)
123 123
124static inline struct mailmh_folder * get_mh_cur_folder(mailmessage * msg) 124static inline struct mailmh_folder * get_mh_cur_folder(mailmessage * msg)
125{ 125{
126 return get_data(msg)->mh_cur_folder; 126 return get_data(msg)->mh_cur_folder;
127} 127}
128 128
129static int mh_initialize(mailmessage * msg_info) 129static int mh_initialize(mailmessage * msg_info)
130{ 130{
131 struct generic_message_t * msg; 131 struct generic_message_t * msg;
132 int r; 132 int r;
133 char * uid; 133 char * uid;
134 char static_uid[PATH_MAX]; 134 char static_uid[PATH_MAX];
135 struct mailmh_msg_info * mh_msg_info; 135 struct mailmh_msg_info * mh_msg_info;
136 chashdatum key; 136 chashdatum key;
137 chashdatum value; 137 chashdatum value;
138 138
139 key.data = &msg_info->msg_index; 139 key.data = &msg_info->msg_index;
140 key.len = sizeof(msg_info->msg_index); 140 key.len = sizeof(msg_info->msg_index);
141 r = chash_get(get_mh_cur_folder(msg_info)->fl_msgs_hash, &key, &value); 141 r = chash_get(get_mh_cur_folder(msg_info)->fl_msgs_hash, &key, &value);
142 if (r < 0) 142 if (r < 0)
143 return MAIL_ERROR_INVAL; 143 return MAIL_ERROR_INVAL;
144 144
145 mh_msg_info = value.data; 145 mh_msg_info = value.data;
146 146
147 snprintf(static_uid, PATH_MAX, "%u-%lu-%u", msg_info->msg_index, 147 snprintf(static_uid, PATH_MAX, "%u-%lu-%lu", msg_info->msg_index,
148 mh_msg_info->msg_mtime, mh_msg_info->msg_size); 148 (unsigned long) mh_msg_info->msg_mtime,
149 (unsigned long) mh_msg_info->msg_size);
149 uid = strdup(static_uid); 150 uid = strdup(static_uid);
150 if (uid == NULL) 151 if (uid == NULL)
151 return MAIL_ERROR_MEMORY; 152 return MAIL_ERROR_MEMORY;
152 153
153 r = mailmessage_generic_initialize(msg_info); 154 r = mailmessage_generic_initialize(msg_info);
154 if (r != MAIL_NO_ERROR) { 155 if (r != MAIL_NO_ERROR) {
155 free(uid); 156 free(uid);
156 return r; 157 return r;
157 } 158 }
158 159
159 msg = msg_info->msg_data; 160 msg = msg_info->msg_data;
160 msg->msg_prefetch = mh_prefetch; 161 msg->msg_prefetch = mh_prefetch;
161 msg->msg_prefetch_free = mh_prefetch_free; 162 msg->msg_prefetch_free = mh_prefetch_free;
162 msg_info->msg_uid = uid; 163 msg_info->msg_uid = uid;
163 164
164 return MAIL_NO_ERROR; 165 return MAIL_NO_ERROR;
165} 166}
166 167
167 168
168static int mh_fetch_size(mailmessage * msg_info, 169static int mh_fetch_size(mailmessage * msg_info,
169 size_t * result) 170 size_t * result)
170{ 171{
171 int r; 172 int r;
172 size_t size; 173 size_t size;