@matheusbsbs / matheus-bagliano / commits / 67e22ed58f
Fork 0

Fix a typo in crlf conversion code

Also, noticed by valgrind: the code caused a read out-of-bounds. Some comments updated as well (they still reflected old calling conventions). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alex Riesen committed Apr 22, 2007 at 16:12 UTC 67e22ed58f776372de5ed0a5e6fb329bc24b52b2
1 file changed +5 -5
convert.c
+5 -5
@@ -115,8 +115,8 @@ static char *crlf_to_git(const char *path, const char *src, unsigned long *sizep
115 }
116
117 /*
118 - * Ok, allocate a new buffer, fill it in, and return true
119 - * to let the caller know that we switched buffers on it.
118 + * Ok, allocate a new buffer, fill it in, and return it
119 + * to let the caller know that we switched buffers.
120 */
121 nsize = size - stats.crlf;
122 buffer = xmalloc(nsize);
@@ -137,7 +137,7 @@ static char *crlf_to_git(const char *path, const char *src, unsigned long *sizep
137 } else {
138 do {
139 unsigned char c = *src++;
140 - if (! (c == '\r' && (1 < size && *buffer == '\n')))
140 + if (! (c == '\r' && (1 < size && *src == '\n')))
141 *dst++ = c;
142 } while (--size);
143 }
@@ -180,8 +180,8 @@ static char *crlf_to_worktree(const char *path, const char *src, unsigned long *
180 }
181
182 /*
183 - * Ok, allocate a new buffer, fill it in, and return true
184 - * to let the caller know that we switched buffers on it.
183 + * Ok, allocate a new buffer, fill it in, and return it
184 + * to let the caller know that we switched buffers.
185 */
186 nsize = size + stats.lf - stats.crlf;
187 buffer = xmalloc(nsize);