hash: fix "-Wsign-compare" warnings
There are a couple of trivial "-Wsign-compare" warnings in "hash.c". Fix them. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
172d0f686b
commit
8ca9fa60a6
12
hash.c
12
hash.c
@@ -1,5 +1,4 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
@@ -246,10 +245,9 @@ const char *empty_tree_oid_hex(const struct git_hash_algo *algop)
|
|||||||
|
|
||||||
int hash_algo_by_name(const char *name)
|
int hash_algo_by_name(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return GIT_HASH_UNKNOWN;
|
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))
|
if (!strcmp(name, hash_algos[i].name))
|
||||||
return i;
|
return i;
|
||||||
return GIT_HASH_UNKNOWN;
|
return GIT_HASH_UNKNOWN;
|
||||||
@@ -257,17 +255,15 @@ int hash_algo_by_name(const char *name)
|
|||||||
|
|
||||||
int hash_algo_by_id(uint32_t format_id)
|
int hash_algo_by_id(uint32_t format_id)
|
||||||
{
|
{
|
||||||
int i;
|
for (size_t i = 1; i < GIT_HASH_NALGOS; i++)
|
||||||
for (i = 1; i < GIT_HASH_NALGOS; i++)
|
|
||||||
if (format_id == hash_algos[i].format_id)
|
if (format_id == hash_algos[i].format_id)
|
||||||
return i;
|
return i;
|
||||||
return GIT_HASH_UNKNOWN;
|
return GIT_HASH_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hash_algo_by_length(int len)
|
int hash_algo_by_length(size_t len)
|
||||||
{
|
{
|
||||||
int i;
|
for (size_t i = 1; i < GIT_HASH_NALGOS; i++)
|
||||||
for (i = 1; i < GIT_HASH_NALGOS; i++)
|
|
||||||
if (len == hash_algos[i].rawsz)
|
if (len == hash_algos[i].rawsz)
|
||||||
return i;
|
return i;
|
||||||
return GIT_HASH_UNKNOWN;
|
return GIT_HASH_UNKNOWN;
|
||||||
|
|||||||
2
hash.h
2
hash.h
@@ -325,7 +325,7 @@ int hash_algo_by_name(const char *name);
|
|||||||
/* Identical, except based on the format ID. */
|
/* Identical, except based on the format ID. */
|
||||||
int hash_algo_by_id(uint32_t format_id);
|
int hash_algo_by_id(uint32_t format_id);
|
||||||
/* Identical, except based on the length. */
|
/* 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. */
|
/* Identical, except for a pointer to struct git_hash_algo. */
|
||||||
static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
|
static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user