libxbps: fixed all warnings found by clang.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428213056-p1b7bh0llq8393r0
This commit is contained in:
Juan RP 2010-04-28 23:30:56 +02:00
parent 7976ac3707
commit 28f997bdf7
8 changed files with 15 additions and 33 deletions

View File

@ -211,14 +211,12 @@ xbps_fetch_file(const char *uri, const char *outputdir, bool refetch,
struct url_stat url_st; struct url_stat url_st;
struct fetchIO *fio = NULL; struct fetchIO *fio = NULL;
struct timeval tv[2]; struct timeval tv[2];
ssize_t bytes_read, bytes_written; ssize_t bytes_read = -1, bytes_written;
off_t bytes_dld = -1; off_t bytes_dld = -1;
char buf[4096], *filename, *destfile; char buf[4096], *filename, *destfile = NULL;
int fd = -1, rv = 0; int fd = -1, rv = 0;
bool restart = false; bool restart = false;
filename = destfile = NULL;
bytes_read = bytes_written = -1;
fetchLastErrCode = 0; fetchLastErrCode = 0;
/* /*

View File

@ -472,7 +472,7 @@ prop_dictionary_t
xbps_read_dict_from_archive_entry(struct archive *ar, xbps_read_dict_from_archive_entry(struct archive *ar,
struct archive_entry *entry) struct archive_entry *entry)
{ {
prop_dictionary_t d; prop_dictionary_t d = NULL;
size_t buflen = 0; size_t buflen = 0;
ssize_t nbytes = -1; ssize_t nbytes = -1;
char *buf, *uncomp_buf; char *buf, *uncomp_buf;

View File

@ -83,7 +83,7 @@ remove_pkg_metadata(const char *pkgname)
return -1; return -1;
} }
if ((rv = unlink(path)) == -1) { if (unlink(path) == -1) {
if (flags & XBPS_FLAG_VERBOSE) if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: can't remove %s (%s)\n", printf("WARNING: can't remove %s (%s)\n",
pkgname, strerror(errno)); pkgname, strerror(errno));

View File

@ -34,18 +34,14 @@
int HIDDEN int HIDDEN
xbps_remove_obsoletes(prop_dictionary_t oldd, prop_dictionary_t newd) xbps_remove_obsoletes(prop_dictionary_t oldd, prop_dictionary_t newd)
{ {
prop_object_iterator_t iter, iter2; prop_object_iterator_t iter, iter2 = NULL;
prop_object_t obj, obj2; prop_object_t obj, obj2 = NULL;
prop_string_t oldstr, newstr; prop_string_t oldstr = NULL, newstr = NULL;
const char *array_str = "files"; const char *array_str = "files";
char *buf = NULL; char *buf = NULL;
int rv = 0; int rv = 0;
bool found, dolinks = false; bool found, dolinks = false;
iter = iter2 = NULL;
obj = obj2 = NULL;
oldstr = newstr = NULL;
again: again:
iter = xbps_get_array_iter_from_dict(oldd, array_str); iter = xbps_get_array_iter_from_dict(oldd, array_str);
if (iter == NULL) if (iter == NULL)
@ -110,7 +106,7 @@ again:
array_str = "links"; array_str = "links";
prop_object_iterator_release(iter2); prop_object_iterator_release(iter2);
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
iter = iter2 = NULL; iter2 = NULL;
goto again; goto again;
} }

View File

@ -314,7 +314,7 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
if (pkgrd == NULL) { if (pkgrd == NULL) {
if (errno && errno != ENOENT) { if (errno && errno != ENOENT) {
rv = errno; rv = errno;
break; goto out;
} }
DPRINTF(("Package %s not found in repo %s.\n", DPRINTF(("Package %s not found in repo %s.\n",
pkgname, rpool->rp_uri)); pkgname, rpool->rp_uri));
@ -326,12 +326,12 @@ xbps_repository_update_pkg(const char *pkgname, prop_dictionary_t instpkg)
if (!prop_dictionary_get_cstring_nocopy(instpkg, if (!prop_dictionary_get_cstring_nocopy(instpkg,
"version", &instver)) { "version", &instver)) {
rv = errno; rv = errno;
break; goto out;
} }
if (!prop_dictionary_get_cstring_nocopy(pkgrd, if (!prop_dictionary_get_cstring_nocopy(pkgrd,
"version", &repover)) { "version", &repover)) {
rv = errno; rv = errno;
break; goto out;
} }
if (xbps_cmpver(repover, instver) > 0) { if (xbps_cmpver(repover, instver) > 0) {
DPRINTF(("Found %s-%s in repo %s.\n", DPRINTF(("Found %s-%s in repo %s.\n",

View File

@ -92,8 +92,7 @@ xbps_repository_sync_pkg_index(const char *uri)
int rv = 0; int rv = 0;
bool only_sync = false; bool only_sync = false;
rpidx = lrepodir = uri_fixedp = NULL; tmp_metafile = rpidx = lrepodir = lrepofile = NULL;
metadir = tmp_metafile = lrepofile = NULL;
if (uname(&un) == -1) if (uname(&un) == -1)
return -1; return -1;

View File

@ -295,9 +295,6 @@ SHA256_Transform(SHA256_CTX *context, const uint32_t *data)
context->state[5] += f; context->state[5] += f;
context->state[6] += g; context->state[6] += g;
context->state[7] += h; context->state[7] += h;
/* Clean up */
a = b = c = d = e = f = g = h = T1 = T2 = 0;
} }
#endif /* SHA2_UNROLL_TRANSFORM */ #endif /* SHA2_UNROLL_TRANSFORM */
@ -331,8 +328,6 @@ XBPS_SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
/* The buffer is not yet full */ /* The buffer is not yet full */
memcpy(&context->buffer[usedspace], data, len); memcpy(&context->buffer[usedspace], data, len);
context->bitcount += len << 3; context->bitcount += len << 3;
/* Clean up: */
usedspace = freespace = 0;
return 1; return 1;
} }
} }
@ -366,9 +361,6 @@ XBPS_SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len)
memcpy(context->buffer, data, len); memcpy(context->buffer, data, len);
context->bitcount += len << 3; context->bitcount += len << 3;
} }
/* Clean up: */
usedspace = freespace = 0;
return 1; return 1;
} }
@ -428,7 +420,6 @@ SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len)
/* Clean up state data: */ /* Clean up state data: */
memset(context, 0, sizeof(*context)); memset(context, 0, sizeof(*context));
usedspace = 0;
return 1; return 1;
} }

View File

@ -97,14 +97,14 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
size_t entry_idx = 0; size_t entry_idx = 0;
const char *pkgname, *version, *rootdir, *entry_str, *transact; const char *pkgname, *version, *rootdir, *entry_str, *transact;
char *buf; char *buf;
int rv = 0, flags, lflags; int rv, flags, lflags;
bool preserve, actgt, skip_entry, update; bool preserve, skip_entry, update;
bool props_plist_found, files_plist_found; bool props_plist_found, files_plist_found;
assert(ar != NULL); assert(ar != NULL);
assert(pkg != NULL); assert(pkg != NULL);
preserve = actgt = skip_entry = update = false; preserve = skip_entry = update = false;
props_plist_found = files_plist_found = false; props_plist_found = files_plist_found = false;
rootdir = xbps_get_rootdir(); rootdir = xbps_get_rootdir();
flags = xbps_get_flags(); flags = xbps_get_flags();
@ -173,7 +173,6 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
if (buf == NULL) if (buf == NULL)
return errno; return errno;
actgt = true;
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
archive_entry_set_mode(entry, 0750); archive_entry_set_mode(entry, 0750);
@ -298,7 +297,6 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
"path: %s\n", "path: %s\n",
archive_entry_pathname(entry)); archive_entry_pathname(entry));
} }
rv = 0;
continue; continue;
} }
} }