Skip to content

Commit

Permalink
versions: MSVC build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vmg committed Dec 5, 2012
1 parent 43efaab commit bf192cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ int giterr_set_regex(const regex_t *regex, int error_code);
/**
* Check a versioned structure for validity
*/
GIT_INLINE(bool) giterr__check_version(const void *structure, unsigned int expected_max, const char *name)
GIT_INLINE(int) giterr__check_version(const void *structure, unsigned int expected_max, const char *name)
{
unsigned int actual;

if (!structure)
return true;
return 0;

actual = *(const unsigned int*)structure;
if (actual > 0 && actual <= expected_max)
return true;
return 0;

giterr_set(GITERR_INVALID, "Invalid version %d on %s", actual, name);
return false;
return -1;
}
#define GITERR_CHECK_VERSION(S,V,N) if (!giterr__check_version(S,V,N)) return -1
#define GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) return -1

/**
* Initialize a structure with a version.
Expand Down
3 changes: 2 additions & 1 deletion tests-clar/config/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ void test_config_backend__checks_version(void)
{
git_config *cfg;
git_config_backend backend = GIT_CONFIG_BACKEND_INIT;
backend.version = 1024;
const git_error *err;

backend.version = 1024;

cl_git_pass(git_config_new(&cfg));
cl_git_fail(git_config_add_backend(cfg, &backend, 0, false));
err = giterr_last();
Expand Down

0 comments on commit bf192cd

Please sign in to comment.