Diffstat (limited to 'kmicromail/libetpan/generic/mboxdriver_message.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libetpan/generic/mboxdriver_message.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kmicromail/libetpan/generic/mboxdriver_message.c b/kmicromail/libetpan/generic/mboxdriver_message.c index da9a65d..6922625 100644 --- a/kmicromail/libetpan/generic/mboxdriver_message.c +++ b/kmicromail/libetpan/generic/mboxdriver_message.c | |||
@@ -12,49 +12,49 @@ | |||
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. Neither the name of the libEtPan! project nor the names of its | 15 | * 3. Neither the name of the libEtPan! project nor the names of its |
16 | * contributors may be used to endorse or promote products derived | 16 | * contributors may be used to endorse or promote products derived |
17 | * from this software without specific prior written permission. | 17 | * from this software without specific prior written permission. |
18 | * | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * $Id$ | 33 | * $Id$ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "mhdriver_message.h" | 36 | #include "mboxdriver_message.h" |
37 | 37 | ||
38 | #include "mailmessage_tools.h" | 38 | #include "mailmessage_tools.h" |
39 | #include "mboxdriver_tools.h" | 39 | #include "mboxdriver_tools.h" |
40 | #include "mboxdriver.h" | 40 | #include "mboxdriver.h" |
41 | #include "mailmbox.h" | 41 | #include "mailmbox.h" |
42 | 42 | ||
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | #include <sys/mman.h> | 44 | #include <sys/mman.h> |
45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
46 | #include <sys/stat.h> | 46 | #include <sys/stat.h> |
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #include <string.h> | 48 | #include <string.h> |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> |
50 | 50 | ||
51 | static int mbox_prefetch(mailmessage * msg_info); | 51 | static int mbox_prefetch(mailmessage * msg_info); |
52 | 52 | ||
53 | static void mbox_prefetch_free(struct generic_message_t * msg); | 53 | static void mbox_prefetch_free(struct generic_message_t * msg); |
54 | 54 | ||
55 | static int mbox_initialize(mailmessage * msg_info); | 55 | static int mbox_initialize(mailmessage * msg_info); |
56 | 56 | ||
57 | static int mbox_fetch_size(mailmessage * msg_info, | 57 | static int mbox_fetch_size(mailmessage * msg_info, |
58 | size_t * result); | 58 | size_t * result); |
59 | 59 | ||
60 | static int mbox_fetch_header(mailmessage * msg_info, | 60 | static int mbox_fetch_header(mailmessage * msg_info, |
@@ -135,50 +135,50 @@ static int mbox_initialize(mailmessage * msg_info) | |||
135 | char static_uid[PATH_MAX]; | 135 | char static_uid[PATH_MAX]; |
136 | struct mailmbox_msg_info * info; | 136 | struct mailmbox_msg_info * info; |
137 | struct mailmbox_folder * folder; | 137 | struct mailmbox_folder * folder; |
138 | int res; | 138 | int res; |
139 | chashdatum key; | 139 | chashdatum key; |
140 | chashdatum data; | 140 | chashdatum data; |
141 | 141 | ||
142 | folder = get_mbox_session(msg_info); | 142 | folder = get_mbox_session(msg_info); |
143 | if (folder == NULL) { | 143 | if (folder == NULL) { |
144 | res = MAIL_ERROR_BAD_STATE; | 144 | res = MAIL_ERROR_BAD_STATE; |
145 | goto err; | 145 | goto err; |
146 | } | 146 | } |
147 | 147 | ||
148 | key.data = &msg_info->msg_index; | 148 | key.data = &msg_info->msg_index; |
149 | key.len = sizeof(msg_info->msg_index); | 149 | key.len = sizeof(msg_info->msg_index); |
150 | 150 | ||
151 | r = chash_get(folder->mb_hash, &key, &data); | 151 | r = chash_get(folder->mb_hash, &key, &data); |
152 | if (r < 0) { | 152 | if (r < 0) { |
153 | res = MAIL_ERROR_MSG_NOT_FOUND; | 153 | res = MAIL_ERROR_MSG_NOT_FOUND; |
154 | goto err; | 154 | goto err; |
155 | } | 155 | } |
156 | 156 | ||
157 | info = data.data; | 157 | info = data.data; |
158 | 158 | ||
159 | snprintf(static_uid, PATH_MAX, "%u-%u", | 159 | snprintf(static_uid, PATH_MAX, "%u-%lu", |
160 | msg_info->msg_index, info->msg_body_len); | 160 | msg_info->msg_index, (unsigned long) info->msg_body_len); |
161 | uid = strdup(static_uid); | 161 | uid = strdup(static_uid); |
162 | if (uid == NULL) { | 162 | if (uid == NULL) { |
163 | res = MAIL_ERROR_MEMORY; | 163 | res = MAIL_ERROR_MEMORY; |
164 | goto err; | 164 | goto err; |
165 | } | 165 | } |
166 | 166 | ||
167 | r = mailmessage_generic_initialize(msg_info); | 167 | r = mailmessage_generic_initialize(msg_info); |
168 | if (r != MAIL_NO_ERROR) { | 168 | if (r != MAIL_NO_ERROR) { |
169 | free(uid); | 169 | free(uid); |
170 | res = r; | 170 | res = r; |
171 | goto err; | 171 | goto err; |
172 | } | 172 | } |
173 | 173 | ||
174 | msg = msg_info->msg_data; | 174 | msg = msg_info->msg_data; |
175 | msg->msg_prefetch = mbox_prefetch; | 175 | msg->msg_prefetch = mbox_prefetch; |
176 | msg->msg_prefetch_free = mbox_prefetch_free; | 176 | msg->msg_prefetch_free = mbox_prefetch_free; |
177 | msg_info->msg_uid = uid; | 177 | msg_info->msg_uid = uid; |
178 | 178 | ||
179 | return MAIL_NO_ERROR; | 179 | return MAIL_NO_ERROR; |
180 | 180 | ||
181 | err: | 181 | err: |
182 | return res; | 182 | return res; |
183 | } | 183 | } |
184 | 184 | ||