summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 284e3d2)
raw | patch | inline | side by side (parent: 284e3d2)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Dec 2011 22:39:37 +0000 (14:39 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Dec 2011 22:39:37 +0000 (14:39 -0800) |
This can only happen when the input size is multiple of the
buffer size of the cascade filter (16k) and ends with an LF,
but in such a case, the code forgot to tell the caller that
it added the "\n" it could not add during the last round.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
buffer size of the cascade filter (16k) and ends with an LF,
but in such a case, the code forgot to tell the caller that
it added the "\n" it could not add during the last round.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c | patch | blob | history |
diff --git a/convert.c b/convert.c
index c2c2c1144df2a65f947943c94d8bb9a29f5e3fcc..c028275c14ef0715d15b892484388fe152036470 100644 (file)
--- a/convert.c
+++ b/convert.c
struct lf_to_crlf_filter {
struct stream_filter filter;
- int want_lf;
+ unsigned want_lf:1;
};
static int lf_to_crlf_filter_fn(struct stream_filter *filter,
lf_to_crlf->want_lf = 0;
}
- if (!input)
- return 0; /* We've already dealt with the state */
+ /* We are told to drain */
+ if (!input) {
+ *osize_p -= o;
+ return 0;
+ }
count = *isize_p;
if (count) {
static struct stream_filter *lf_to_crlf_filter(void)
{
- struct lf_to_crlf_filter *lf_to_crlf = xmalloc(sizeof(*lf_to_crlf));
+ struct lf_to_crlf_filter *lf_to_crlf = xcalloc(1, sizeof(*lf_to_crlf));
lf_to_crlf->filter.vtbl = &lf_to_crlf_vtbl;
- lf_to_crlf->want_lf = 0;
return (struct stream_filter *)lf_to_crlf;
}