Correct some sizeof(size_t) != sizeof(unsigned long) typing errors
Fix size_t vs. unsigned long pointer mismatch warnings introduced with the addition of strbuf_detach(). Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
René Scharfe committed
Oct 21, 2007 at 11:23 UTC
c32f749fec69f92ce3b076128e6322f8130bd881
4 files changed
+13
-5
builtin-apply.c
+1
-1
@@ -152,7 +152,7 @@ struct patch {
152
unsigned int is_rename:1;
153
struct fragment *fragments;
154
char *result;
155
- unsigned long resultsize;
155
+ size_t resultsize;
156
char old_sha1_prefix[41];
157
char new_sha1_prefix[41];
158
struct patch *next;
builtin-archive.c
+3
-1
@@ -148,12 +148,14 @@ void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
148
buffer = read_sha1_file(sha1, type, sizep);
149
if (buffer && S_ISREG(mode)) {
150
struct strbuf buf;
151
+ size_t size = 0;
152
153
strbuf_init(&buf, 0);
154
strbuf_attach(&buf, buffer, *sizep, *sizep + 1);
155
convert_to_working_tree(path, buf.buf, buf.len, &buf);
156
convert_to_archive(path, buf.buf, buf.len, &buf, commit);
156
- buffer = strbuf_detach(&buf, sizep);
157
+ buffer = strbuf_detach(&buf, &size);
158
+ *sizep = size;
159
}
160
161
return buffer;
diff.c
+6
-2
@@ -1512,6 +1512,7 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
1512
static int populate_from_stdin(struct diff_filespec *s)
1513
{
1514
struct strbuf buf;
1515
+ size_t size = 0;
1516
1517
strbuf_init(&buf, 0);
1518
if (strbuf_read(&buf, 0, 0) < 0)
@@ -1519,7 +1520,8 @@ static int populate_from_stdin(struct diff_filespec *s)
1520
strerror(errno));
1521
1522
s->should_munmap = 0;
1522
- s->data = strbuf_detach(&buf, &s->size);
1523
+ s->data = strbuf_detach(&buf, &size);
1524
+ s->size = size;
1525
s->should_free = 1;
1526
return 0;
1527
}
@@ -1609,9 +1611,11 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
1611
*/
1612
strbuf_init(&buf, 0);
1613
if (convert_to_git(s->path, s->data, s->size, &buf)) {
1614
+ size_t size = 0;
1615
munmap(s->data, s->size);
1616
s->should_munmap = 0;
1614
- s->data = strbuf_detach(&buf, &s->size);
1617
+ s->data = strbuf_detach(&buf, &size);
1618
+ s->size = size;
1619
s->should_free = 1;
1620
}
1621
}
entry.c
+3
-1
@@ -119,8 +119,10 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
119
*/
120
strbuf_init(&buf, 0);
121
if (convert_to_working_tree(ce->name, new, size, &buf)) {
122
+ size_t newsize = 0;
123
free(new);
123
- new = strbuf_detach(&buf, &size);
124
+ new = strbuf_detach(&buf, &newsize);
125
+ size = newsize;
126
}
127
128
if (to_tempfile) {