Skip to content

Instantly share code, notes, and snippets.

@takekazuomi
Created July 23, 2011 15:13
Show Gist options
  • Save takekazuomi/1101532 to your computer and use it in GitHub Desktop.
Save takekazuomi/1101532 to your computer and use it in GitHub Desktop.
C4307
int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
{
struct pack_backend *backend;
char path[GIT_PATH_MAX];
backend = git__calloc(1, sizeof(struct pack_backend));
if (backend == NULL)
return GIT_ENOMEM;
if (git_vector_init(&backend->packs, 8, packfile_sort__cb) < GIT_SUCCESS) {
free(backend);
return GIT_ENOMEM;
}
backend->window_size = DEFAULT_WINDOW_SIZE;
backend->mapped_limit = DEFAULT_MAPPED_LIMIT; // C4307: 'operator' : integral constant overflow
git_path_join(path, objects_dir, "pack");
if (git_futils_isdir(path) == GIT_SUCCESS) {
backend->pack_folder = git__strdup(path);
backend->pack_folder_mtime = 0;
if (backend->pack_folder == NULL) {
free(backend);
return GIT_ENOMEM;
}
}
backend->parent.read = &pack_backend__read;
backend->parent.read_prefix = &pack_backend__read_prefix;
backend->parent.read_header = NULL;
backend->parent.exists = &pack_backend__exists;
backend->parent.free = &pack_backend__free;
*backend_out = (git_odb_backend *)backend;
return GIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment