Skip to content

Commit

Permalink
Temporary fix to pass R CMD check on Windows
Browse files Browse the repository at this point in the history
See issue #227

Signed-off-by: Stefan Widgren <stefan.widgren@gmail.com>
  • Loading branch information
stewid committed May 10, 2016
1 parent 60d8df9 commit 129740c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libgit2/src/config.c
Expand Up @@ -599,7 +599,14 @@ int git_config_delete_entry(git_config *cfg, const char *name)
int git_config_set_int64(git_config *cfg, const char *name, int64_t value)
{
char str_value[32]; /* All numbers should fit in here */
#ifdef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
p_snprintf(str_value, sizeof(str_value), "%" PRId64, value);
#pragma GCC diagnostic pop
#else
p_snprintf(str_value, sizeof(str_value), "%" PRId64, value);
#endif
return git_config_set_string(cfg, name, str_value);
}

Expand Down
7 changes: 7 additions & 0 deletions src/libgit2/src/odb.c
Expand Up @@ -53,7 +53,14 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_
int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type)
{
const char *type_str = git_object_type2string(obj_type);
#ifdef _WIN32
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
int len = p_snprintf(hdr, n, "%s %lld", type_str, (long long)obj_len);
#pragma GCC diagnostic pop
#else
int len = p_snprintf(hdr, n, "%s %lld", type_str, (long long)obj_len);
#endif
assert(len > 0 && len <= (int)n);
return len+1;
}
Expand Down

0 comments on commit 129740c

Please sign in to comment.