Clean up newly introduced warnings

The attempt to "clean up warnings" seems to have introduced some
new warnings on compliant compilers.  This fixes those in a way
that I suspect will also be okay for the non-compliant compilers.

Also this fixes what appears to be an extra semicolon in the
repo initialization template dir handling (and as part of that
fix, handles the case where an error occurs correctly).
This commit is contained in:
Russell Belfer 2013-09-23 13:34:01 -07:00
parent 10edb7a92a
commit 1ca3e49f88
3 changed files with 11 additions and 9 deletions

View File

@ -120,9 +120,9 @@ typedef struct git_index_entry {
/** Capabilities of system that affect index actions. */ /** Capabilities of system that affect index actions. */
typedef enum { typedef enum {
GIT_INDEXCAP_IGNORE_CASE = 1, GIT_INDEXCAP_IGNORE_CASE = 1u,
GIT_INDEXCAP_NO_FILEMODE = 2, GIT_INDEXCAP_NO_FILEMODE = 2u,
GIT_INDEXCAP_NO_SYMLINKS = 4, GIT_INDEXCAP_NO_SYMLINKS = 4u,
GIT_INDEXCAP_FROM_OWNER = ~0u GIT_INDEXCAP_FROM_OWNER = ~0u
} git_indexcap_t; } git_indexcap_t;
@ -219,7 +219,7 @@ GIT_EXTERN(unsigned int) git_index_caps(const git_index *index);
* @param caps A combination of GIT_INDEXCAP values * @param caps A combination of GIT_INDEXCAP values
* @return 0 on success, -1 on failure * @return 0 on success, -1 on failure
*/ */
GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps); GIT_EXTERN(int) git_index_set_caps(git_index *index, unsigned int caps);
/** /**
* Update the contents of an existing index object in memory * Update the contents of an existing index object in memory

View File

@ -408,7 +408,7 @@ static int create_index_error(int error, const char *msg)
return error; return error;
} }
int git_index_set_caps(git_index *index, int caps) int git_index_set_caps(git_index *index, unsigned int caps)
{ {
unsigned int old_ignore_case; unsigned int old_ignore_case;

View File

@ -1145,17 +1145,19 @@ static int repo_init_structure(
} }
if (!tdir) { if (!tdir) {
if ((error = git_futils_find_template_dir(&template_buf)) >= 0); if (!(error = git_futils_find_template_dir(&template_buf)))
tdir = template_buf.ptr; tdir = template_buf.ptr;
default_template = true; default_template = true;
} }
error = git_futils_cp_r(tdir, repo_dir, if (tdir)
GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS | error = git_futils_cp_r(tdir, repo_dir,
GIT_CPDIR_SIMPLE_TO_MODE, dmode); GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_CHMOD_DIRS |
GIT_CPDIR_SIMPLE_TO_MODE, dmode);
git_buf_free(&template_buf); git_buf_free(&template_buf);
git_config_free(cfg); git_config_free(cfg);
if (error < 0) { if (error < 0) {
if (!default_template) if (!default_template)
return error; return error;