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
maint
Junio C Hamano 2011-12-22 15:30:33 -08:00
commit 35726681d5
8 changed files with 22 additions and 22 deletions

View File

@ -25,7 +25,7 @@ static const char *fast_export_usage[] = {


static int progress; static int progress;
static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT; static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT; static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
static int fake_missing_tagger; static int fake_missing_tagger;
static int use_done_feature; static int use_done_feature;
static int no_data; static int no_data;
@ -51,7 +51,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt,
const char *arg, int unset) const char *arg, int unset)
{ {
if (unset || !strcmp(arg, "abort")) if (unset || !strcmp(arg, "abort"))
tag_of_filtered_mode = ABORT; tag_of_filtered_mode = ERROR;
else if (!strcmp(arg, "drop")) else if (!strcmp(arg, "drop"))
tag_of_filtered_mode = DROP; tag_of_filtered_mode = DROP;
else if (!strcmp(arg, "rewrite")) else if (!strcmp(arg, "rewrite"))

View File

@ -172,10 +172,10 @@ static const char *open_pack_file(const char *pack_name)
if (from_stdin) { if (from_stdin) {
input_fd = 0; input_fd = 0;
if (!pack_name) { if (!pack_name) {
static char tmpfile[PATH_MAX]; static char tmp_file[PATH_MAX];
output_fd = odb_mkstemp(tmpfile, sizeof(tmpfile), output_fd = odb_mkstemp(tmp_file, sizeof(tmp_file),
"pack/tmp_pack_XXXXXX"); "pack/tmp_pack_XXXXXX");
pack_name = xstrdup(tmpfile); pack_name = xstrdup(tmp_file);
} else } else
output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600); output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600);
if (output_fd < 0) if (output_fd < 0)

View File

@ -855,15 +855,15 @@ static struct tree_content *dup_tree_content(struct tree_content *s)


static void start_packfile(void) static void start_packfile(void)
{ {
static char tmpfile[PATH_MAX]; static char tmp_file[PATH_MAX];
struct packed_git *p; struct packed_git *p;
struct pack_header hdr; struct pack_header hdr;
int pack_fd; int pack_fd;


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

View File

@ -73,9 +73,9 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
f = sha1fd_check(index_name); f = sha1fd_check(index_name);
} else { } else {
if (!index_name) { if (!index_name) {
static char tmpfile[PATH_MAX]; static char tmp_file[PATH_MAX];
fd = odb_mkstemp(tmpfile, sizeof(tmpfile), "pack/tmp_idx_XXXXXX"); fd = odb_mkstemp(tmp_file, sizeof(tmp_file), "pack/tmp_idx_XXXXXX");
index_name = xstrdup(tmpfile); index_name = xstrdup(tmp_file);
} else { } else {
unlink(index_name); unlink(index_name);
fd = open(index_name, O_CREAT|O_EXCL|O_WRONLY, 0600); fd = open(index_name, O_CREAT|O_EXCL|O_WRONLY, 0600);

View File

@ -2452,15 +2452,15 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
git_SHA_CTX c; git_SHA_CTX c;
unsigned char parano_sha1[20]; unsigned char parano_sha1[20];
char *filename; char *filename;
static char tmpfile[PATH_MAX]; static char tmp_file[PATH_MAX];


filename = sha1_file_name(sha1); filename = sha1_file_name(sha1);
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename); fd = create_tmpfile(tmp_file, sizeof(tmp_file), filename);
if (fd < 0) { if (fd < 0) {
if (errno == EACCES) if (errno == EACCES)
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory()); return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
else else
return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno)); return error("unable to create temporary sha1 filename %s: %s\n", tmp_file, strerror(errno));
} }


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


return move_temp_to_file(tmpfile, filename); return move_temp_to_file(tmp_file, filename);
} }


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

View File

@ -31,7 +31,7 @@ static void strtonode(struct int_node *item, const char *s)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
struct trp_root root = { ~0 }; struct trp_root root = { ~0U };
uint32_t item; uint32_t item;


if (argc != 1) if (argc != 1)

View File

@ -109,7 +109,7 @@ static struct repo_dirent *repo_read_dirent(uint32_t revision,
static void repo_write_dirent(const uint32_t *path, uint32_t mode, static void repo_write_dirent(const uint32_t *path, uint32_t mode,
uint32_t content_offset, uint32_t del) uint32_t content_offset, uint32_t del)
{ {
uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0; uint32_t name, revision, dir_o = ~0U, parent_dir_o = ~0U;
struct repo_dir *dir; struct repo_dir *dir;
struct repo_dirent *key; struct repo_dirent *key;
struct repo_dirent *dent = NULL; struct repo_dirent *dent = NULL;

View File

@ -8,7 +8,7 @@
#include "obj_pool.h" #include "obj_pool.h"
#include "string_pool.h" #include "string_pool.h"


static struct trp_root tree = { ~0 }; static struct trp_root tree = { ~0U };


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


if (sz == 0) if (sz == 0)