Skip to content

Commit 3572668

Browse files
committed
Merge branch 'ab/sun-studio-portability'
* ab/sun-studio-portability: Appease Sun Studio by renaming "tmpfile" Fix a bitwise negation assignment issue spotted by Sun Studio Fix an enum assignment issue spotted by Sun Studio
2 parents f0ede84 + ab1900a commit 3572668

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

builtin/fast-export.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static const char *fast_export_usage[] = {
2525

2626
static int progress;
2727
static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
28-
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
28+
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
2929
static int fake_missing_tagger;
3030
static int use_done_feature;
3131
static int no_data;
@@ -51,7 +51,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt,
5151
const char *arg, int unset)
5252
{
5353
if (unset || !strcmp(arg, "abort"))
54-
tag_of_filtered_mode = ABORT;
54+
tag_of_filtered_mode = ERROR;
5555
else if (!strcmp(arg, "drop"))
5656
tag_of_filtered_mode = DROP;
5757
else if (!strcmp(arg, "rewrite"))

builtin/index-pack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ static const char *open_pack_file(const char *pack_name)
172172
if (from_stdin) {
173173
input_fd = 0;
174174
if (!pack_name) {
175-
static char tmpfile[PATH_MAX];
176-
output_fd = odb_mkstemp(tmpfile, sizeof(tmpfile),
175+
static char tmp_file[PATH_MAX];
176+
output_fd = odb_mkstemp(tmp_file, sizeof(tmp_file),
177177
"pack/tmp_pack_XXXXXX");
178-
pack_name = xstrdup(tmpfile);
178+
pack_name = xstrdup(tmp_file);
179179
} else
180180
output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600);
181181
if (output_fd < 0)

fast-import.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,15 +855,15 @@ static struct tree_content *dup_tree_content(struct tree_content *s)
855855

856856
static void start_packfile(void)
857857
{
858-
static char tmpfile[PATH_MAX];
858+
static char tmp_file[PATH_MAX];
859859
struct packed_git *p;
860860
struct pack_header hdr;
861861
int pack_fd;
862862

863-
pack_fd = odb_mkstemp(tmpfile, sizeof(tmpfile),
863+
pack_fd = odb_mkstemp(tmp_file, sizeof(tmp_file),
864864
"pack/tmp_pack_XXXXXX");
865-
p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2);
866-
strcpy(p->pack_name, tmpfile);
865+
p = xcalloc(1, sizeof(*p) + strlen(tmp_file) + 2);
866+
strcpy(p->pack_name, tmp_file);
867867
p->pack_fd = pack_fd;
868868
p->do_not_close = 1;
869869
pack_file = sha1fd(pack_fd, p->pack_name);

pack-write.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
7373
f = sha1fd_check(index_name);
7474
} else {
7575
if (!index_name) {
76-
static char tmpfile[PATH_MAX];
77-
fd = odb_mkstemp(tmpfile, sizeof(tmpfile), "pack/tmp_idx_XXXXXX");
78-
index_name = xstrdup(tmpfile);
76+
static char tmp_file[PATH_MAX];
77+
fd = odb_mkstemp(tmp_file, sizeof(tmp_file), "pack/tmp_idx_XXXXXX");
78+
index_name = xstrdup(tmp_file);
7979
} else {
8080
unlink(index_name);
8181
fd = open(index_name, O_CREAT|O_EXCL|O_WRONLY, 0600);

sha1_file.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,15 +2452,15 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
24522452
git_SHA_CTX c;
24532453
unsigned char parano_sha1[20];
24542454
char *filename;
2455-
static char tmpfile[PATH_MAX];
2455+
static char tmp_file[PATH_MAX];
24562456

24572457
filename = sha1_file_name(sha1);
2458-
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
2458+
fd = create_tmpfile(tmp_file, sizeof(tmp_file), filename);
24592459
if (fd < 0) {
24602460
if (errno == EACCES)
24612461
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
24622462
else
2463-
return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno));
2463+
return error("unable to create temporary sha1 filename %s: %s\n", tmp_file, strerror(errno));
24642464
}
24652465

24662466
/* Set it up */
@@ -2505,12 +2505,12 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
25052505
struct utimbuf utb;
25062506
utb.actime = mtime;
25072507
utb.modtime = mtime;
2508-
if (utime(tmpfile, &utb) < 0)
2508+
if (utime(tmp_file, &utb) < 0)
25092509
warning("failed utime() on %s: %s",
2510-
tmpfile, strerror(errno));
2510+
tmp_file, strerror(errno));
25112511
}
25122512

2513-
return move_temp_to_file(tmpfile, filename);
2513+
return move_temp_to_file(tmp_file, filename);
25142514
}
25152515

25162516
int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *returnsha1)

test-treap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void strtonode(struct int_node *item, const char *s)
3131
int main(int argc, char *argv[])
3232
{
3333
struct strbuf sb = STRBUF_INIT;
34-
struct trp_root root = { ~0 };
34+
struct trp_root root = { ~0U };
3535
uint32_t item;
3636

3737
if (argc != 1)

vcs-svn/repo_tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct repo_dirent *repo_read_dirent(uint32_t revision,
109109
static void repo_write_dirent(const uint32_t *path, uint32_t mode,
110110
uint32_t content_offset, uint32_t del)
111111
{
112-
uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0;
112+
uint32_t name, revision, dir_o = ~0U, parent_dir_o = ~0U;
113113
struct repo_dir *dir;
114114
struct repo_dirent *key;
115115
struct repo_dirent *dent = NULL;

vcs-svn/string_pool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "obj_pool.h"
99
#include "string_pool.h"
1010

11-
static struct trp_root tree = { ~0 };
11+
static struct trp_root tree = { ~0U };
1212

1313
struct node {
1414
uint32_t offset;
@@ -78,7 +78,7 @@ void pool_print_seq(uint32_t len, uint32_t *seq, char delim, FILE *stream)
7878
uint32_t pool_tok_seq(uint32_t sz, uint32_t *seq, const char *delim, char *str)
7979
{
8080
char *context = NULL;
81-
uint32_t token = ~0;
81+
uint32_t token = ~0U;
8282
uint32_t length;
8383

8484
if (sz == 0)

0 commit comments

Comments
 (0)