Skip to content

Commit 79db12e

Browse files
author
Junio C Hamano
committed
A bit more format warning squelching.
Inspired by patch from Timo Sirainen. Most of them are not strictly necessary but making warnings less chatty would help spot real bugs later. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 4ec99bf commit 79db12e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

convert-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void convert_ascii_sha1(void *buffer)
6060
struct entry *entry;
6161

6262
if (get_sha1_hex(buffer, sha1))
63-
die("expected sha1, got '%s'", buffer);
63+
die("expected sha1, got '%s'", (char*) buffer);
6464
entry = convert_entry(sha1);
6565
memcpy(buffer, sha1_to_hex(entry->new_sha1), 40);
6666
}
@@ -272,7 +272,7 @@ static void convert_commit(void *buffer, unsigned long size, unsigned char *resu
272272
unsigned long orig_size = size;
273273

274274
if (memcmp(buffer, "tree ", 5))
275-
die("Bad commit '%s'", buffer);
275+
die("Bad commit '%s'", (char*) buffer);
276276
convert_ascii_sha1(buffer+5);
277277
buffer += 46; /* "tree " + "hex sha1" + "\n" */
278278
while (!memcmp(buffer, "parent ", 7)) {

diff.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ static void builtin_diff(const char *name_a,
134134
int complete_rewrite)
135135
{
136136
int i, next_at, cmd_size;
137-
const char *diff_cmd = "diff -L%s%s -L%s%s";
138-
const char *diff_arg = "%s %s||:"; /* "||:" is to return 0 */
137+
const char *const diff_cmd = "diff -L%s%s -L%s%s";
138+
const char *const diff_arg = "%s %s||:"; /* "||:" is to return 0 */
139139
const char *input_name_sq[2];
140140
const char *path0[2];
141141
const char *path1[2];
@@ -782,7 +782,8 @@ static void diff_flush_raw(struct diff_filepair *p,
782782
char status[10];
783783

784784
if (line_termination) {
785-
const char *err = "path %s cannot be expressed without -z";
785+
const char *const err =
786+
"path %s cannot be expressed without -z";
786787
if (strchr(p->one->path, line_termination) ||
787788
strchr(p->one->path, inter_name_termination))
788789
die(err, p->one->path);

0 commit comments

Comments
 (0)