signed/unsigned comparisons.
+Mon Apr 23 03:21:10 CDT 2001 Adam Heath <doogie@debian.org>
+
+ * dpkg-deb/{build,extract,main}.c, split/{info,join,main,queue}.c,
+ split/dpkg-split.h, lib/{dump,ehandle,fields,mlib,parse{,help},varbuf,
+ vercmp}.c, lib/parsedump.h, main/{archives,configure,enquiry,filesdb,
+ help,main,packages,processarc,remove}.c, main/{filesdb,main}.h,
+ utils/{md5sum, start-stop-daemon}.c, dselect/pkg{list.cc,list.hh,
+ top.cc}, include/dpkg{-db.h,.h.in}: Fixed up several warning types.
+ const, casting, incorrect sizes, signed/unsigned comparisons.
+
Mon Apr 23 02:17:26 CDT 2001 Adam Heath <doogie@debian.org>
* dpkg-deb/info.c, main/processarc.c: Add comments telling why we
*/
static struct _finfo* getfi(const char* root, int fd) {
static char* fn = NULL;
- static int fnlen = 0;
- int i = 0;
+ static size_t fnlen = 0;
+ size_t i= 0;
struct _finfo *fi;
size_t rl = strlen(root);
char *m;
const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
- char *controlfile, *tfbuf, *envbuf;
+ char *controlfile, *tfbuf;
+ const char *envbuf;
struct pkginfo *checkedinfo;
struct arbitraryfield *field;
FILE *ar, *gz, *cf;
directory= *argv++; if (!directory) badusage(_("--build needs a directory argument"));
/* template for our tempfiles */
if ((envbuf= getenv("TMPDIR")) == NULL)
- envbuf= (char *)P_tmpdir;
+ envbuf= P_tmpdir;
tfbuf = (char *)malloc(strlen(envbuf)+13);
strcpy(tfbuf,envbuf);
strcat(tfbuf,"/dpkg.XXXXXX");
char versionbuf[40];
float versionnum;
char ctrllenbuf[40], *infobuf;
- long ctrllennum, memberlen= 0;
+ size_t ctrllennum, memberlen= 0;
int dummy, l= 0;
pid_t c1=0,c2,c3;
unsigned char *ctrlarea= 0;
if (cipaction)
badusage(_("conflicting actions --%s and --%s"),cip->olong,cipaction->olong);
cipaction= cip;
- assert(cip-cmdinfos < sizeof(dofunctions)*sizeof(dofunction*));
+ assert((int)(cip-cmdinfos) < (int)(sizeof(dofunctions)*sizeof(dofunction*)));
action= dofunctions[cip-cmdinfos];
}
#include "dselect.h"
#include "bindings.h"
-int packagelist::compareentries(struct perpackagestate *a,
- struct perpackagestate *b) {
+int packagelist::compareentries(const struct perpackagestate *a,
+ const struct perpackagestate *b) {
switch (statsortorder) {
case sso_avail:
if (a->ssavail != b->ssavail) return a->ssavail - b->ssavail;
struct pkginfo *newhead= new pkginfo;
newhead->name= 0;
newhead->priority= priority;
- newhead->otherpriority= (char*)otherpriority;
- newhead->section= (char*)section;
+ newhead->otherpriority= otherpriority;
+ newhead->section= section;
struct perpackagestate *newstate= new perpackagestate;
newstate->pkg= newhead;
static packagelist *sortpackagelist;
int qsort_compareentries(const void *a, const void *b) {
- return sortpackagelist->compareentries(*(perpackagestate**)a,
- *(perpackagestate**)b);
+ return sortpackagelist->compareentries((const struct perpackagestate*)&a,
+ (const struct perpackagestate*)&b);
}
void packagelist::sortinplace() {
// Miscellaneous internal routines
void redraw1package(int index, int selected);
- int compareentries(struct perpackagestate *a, struct perpackagestate *b);
+ int compareentries(const struct perpackagestate *a, const struct perpackagestate *b);
friend int qsort_compareentries(const void *a, const void *b);
pkginfo::pkgwant reallywant(pkginfo::pkgwant, struct perpackagestate*);
int describemany(char buf[], const char *prioritystring, const char *section,
wmove(listpad,index,priority_column-1); waddch(listpad,' ');
if (pkg->priority == pkginfo::pri_other) {
int i;
- char *p;
+ const char *p;
for (i=priority_width, p=pkg->otherpriority;
i > 0 && *p;
i--, p++)
struct conffile {
struct conffile *next;
- char *name;
- char *hash;
+ const char *name;
+ const char *hash;
};
struct filedetails {
struct pkginfo { /* pig */
struct pkginfo *next;
- char *name;
+ const char *name;
enum pkgwant {
want_unknown, want_install, want_hold, want_deinstall, want_purge,
want_sentinel /* Not allowed except as special sentinel value
pri_optional, pri_extra, pri_contrib,
pri_other, pri_unknown, pri_unset=-1
} priority;
- char *otherpriority;
- char *section;
+ const char *otherpriority;
+ const char *section;
struct versionrevision configversion;
struct filedetails *files;
struct pkginfoperfile installed;
* Callers using C++ need not worry about any of this.
*/
struct varbuf {
- int used, size;
+ size_t used, size;
char *buf;
#ifdef __cplusplus
void free() { varbuffree(this); }
varbuf() { varbufinit(this); }
~varbuf() { varbuffree(this); }
- inline void operator()(int c); // definition below
+ void operator()(int c) { varbufaddc(this,c); }
void operator()(const char *s) { varbufaddstr(this,s); }
- inline void terminate(void/*to shut 2.6.3 up*/); // definition below
+ void terminate(void/*to shut 2.6.3 up*/) { varbufaddc(this,0); used--; }
void reset() { used=0; }
const char *string() { terminate(); return buf; }
#endif
};
-inline extern void varbufaddc(struct varbuf *v, int c);
-
-#ifdef __cplusplus
-inline void varbuf::operator()(int c) { varbufaddc(this,c); }
-inline void varbuf::terminate(void/*to shut 2.6.3 up*/) { varbufaddc(this,0); used--; }
-#endif
-
/*** from dump.c ***/
void writerecord(FILE*, const char*,
const struct versionrevision *b);
/*** from nfmalloc.c ***/
-extern inline void *nfmalloc(size_t);
+extern void *nfmalloc(size_t);
char *nfstrsave(const char*);
char *nfstrnsave(const char*, int);
void nffreeall(void);
void error_unwind(int flagset);
void push_cleanup(void (*f1)(int argc, void **argv), int flagmask1,
void (*f2)(int argc, void **argv), int flagmask2,
- int nargs, ...);
+ unsigned int nargs, ...);
void push_checkpoint(int mask, int value);
void pop_cleanup(int flagset);
enum { ehflag_normaltidy=01, ehflag_bombout=02, ehflag_recursiveerror=04 };
buffer_copy_setup_PtrInt(file, BUFFER_READ_STREAM, NULL, \
fd, BUFFER_WRITE_FD, NULL, \
limit, desc)
-inline ssize_t buffer_copy_setup_PtrInt(void *p, int typeIn, void *procIn,
+ssize_t buffer_copy_setup_PtrInt(void *p, int typeIn, void *procIn,
int i, int typeOut, void *procOut,
ssize_t limit, const char *desc, ...);
-inline ssize_t buffer_copy_setup_PtrPtr(void *p1, int typeIn, void *procIn,
+ssize_t buffer_copy_setup_PtrPtr(void *p1, int typeIn, void *procIn,
void *p2, int typeOut, void *procOut,
ssize_t limit, const char *desc, ...);
-inline ssize_t buffer_copy_setup_IntPtr(int i, int typeIn, void *procIn,
+ssize_t buffer_copy_setup_IntPtr(int i, int typeIn, void *procIn,
void *p, int typeOut, void *procOut,
ssize_t limit, const char *desc, ...);
-inline ssize_t buffer_copy_setup_IntInt(int i1, int typeIn, void *procIn,
+ssize_t buffer_copy_setup_IntInt(int i1, int typeIn, void *procIn,
int i2, int typeOut, void *procOut,
ssize_t limit, const char *desc, ...);
ssize_t buffer_copy_setup(buffer_arg argIn, int typeIn, void *procIn,
void w_charfield(struct varbuf *vb,
const struct pkginfo *pigp, const struct pkginfoperfile *pifp,
const struct fieldinfo *fip) {
- const char *value= pifp->valid ? PKGPFIELD(pifp,fip->integer,char*) : 0;
+ const char *value= pifp->valid ? PKGPFIELD(pifp,fip->integer,const char*) : 0;
if (!value || !*value) return;
varbufaddstr(vb,fip->name); varbufaddstr(vb, ": "); varbufaddstr(vb,value);
varbufaddc(vb,'\n');
if (pifp != &pigp->available) return;
fdp= pigp->files;
- if (!fdp || !FILEFFIELD(fdp,fip->integer,char*)) return;
+ if (!fdp || !FILEFFIELD(fdp,fip->integer,const char*)) return;
varbufaddstr(vb,fip->name); varbufaddc(vb,':');
while (fdp) {
varbufaddc(vb,' ');
- varbufaddstr(vb,FILEFFIELD(fdp,fip->integer,char*));
+ varbufaddstr(vb,FILEFFIELD(fdp,fip->integer,const char*));
fdp= fdp->next;
}
varbufaddc(vb,'\n');
void w_booleandefno(struct varbuf *vb,
const struct pkginfo *pigp, const struct pkginfoperfile *pifp,
const struct fieldinfo *fip) {
- int value= pifp->valid ? PKGPFIELD(pifp,fip->integer,int) : 0;
+ int value= pifp->valid ? PKGPFIELD(pifp,fip->integer,int) : -1;
if (!value) return;
assert(value==1);
varbufaddstr(vb,"Essential: yes\n");
void push_cleanup(void (*call1)(int argc, void **argv), int mask1,
void (*call2)(int argc, void **argv), int mask2,
- int nargs, ...) {
+ unsigned int nargs, ...) {
struct cleanupentry *cep;
void **args;
int e;
static int convert_string
(const char *filename, int lno, const char *what, int otherwise,
FILE *warnto, int *warncount, const struct pkginfo *pigp,
- const char *startp, const struct namevalue *nvip,
+ const char *startp, const struct namevalue *ivip,
const char **endpp)
{
const char *ep;
int c, l = 0;
+ struct namevalue *nvip= 0;
+ memcpy(&nvip,&ivip,sizeof(struct namevalue *));
ep= startp;
if (!*ep) parseerr(0,filename,lno, warnto,warncount,pigp,0, _("%s is missing"),what);
while (nvip->name) {
if ((l= nvip->length) == 0) {
l= strlen(nvip->name);
- ((struct namevalue *)nvip)->length= l;
+ nvip->length= (const int)l;
}
if (strncasecmp(nvip->name,startp,l) || nvip->name[l])
nvip++;
fdp->name= fdp->msdosname= fdp->size= fdp->md5sum= 0;
*fdpp= fdp;
}
- FILEFFIELD(fdp,fip->integer,char*)= cpos;
+ FILEFFIELD(fdp,fip->integer,const char*)= cpos;
fdpp= &fdp->next;
while (*space && isspace(*space)) space++;
cpos= space;
struct conffile **lastp, *newlink;
const char *endent, *endfn;
int c, namelen, hashlen;
+ char *newptr;
lastp= &pifp->conffiles;
while (*value) {
namelen= (int)(endfn-value);
if (namelen <= 0) parseerr(0,filename,lno, warnto,warncount,pigp,0,
_("root or null directory is listed as a conffile"));
- newlink->name= nfmalloc(namelen+2);
- newlink->name[0]= '/';
- memcpy(newlink->name+1,value,namelen);
- newlink->name[namelen+1]= 0;
- hashlen= (int)(endent-endfn)-1; newlink->hash= nfmalloc(hashlen+1);
- memcpy(newlink->hash,endfn+1,hashlen); newlink->hash[hashlen]= 0;
+ newptr = nfmalloc(namelen+2);
+ newptr[0]= '/';
+ memcpy(newptr+1,value,namelen);
+ newptr[namelen+1]= 0;
+ newlink->name= newptr;
+ hashlen= (int)(endent-endfn)-1; newptr= nfmalloc(hashlen+1);
+ memcpy(newptr,endfn+1,hashlen); newptr[hashlen]= 0;
+ newlink->hash= newptr;
newlink->next =0;
*lastp= newlink;
lastp= &newlink->next;
}
#define buffer_copy_setup_dual(name, type1, name1, type2, name2) \
-inline ssize_t buffer_copy_setup_##name(type1 n1, int typeIn, void *procIn,\
+ssize_t buffer_copy_setup_##name(type1 n1, int typeIn, void *procIn,\
type2 n2, int typeOut, void *procOut,\
ssize_t limit, const char *desc, ...)\
{\
&newpig.name, "package name");
if ((flags & pdb_recordavailable) || newpig.status != stat_notinstalled) {
parsemustfield(0,filename,lno, warnto,warncount,&newpig,1,
- &newpifp->description, "description");
+ (const char **)&newpifp->description, "description");
parsemustfield(0,filename,lno, warnto,warncount,&newpig,1,
- &newpifp->maintainer, "maintainer");
+ (const char **)&newpifp->maintainer, "maintainer");
if (newpig.status != stat_halfinstalled)
parsemustfield(0,filename,lno, warnto,warncount,&newpig,0,
- (char **)&newpifp->version.version, "version");
+ &newpifp->version.version, "version");
}
if (flags & pdb_recordavailable)
parsemustfield(0,filename,lno, warnto,warncount,&newpig,1,
- &newpifp->architecture, "architecture");
+ (const char **)&newpifp->architecture, "architecture");
else if (newpifp->architecture && *newpifp->architecture)
newpifp->architecture= 0;
const char *name;
freadfunction *rcall;
fwritefunction *wcall;
- int integer;
+ unsigned int integer;
};
void parseerr(FILE *file, const char *filename, int lno, FILE *warnto, int *warncount,
void parsemustfield(FILE *file, const char *filename, int lno,
FILE *warnto, int *warncount,
const struct pkginfo *pigp, int warnonly,
- char **value, const char *what);
+ const char **value, const char *what);
#define MSDOS_EOF_CHAR '\032' /* ^Z */
(FILE *file, const char *filename, int lno,
FILE *warnto, int *warncount,
const struct pkginfo *pigp, int warnonly,
- char **value, const char *what)
+ const char **value, const char *what)
{
if (!*value) {
parseerr(file,filename,lno, warnto,warncount,pigp,warnonly, _("missing %s"),what);
}
int varbufprintf(struct varbuf *v, const char *fmt, ...) {
- int ou, r;
+ unsigned int ou, r;
va_list al;
ou= v->used;
}
int varbufvprintf(struct varbuf *v, const char *fmt, va_list va) {
- int ou, r;
+ unsigned int ou, r;
va_list al;
ou= v->used;
return a->epoch != b->epoch;
}
-static int verrevcmp(const char *val, const char *ref) {
+static int verrevcmp(const char *ival, const char *iref) {
+ static char empty[] = "";
int vc, rc;
long vl, rl;
- const char *vp, *rp;
+ char *vp, *rp;
+ char *val, *ref;
+ memcpy(&val,&ival,sizeof(char*));
+ memcpy(&ref,&iref,sizeof(char*));
- if (!val) val= "";
- if (!ref) ref= "";
+ if (!val) val= empty;
+ if (!ref) ref= empty;
for (;;) {
vp= val; while (*vp && !isdigit(*vp)) vp++;
rp= ref; while (*rp && !isdigit(*rp)) rp++;
}
val= vp;
ref= rp;
- vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
- rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
+ vl=0; if (isdigit(*vp)) vl= strtol(val,&val,10);
+ rl=0; if (isdigit(*rp)) rl= strtol(ref,&ref,10);
if (vl != rl) return vl - rl;
if (!*val && !*ref) return 0;
if (!*val) return -1;
const char *usename;
struct tarcontext *tc= (struct tarcontext*)ti->UserData;
- int statr, fd, r, i, existingdirectory;
+ int statr, fd, i, existingdirectory;
+ size_t r;
struct stat stab, stabd;
char databuf[TARBLKSZ];
struct fileinlist *nifd;
/* if this gets triggered, it means a package has > 10 conflicts/replaces
* pairs, which is the package's fault
*/
- assert(cflict_index < sizeof(conflictor));
+ assert(cflict_index < (int)sizeof(conflictor));
/* This conflict is OK - we'll remove the conflictor. */
conflictor[cflict_index++]= fixbyrm;
varbuffree(&conflictwhy); varbuffree(&removalwhy);
m_pipe(pi);
if (!(fc= m_fork())) {
const char *const *ap;
+ char **narglist;
int i;
m_dup2(pi[1],1); close(pi[0]); close(pi[1]);
for (i=0, ap=argv; *ap; ap++, i++);
- arglist= m_malloc(sizeof(char*)*(i+15));
- arglist[0]= FIND;
+ narglist= m_malloc(sizeof(char*)*(i+15));
+ narglist[0]= strdup(FIND);
for (i=1, ap=argv; *ap; ap++, i++) {
if (strchr(FIND_EXPRSTARTCHARS,(*ap)[0])) {
char *a;
a= m_malloc(strlen(*ap)+10);
strcpy(a,"./");
strcat(a,*ap);
- arglist[i]= a;
+ narglist[i]= a;
} else {
- arglist[i]= *ap;
+ narglist[i]= strdup(*ap);
}
}
- arglist[i++]= "-follow"; /* When editing these, make sure that */
- arglist[i++]= "-name"; /* arglist is mallocd big enough, above. */
- arglist[i++]= ARCHIVE_FILENAME_PATTERN;
- arglist[i++]= "-type";
- arglist[i++]= "f";
- arglist[i++]= "-print0";
- arglist[i++]= 0;
- execvp(FIND, (char* const*)arglist);
+ narglist[i++]= strdup("-follow"); /* When editing these, make sure that */
+ narglist[i++]= strdup("-name"); /* arglist is mallocd big enough, above. */
+ narglist[i++]= strdup(ARCHIVE_FILENAME_PATTERN);
+ narglist[i++]= strdup("-type");
+ narglist[i++]= strdup("f");
+ narglist[i++]= strdup("-print0");
+ narglist[i++]= 0;
+ execvp(FIND, narglist);
ohshite(_("failed to exec find for --recursive"));
}
close(pi[1]);
if (result->buf[r] == '/') r++;
result->used= r;
debug(dbg_conffdetail,"conffderef readlink relative to `%.*s'",
- result->used, result->buf);
+ (int)result->used, result->buf);
}
varbufaddstr(result,linkreadbuf);
varbufaddc(result,0);
#include "main.h"
int pkglistqsortcmp(const void *a, const void *b) {
- struct pkginfo *pa= *(struct pkginfo**)a;
- struct pkginfo *pb= *(struct pkginfo**)b;
+ const struct pkginfo *pa= *(const struct pkginfo**)a;
+ const struct pkginfo *pb= *(const struct pkginfo**)b;
return strcmp(pa->name,pb->name);
}
static int bsyn_status(struct pkginfo *pkg, const struct badstatinfo *bsi) {
if (pkg->eflag &= eflagf_reinstreq) return 0;
- return pkg->status == bsi->val;
+ return (int)pkg->status == bsi->val;
}
static const struct badstatinfo badstatinfos[]= {
newnode= nfmalloc(sizeof(struct filenamenode));
newnode->packages= 0;
if((flags & fnn_nocopy) && name > orig_name && name[-1] == '/')
- newnode->name = (char *)name - 1;
+ newnode->name = name - 1;
else {
- newnode->name= nfmalloc(strlen(name)+2);
- newnode->name[0]= '/'; strcpy(newnode->name+1,name);
+ char *newname= nfmalloc(strlen(name)+2);
+ newname[0]= '/'; strcpy(newname+1,name);
+ newnode->name= newname;
}
newnode->flags= 0;
newnode->next= 0;
struct filenamenode {
struct filenamenode *next;
- char *name;
+ const char *name;
struct filepackages *packages;
struct diversion *divert;
struct filestatoverride *statoverride;
* none of the stuff here will work if admindir isn't inside instdir
* as expected. - fixme
*/
- int instdirl;
+ size_t instdirl;
if (*instdir) {
if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
int i;
i=0;
- bufs[i++]= (char*)scriptname; /* yes, cast away const because exec wants it that way */
+ if(bufs[0]) free(bufs[0]);
+ bufs[i++]= strdup(scriptname); /* yes, cast away const because exec wants it that way */
for (;;) {
assert(i < PKGSCRIPTMAXARGS);
nextarg= va_arg(ap,char*);
return arglist;
}
-#define NSCRIPTCATCHSIGNALS sizeof(script_catchsignallist)/sizeof(int)-1
+#define NSCRIPTCATCHSIGNALS (int)(sizeof(script_catchsignallist)/sizeof(int)-1)
static int script_catchsignallist[]= { SIGQUIT, SIGINT, 0 };
static struct sigaction script_uncatchsignal[NSCRIPTCATCHSIGNALS];
if (!chmod(path,0755)) return;
ohshite(_("unable to set execute permissions on `%.250s'"),path);
}
-static int do_script(const char *pkg, const char *scriptname, const char *scriptpath, struct stat *stab, char *const *arglist, const char *desc, const char *name, int warn) {
- const char *scriptexec;
+static int do_script(const char *pkg, const char *scriptname, const char *scriptpath, struct stat *stab, char *const arglist[], const char *desc, const char *name, int warn) {
int c1, r;
setexecute(scriptpath,stab);
narglist=nfmalloc(r*sizeof(char*));
for (r=1; arglist[r]; r++)
narglist[r]= arglist[r];
- scriptexec= preexecscript(scriptpath,arglist);
- narglist[0]= (char*)scriptexec;
- execv(scriptexec,arglist);
+ narglist[0]= strdup(preexecscript(scriptpath,arglist));
+ execv(narglist[0],narglist);
ohshite(desc,name);
}
script_catchsignals(); /* This does a push_cleanup() */
return 0;
}
-void oldconffsetflags(struct conffile *searchconff) {
+void oldconffsetflags(const struct conffile *searchconff) {
struct filenamenode *namenode;
while (searchconff) {
void setforce(const struct cmdinfo *cip, const char *value) {
const char *comma;
- int l;
+ size_t l;
const struct forceinfo *fip;
if (!strcmp(value,"help")) {
for (fip=forceinfos; fip->name; fip++)
*fip->opt= cip->arg;
else
- badusage(_("unknown force/refuse option `%.*s'"), l<250 ? l : 250, value);
+ badusage(_("unknown force/refuse option `%.*s'"), l<250 ? (int)l : 250, value);
else
*fip->opt= cip->arg;
if (!comma) break;
static void execbackend(int argc, const char *const *argv) NONRETURNING;
static void execbackend(int argc, const char *const *argv) {
- execvp(BACKEND, (char* const*) argv);
+ char **nargv= malloc(sizeof(char *) * argc + 1);
+ int i= 0;
+ if (!nargv) ohshite(_("couldn't malloc in execbackend"));
+ while (i < argc)
+ nargv[i++]= strdup(argv[i]);
+ nargv[i]= 0;
+ execvp(BACKEND, nargv);
ohshite(_("failed to exec dpkg-deb"));
}
void commandfd(const char *const *argv) {
if (c == EOF) ohshit(_("unexpected eof before end of line %d"),lno);
if (!argc) continue;
varbufaddc(&linevb,0);
-printf("line=`%*s'\n",linevb.used,linevb.buf);
+printf("line=`%*s'\n",(int)linevb.used,linevb.buf);
oldargs= newargs= realloc(oldargs,sizeof(const char *) * (argc + 1));
argc= 1;
ptr= linevb.buf;
int force_conflicts(struct deppossi *possi);
void ensure_package_clientdata(struct pkginfo *pkg);
const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile);
-void oldconffsetflags(struct conffile *searchconff);
+void oldconffsetflags(const struct conffile *searchconff);
void ensure_pathname_nonexisting(const char *pathname);
int chmodsafe_unlink(const char *pathname); /* chmod 600, then unlink */
void checkpath(void);
struct pkgiterator *it;
struct pkginfo *pkg;
const char *thisarg;
- int l;
+ size_t l;
modstatdb_init(admindir,
f_noact ? msdbrw_readonly
ok= 1;
varbuffree(&oemsgs);
- debug(dbg_depcon,"ok %d msgs >>%.*s<<", ok, aemsgs->used, aemsgs->buf);
+ debug(dbg_depcon,"ok %d msgs >>%.*s<<", ok, (int)aemsgs->used, aemsgs->buf);
return ok;
}
debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name);
if (de->d_name[0] == '.') continue; /* ignore dotfiles, including `.' and `..' */
p= strrchr(de->d_name,'.'); if (!p) continue; /* ignore anything odd */
- if (strlen(pkg->name) != p-de->d_name ||
+ if (strlen(pkg->name) != (size_t)(p-de->d_name) ||
strncmp(de->d_name,pkg->name,p-de->d_name)) continue;
debug(dbg_stupidlyverbose, "process_archive info this pkg");
/* Right do we have one ? */
debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name);
if (de->d_name[0] == '.') continue;
p= strrchr(de->d_name,'.'); if (!p) continue;
- if (strlen(otherpkg->name) != p-de->d_name ||
+ if (strlen(otherpkg->name) != (size_t)(p-de->d_name) ||
strncmp(de->d_name,otherpkg->name,p-de->d_name)) continue;
debug(dbg_stupidlyverbose, "process_archive info this pkg");
fnvb.used= infodirbaseused;
debug(dbg_veryverbose, "removal_bulk info file `%s'", de->d_name);
if (de->d_name[0] == '.') continue;
p= strrchr(de->d_name,'.'); if (!p) continue;
- if (strlen(pkg->name) != p-de->d_name ||
+ if (strlen(pkg->name) != (size_t)(p-de->d_name) ||
strncmp(de->d_name,pkg->name,p-de->d_name)) continue;
debug(dbg_stupidlyverbose, "removal_bulk info this pkg");
/* We need the postrm and list files for --purge. */
*lconffp= conff->next;
} else {
debug(dbg_conffdetail,"removal_bulk set to new conffile `%s'",conff->name);
- conff->hash= (char*)NEWCONFFILEFLAG; /* yes, cast away const */
+ conff->hash= NEWCONFFILEFLAG; /* yes, cast away const */
}
}
modstatdb_note(pkg);
const char *version;
const char *md5sum;
unsigned long orglength;
- int thispartn, maxpartn;
+ unsigned int thispartn, maxpartn;
unsigned long maxpartlen;
unsigned long thispartoffset;
- unsigned long thispartlen;
- unsigned long headerlen; /* size of header in part file */
- unsigned long filesize;
+ size_t thispartlen;
+ size_t headerlen; /* size of header in part file */
+ off_t filesize;
};
struct partqueue {
struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir) {
/* returns info (nfmalloc'd) if was an archive part and we read it, 0 if it wasn't */
static char *readinfobuf= 0;
- static int readinfobuflen= 0;
+ static size_t readinfobuflen= 0;
- unsigned long thisilen, templong;
+ size_t thisilen;
+ unsigned int templong;
char magicbuf[sizeof(PARTMAGIC)-1], *rip, *partnums, *slash;
struct ar_hdr arh;
int c;
FILE *output, *input;
void *buffer;
struct partinfo *pi;
- int i,nr;
- long buffersize;
+ unsigned int i;
+ size_t nr,buffersize;
printf("Putting package %s together from %d parts: ",
partlist[0]->package,partlist[0]->maxpartn);
const char *thisarg;
struct partqueue *pq;
struct partinfo *refi, *pi, **partlist;
- int i;
+ unsigned int i;
assert(!queue);
if (!*argv) badusage(_("--join requires one or more part file arguments"));
if (cipaction)
badusage(_("conflicting actions --%s and --%s"),cip->olong,cipaction->olong);
cipaction= cip;
- assert(cip-cmdinfos < sizeof(dofunctions)*sizeof(dofunction*));
+ assert((int)(cip-cmdinfos) < (int)(sizeof(dofunctions)*sizeof(dofunction*)));
action= dofunctions[cip-cmdinfos];
}
const char *partfile;
struct partinfo *pi, *refi, *npi, **partlist, *otherthispart;
struct partqueue *pq;
- int i, nr, j, ap;
+ unsigned int i, j;
+ int ap;
+ long nr;
FILE *part;
void *buffer;
char *p, *q;
const char *head;
struct stat stab;
unsigned long bytes;
- int i;
+ unsigned int i;
if (*argv) badusage(_("--listq does not take any arguments"));
scandepot();
unsigned char chk_digest[16], file_digest[16];
char filename[256];
FILE *fp;
- int flen = 14;
+ size_t flen = 14;
while ((rc = get_md5_line(chkf, chk_digest, filename)) >= 0) {
if (rc == 0) /* not an md5 line */
if (verbose) {
if (strlen(filename) > flen)
flen = strlen(filename);
- fprintf(stderr, "%-*s ", flen, filename);
+ fprintf(stderr, "%-*s ", (int)flen, filename);
}
if (bin_mode || rc == 2)
fp = fopen(filename, FOPRBIN);
static void push(struct pid_list **list, int pid);
static void do_help(void);
static void parse_options(int argc, char * const *argv);
-static int pid_is_user(int pid, int uid);
+static int pid_is_user(int pid, uid_t uid);
static int pid_is_cmd(int pid, const char *name);
static void check(int pid);
static void do_pidfile(const char *name);
static int parse_signal (const char *signal_str, int *signal_nr)
{
- int i;
+ unsigned int i;
if (parse_integer(signal_str, signal_nr) == 0)
return 0;
while (schedule_str != NULL) {
slash = strchr(schedule_str,'/');
str_len = slash ? slash - schedule_str : strlen(schedule_str);
- if (str_len >= sizeof(item_buf))
+ if (str_len >= (ptrdiff_t)sizeof(item_buf))
badusage("invalid schedule item: far too long"
" (you must delimit items with slashes)");
memcpy(item_buf, schedule_str, str_len);
static int
-pid_is_user(int pid, int uid)
+pid_is_user(int pid, uid_t uid)
{
struct stat sb;
char buf[32];