Skip to content

Commit

Permalink
Fix a typo in crlf conversion code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Apr 22, 2007
1 parent 2b6854c commit 67e22ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ static char *crlf_to_git(const char *path, const char *src, unsigned long *sizep
}

/*
* Ok, allocate a new buffer, fill it in, and return true
* to let the caller know that we switched buffers on it.
* Ok, allocate a new buffer, fill it in, and return it
* to let the caller know that we switched buffers.
*/
nsize = size - stats.crlf;
buffer = xmalloc(nsize);
Expand All @@ -137,7 +137,7 @@ static char *crlf_to_git(const char *path, const char *src, unsigned long *sizep
} else {
do {
unsigned char c = *src++;
if (! (c == '\r' && (1 < size && *buffer == '\n')))
if (! (c == '\r' && (1 < size && *src == '\n')))
*dst++ = c;
} while (--size);
}
Expand Down Expand Up @@ -180,8 +180,8 @@ static char *crlf_to_worktree(const char *path, const char *src, unsigned long *
}

/*
* Ok, allocate a new buffer, fill it in, and return true
* to let the caller know that we switched buffers on it.
* Ok, allocate a new buffer, fill it in, and return it
* to let the caller know that we switched buffers.
*/
nsize = size + stats.lf - stats.crlf;
buffer = xmalloc(nsize);
Expand Down

0 comments on commit 67e22ed

Please sign in to comment.