#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "hash.h"
int hash_algo_by_name(const char *name)
{
- int i;
if (!name)
return GIT_HASH_UNKNOWN;
- for (i = 1; i < GIT_HASH_NALGOS; i++)
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++)
if (!strcmp(name, hash_algos[i].name))
return i;
return GIT_HASH_UNKNOWN;
int hash_algo_by_id(uint32_t format_id)
{
- int i;
- for (i = 1; i < GIT_HASH_NALGOS; i++)
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++)
if (format_id == hash_algos[i].format_id)
return i;
return GIT_HASH_UNKNOWN;
}
-int hash_algo_by_length(int len)
+int hash_algo_by_length(size_t len)
{
- int i;
- for (i = 1; i < GIT_HASH_NALGOS; i++)
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++)
if (len == hash_algos[i].rawsz)
return i;
return GIT_HASH_UNKNOWN;
/* Identical, except based on the format ID. */
int hash_algo_by_id(uint32_t format_id);
/* Identical, except based on the length. */
-int hash_algo_by_length(int len);
+int hash_algo_by_length(size_t len);
/* Identical, except for a pointer to struct git_hash_algo. */
static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
{