Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mbox/mbox-rewrite.c @ 807:35abd7a5d381 HEAD
Buffer related cleanups. Use PATH_MAX instead of hardcoded 1024 for paths.
Added str_path() and str_ppath() functions. i_snprintf() now returns only -1
or 0 depending on if buffer got full. dec2str() returns the string allocated
from data stack. Instead of just casting to (long) or (int), we now use
dec2str() with printf-like functions. Added o_stream_send_str(). Added
strocpy() and replaced all strcpy()s and strncpy()s with it.
Pretty much untested, hope it doesn't break too badly :)
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 19 Dec 2002 03:02:34 +0200 |
parents | 5ac361acb316 |
children | 86cf24da85f1 |
line wrap: on
line diff
--- a/src/lib-index/mbox/mbox-rewrite.c Wed Dec 18 17:17:01 2002 +0200 +++ b/src/lib-index/mbox/mbox-rewrite.c Thu Dec 19 03:02:34 2002 +0200 @@ -84,7 +84,7 @@ str = t_strdup_printf("X-IMAPbase: %u %u", ctx->uid_validity, ctx->uid_last); - if (o_stream_send(ctx->output, str, strlen(str)) < 0) + if (o_stream_send_str(ctx->output, str) < 0) return FALSE; for (i = 0; i < MAIL_CUSTOM_FLAGS_COUNT; i++) { @@ -92,8 +92,8 @@ if (o_stream_send(ctx->output, " ", 1) < 0) return FALSE; - if (o_stream_send(ctx->output, ctx->custom_flags[i], - strlen(ctx->custom_flags[i])) < 0) + if (o_stream_send_str(ctx->output, + ctx->custom_flags[i]) < 0) return FALSE; } } @@ -113,7 +113,7 @@ x_keywords == NULL) return TRUE; - if (o_stream_send(ctx->output, "X-Keywords:", 11) < 0) + if (o_stream_send_str(ctx->output, "X-Keywords:") < 0) return FALSE; field = 1 << MAIL_CUSTOM_FLAG_1_BIT; @@ -122,8 +122,8 @@ if (o_stream_send(ctx->output, " ", 1) < 0) return FALSE; - if (o_stream_send(ctx->output, ctx->custom_flags[i], - strlen(ctx->custom_flags[i])) < 0) + if (o_stream_send_str(ctx->output, + ctx->custom_flags[i]) < 0) return FALSE; } } @@ -133,8 +133,7 @@ if (o_stream_send(ctx->output, " ", 1) < 0) return FALSE; - if (o_stream_send(ctx->output, x_keywords, - strlen(x_keywords)) < 0) + if (o_stream_send_str(ctx->output, x_keywords) < 0) return FALSE; } @@ -152,7 +151,7 @@ if (status != NULL) str = t_strconcat(str, status, NULL); - if (o_stream_send(ctx->output, str, strlen(str)) < 0) + if (o_stream_send_str(ctx->output, str) < 0) return FALSE; if (o_stream_send(ctx->output, "\n", 1) < 0) return FALSE; @@ -176,7 +175,7 @@ (ctx->msg_flags & MAIL_DELETED) ? "T" : "", x_status, NULL); - if (o_stream_send(ctx->output, str, strlen(str)) < 0) + if (o_stream_send_str(ctx->output, str) < 0) return FALSE; if (o_stream_send(ctx->output, "\n", 1) < 0) return FALSE; @@ -191,7 +190,7 @@ i_snprintf(str, sizeof(str), "Content-Length: %"PRIuUOFF_T"\n", ctx->content_length); - if (o_stream_send(ctx->output, str, strlen(str)) < 0) + if (o_stream_send_str(ctx->output, str) < 0) return FALSE; return TRUE; }