Commit 369b0217 by Edward Thomson

Clean up various compiler warnings

parent 70f7e2c6
...@@ -397,7 +397,7 @@ static int show_suffix( ...@@ -397,7 +397,7 @@ static int show_suffix(
const git_oid* id, const git_oid* id,
size_t abbrev_size) size_t abbrev_size)
{ {
int error, size; int error, size = 0;
char hex_oid[GIT_OID_HEXSZ]; char hex_oid[GIT_OID_HEXSZ];
...@@ -818,7 +818,8 @@ int git_describe_format(git_buf *out, const git_describe_result *result, const g ...@@ -818,7 +818,8 @@ int git_describe_format(git_buf *out, const git_describe_result *result, const g
/* If we didn't find *any* tags, we fall back to the commit's id */ /* If we didn't find *any* tags, we fall back to the commit's id */
if (result->fallback_to_id) { if (result->fallback_to_id) {
char hex_oid[GIT_OID_HEXSZ + 1] = {0}; char hex_oid[GIT_OID_HEXSZ + 1] = {0};
int size; int size = 0;
if ((error = find_unique_abbrev_size( if ((error = find_unique_abbrev_size(
&size, repo, &result->commit_id, opts.abbreviated_size)) < 0) &size, repo, &result->commit_id, opts.abbreviated_size)) < 0)
return -1; return -1;
......
...@@ -183,8 +183,10 @@ GIT_INLINE(int64_t) git_atomic64_add(git_atomic64 *a, int64_t addend) ...@@ -183,8 +183,10 @@ GIT_INLINE(int64_t) git_atomic64_add(git_atomic64 *a, int64_t addend)
/* Pthreads Mutex */ /* Pthreads Mutex */
#define git_mutex unsigned int #define git_mutex unsigned int
static int git_mutex_init(git_mutex* mutex) { GIT_UNUSED(mutex); return 0; } GIT_INLINE(int) git_mutex_init(git_mutex *mutex) \
static int git_mutex_lock(git_mutex* mutex) { GIT_UNUSED(mutex); return 0; } { GIT_UNUSED(mutex); return 0; }
GIT_INLINE(int) git_mutex_lock(git_mutex *mutex) \
{ GIT_UNUSED(mutex); return 0; }
#define git_mutex_unlock(a) (void)0 #define git_mutex_unlock(a) (void)0
#define git_mutex_free(a) (void)0 #define git_mutex_free(a) (void)0
......
...@@ -274,7 +274,7 @@ static int update_target(git_refdb *db, transaction_node *node) ...@@ -274,7 +274,7 @@ static int update_target(git_refdb *db, transaction_node *node)
} else if (node->ref_type == GIT_REF_SYMBOLIC) { } else if (node->ref_type == GIT_REF_SYMBOLIC) {
ref = git_reference__alloc_symbolic(node->name, node->target.symbolic); ref = git_reference__alloc_symbolic(node->name, node->target.symbolic);
} else { } else {
assert(0); abort();
} }
GITERR_CHECK_ALLOC(ref); GITERR_CHECK_ALLOC(ref);
...@@ -287,7 +287,7 @@ static int update_target(git_refdb *db, transaction_node *node) ...@@ -287,7 +287,7 @@ static int update_target(git_refdb *db, transaction_node *node)
} else if (node->ref_type == GIT_REF_SYMBOLIC) { } else if (node->ref_type == GIT_REF_SYMBOLIC) {
error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message); error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
} else { } else {
assert(0); abort();
} }
git_reference_free(ref); git_reference_free(ref);
...@@ -300,7 +300,7 @@ int git_transaction_commit(git_transaction *tx) ...@@ -300,7 +300,7 @@ int git_transaction_commit(git_transaction *tx)
{ {
transaction_node *node; transaction_node *node;
git_strmap_iter pos; git_strmap_iter pos;
int error; int error = 0;
assert(tx); assert(tx);
......
...@@ -552,7 +552,7 @@ static int http_connect(http_subtransport *t) ...@@ -552,7 +552,7 @@ static int http_connect(http_subtransport *t)
#ifdef GIT_SSL #ifdef GIT_SSL
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL) { if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL) {
X509 *cert = SSL_get_peer_certificate(t->socket.ssl.ssl); X509 *cert = SSL_get_peer_certificate(t->socket.ssl.ssl);
git_cert_x509 cert_info; git_cert_x509 cert_info, *cert_info_ptr;
int len, is_valid; int len, is_valid;
unsigned char *guard, *encoded_cert; unsigned char *guard, *encoded_cert;
...@@ -581,7 +581,10 @@ static int http_connect(http_subtransport *t) ...@@ -581,7 +581,10 @@ static int http_connect(http_subtransport *t)
cert_info.cert_type = GIT_CERT_X509; cert_info.cert_type = GIT_CERT_X509;
cert_info.data = encoded_cert; cert_info.data = encoded_cert;
cert_info.len = len; cert_info.len = len;
error = t->owner->certificate_check_cb((git_cert *) &cert_info, is_valid, t->connection_data.host, t->owner->message_cb_payload);
cert_info_ptr = &cert_info;
error = t->owner->certificate_check_cb((git_cert *) cert_info_ptr, is_valid, t->connection_data.host, t->owner->message_cb_payload);
git__free(encoded_cert); git__free(encoded_cert);
if (error < 0) { if (error < 0) {
......
...@@ -480,7 +480,7 @@ static int _git_ssh_setup_conn( ...@@ -480,7 +480,7 @@ static int _git_ssh_setup_conn(
goto on_error; goto on_error;
if (t->owner->certificate_check_cb != NULL) { if (t->owner->certificate_check_cb != NULL) {
git_cert_hostkey cert = { 0 }; git_cert_hostkey cert = { 0 }, *cert_ptr;
const char *key; const char *key;
cert.cert_type = GIT_CERT_HOSTKEY_LIBSSH2; cert.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
...@@ -504,7 +504,10 @@ static int _git_ssh_setup_conn( ...@@ -504,7 +504,10 @@ static int _git_ssh_setup_conn(
/* We don't currently trust any hostkeys */ /* We don't currently trust any hostkeys */
giterr_clear(); giterr_clear();
error = t->owner->certificate_check_cb((git_cert *) &cert, 0, host, t->owner->message_cb_payload);
cert_ptr = &cert;
error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, host, t->owner->message_cb_payload);
if (error < 0) { if (error < 0) {
if (!giterr_last()) if (!giterr_last())
giterr_set(GITERR_NET, "user cancelled hostkey check"); giterr_set(GITERR_NET, "user cancelled hostkey check");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment