diff options
author | Leo Yang <lyang@topologyinc.com> | 2015-04-28 12:40:20 -0400 |
---|---|---|
committer | Leo Yang <lyang@topologyinc.com> | 2015-04-28 12:40:20 -0400 |
commit | 69f0032b4c9fb48df56cf4eca6e535f2618ed864 (patch) | |
tree | 9b3652146fa7a9afa67309ab8b3e6a03d1fd5799 /src/filter.c | |
parent | d969d41547080d5e924d49f44ba5de1ade5b343c (diff) | |
download | libgit2-69f0032b4c9fb48df56cf4eca6e535f2618ed864.tar.gz |
Fix some build warnings
In checkout.c and filter.c we were casting a sub struct
to a parent struct which breaks the strict aliasing rules
in C. However we can use .parent or .base to access the
parent struct to avoid the build warnings.
In remote.c the local variable error was not initialized
or updated in some cases. For unintialized error a build
warning will be generated. So always keep error variable
up-to-date.
Diffstat (limited to 'src/filter.c')
-rw-r--r-- | src/filter.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/filter.c b/src/filter.c index 8bd7f4d07..19c793e89 100644 --- a/src/filter.c +++ b/src/filter.c @@ -671,7 +671,7 @@ int git_filter_list_apply_to_data( buf_stream_init(&writer, tgt); if ((error = git_filter_list_stream_data(filters, src, - (git_writestream *)&writer)) < 0) + &writer.parent)) < 0) return error; assert(writer.complete); @@ -690,7 +690,7 @@ int git_filter_list_apply_to_file( buf_stream_init(&writer, out); if ((error = git_filter_list_stream_file( - filters, repo, path, (git_writestream *)&writer)) < 0) + filters, repo, path, &writer.parent)) < 0) return error; assert(writer.complete); @@ -721,7 +721,7 @@ int git_filter_list_apply_to_blob( buf_stream_init(&writer, out); if ((error = git_filter_list_stream_blob( - filters, blob, (git_writestream *)&writer)) < 0) + filters, blob, &writer.parent)) < 0) return error; assert(writer.complete); |