From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: [PATCH] Fix a typo in crlf conversion code
Date: Sun, 22 Apr 2007 16:12:22 +0200 [thread overview]
Message-ID: <20070422141222.GC2431@steel.home> (raw)
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>
---
convert.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/convert.c b/convert.c
index 37239ac..ad106ef 100644
--- a/convert.c
+++ b/convert.c
@@ -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);
@@ -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);
}
@@ -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);
--
1.5.1.1.946.gdb75a
next reply other threads:[~2007-04-22 14:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-22 14:12 Alex Riesen [this message]
2007-04-22 14:11 ` [PATCH] Fix crash in t0020 (crlf conversion) Alex Riesen
2007-04-22 22:52 ` Alex Riesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070422141222.GC2431@steel.home \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).