diff options
author | Guillem Jover <guillem@debian.org> | 2010-05-17 15:04:49 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2010-05-19 08:32:12 +0200 |
commit | 7eb30624a0b7955924bafd9466d226f70e5cf48f (patch) | |
tree | ae34a67fb5fbe6abd391a1919764c6df8e4de33a /dpkg-split | |
parent | 07adb5686f5fec694e6bfea82b8b5ad2fcdf416c (diff) | |
download | dpkg-7eb30624a0b7955924bafd9466d226f70e5cf48f.tar.gz |
Use bool instead of int wherever appropriate
Diffstat (limited to 'dpkg-split')
-rw-r--r-- | dpkg-split/queue.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c index e8c02a6f2..a2ed8371e 100644 --- a/dpkg-split/queue.c +++ b/dpkg-split/queue.c @@ -49,22 +49,32 @@ #include "dpkg-split.h" -static int decompose_filename(const char *filename, struct partqueue *pq) { +static bool +decompose_filename(const char *filename, struct partqueue *pq) +{ const char *p; char *q; if (strspn(filename, "0123456789abcdef") != MD5HASHLEN || filename[MD5HASHLEN] != '.') - return 0; + return false; q = nfmalloc(MD5HASHLEN + 1); memcpy(q, filename, MD5HASHLEN); q[MD5HASHLEN] = '\0'; pq->info.md5sum= q; p = filename + MD5HASHLEN + 1; - pq->info.maxpartlen= strtol(p,&q,16); if (q==p || *q++ != '.') return 0; - p=q; pq->info.thispartn= (int)strtol(p,&q,16); if (q==p || *q++ != '.') return 0; - p=q; pq->info.maxpartn= (int)strtol(p,&q,16); if (q==p || *q) return 0; - return 1; + pq->info.maxpartlen = strtol(p, &q, 16); + if (q == p || *q++ != '.') + return false; + p = q; + pq->info.thispartn = (int)strtol(p, &q, 16); + if (q == p || *q++ != '.') + return false; + p = q; + pq->info.maxpartn = (int)strtol(p, &q, 16); + if (q == p || *q) + return false; + return true; } void scandepot(void) { @@ -96,7 +106,9 @@ void scandepot(void) { closedir(depot); } -static int partmatches(struct partinfo *pi, struct partinfo *refi) { +static bool +partmatches(struct partinfo *pi, struct partinfo *refi) +{ return (pi->md5sum && !strcmp(pi->md5sum,refi->md5sum) && pi->maxpartn == refi->maxpartn && |