Commit b04074e6 authored by Bernhard Link's avatar Bernhard Link

remove all trailing spaces for the sake of newyear's eve

parent 8108ef22
/* This file is part of "reprepro"
* Copyright (C) 2004,2005 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -50,7 +50,7 @@ struct aptmethod {
pid_t child;
enum { ams_notstarted=0, ams_waitforcapabilities, ams_ok, ams_failed } status;
struct tobedone *tobedone,*lasttobedone;
/*@dependent@*/const struct tobedone *nexttosend;
struct tobedone *failed;
......@@ -136,7 +136,7 @@ retvalue aptmethod_shutdown(struct aptmethodrun *run) {
}
while( run->methods != NULL ) {
pid_t pid;int status;
pid = wait(&status);
lastmethod = NULL; method = run->methods;
while( method != NULL ) {
......@@ -257,7 +257,7 @@ inline static retvalue aptmethod_startup(struct aptmethodrun *run,struct aptmeth
/* new try, new luck */
method->fallenback = FALSE;
/* When there is nothing to get, there is no reason to startup
* the method. */
if( method->tobedone == NULL ) {
......@@ -271,13 +271,13 @@ inline static retvalue aptmethod_startup(struct aptmethodrun *run,struct aptmeth
method->status = ams_waitforcapabilities;
r = pipe(stdin);
r = pipe(stdin);
if( r < 0 ) {
int err = errno;
fprintf(stderr,"Error while creating pipe: %d=%m\n",err);
return RET_ERRNO(err);
}
r = pipe(stdout);
r = pipe(stdout);
if( r < 0 ) {
int err = errno;
(void)close(stdin[0]);(void)close(stdin[1]);
......@@ -328,14 +328,14 @@ inline static retvalue aptmethod_startup(struct aptmethodrun *run,struct aptmeth
}
}
}
methodname = calc_dirconcat(methoddir,method->name);
if( methodname == NULL )
exit(255);
execl(methodname,methodname,NULL);
fprintf(stderr,"Error while executing '%s': %d=%m\n",methodname,errno);
exit(255);
}
......@@ -383,7 +383,7 @@ static inline retvalue sendconfig(struct aptmethod *method) {
for( p = method->config; *p != '\0' ; p++ ) {
if( *p == '\n' )
l += sizeof(CONFITEM)-1;
else
else
l++;
}
c = method->command = malloc(l);
......@@ -466,7 +466,7 @@ retvalue aptmethod_queuefile(struct aptmethod *method,const char *origfile,const
if( t != NULL )
*t = todo;
return RET_OK;
}
retvalue aptmethod_queueindexfile(struct aptmethod *method,const char *origfile,const char *destfile) {
......@@ -512,7 +512,7 @@ static inline retvalue todo_done(const struct tobedone *todo,const char *filenam
} else
calculatedmd5 = NULL;
}
/* if we know what it should be, check it: */
if( todo->md5sum != NULL ) {
if( md5sum == NULL || strcmp(md5sum,todo->md5sum) != 0) {
......@@ -528,13 +528,13 @@ static inline retvalue todo_done(const struct tobedone *todo,const char *filenam
assert(filesdb != NULL);
assert(todo->md5sum != NULL);
r = files_add(filesdb,todo->filekey,todo->md5sum);
if( RET_WAS_ERROR(r) )
return r;
}
return RET_OK;
}
......@@ -711,7 +711,7 @@ static inline retvalue goturidone(struct aptmethod *method,const char *chunk,fil
char *uri,*filename,*md5,*size,*md5sum;
//TODO: is it worth the mess to make this in-situ?
r = chunk_getvalue(chunk,"URI",&uri);
if( r == RET_NOTHING ) {
fprintf(stderr,"Missing URI-header in uridone got from method!\n");
......@@ -729,7 +729,7 @@ static inline retvalue goturidone(struct aptmethod *method,const char *chunk,fil
free(uri);
return r;
}
md5sum = NULL;
r = chunk_getvalue(chunk,"MD5-Hash",&md5);
if( RET_IS_OK(r) ) {
......@@ -780,7 +780,7 @@ static inline retvalue goturierror(struct aptmethod *method,const char *chunk) {
free(uri);
return r;
}
static inline retvalue parsereceivedblock(struct aptmethod *method,const char *input,filesdb filesdb) {
const char *p;
retvalue r;
......@@ -879,13 +879,13 @@ static retvalue receivedata(struct aptmethod *method,filesdb filesdb) {
/* First look if we have enough room to read.. */
if( method->alreadyread + 1024 >= method->input_size ) {
char *newptr;
if( method->input_size >= 128000 ) {
fprintf(stderr,"Ridiculous long answer from method!\n");
method->status = ams_failed;
return RET_ERROR;
}
newptr = realloc(method->inputbuffer,method->alreadyread+1024);
if( newptr == NULL ) {
return RET_ERROR_OOM;
......@@ -910,7 +910,7 @@ static retvalue receivedata(struct aptmethod *method,filesdb filesdb) {
while(TRUE) {
retvalue res;
r = method->alreadyread;
r = method->alreadyread;
p = method->inputbuffer;
consecutivenewlines = 0;
......@@ -959,7 +959,7 @@ static retvalue senddata(struct aptmethod *method) {
method->alreadywritten = 0;
// TODO: make sure this is already checked for earlier...
assert(strchr(method->nexttosend->uri,'\n')==NULL || strchr(method->nexttosend->filename,'\n') == 0);
/* http-aptmethod seems to loose the last byte if the file is already
/* http-aptmethod seems to loose the last byte if the file is already
* in place, so we better unlink the target first... */
unlink(method->nexttosend->filename);
method->command = mprintf(
......@@ -995,7 +995,7 @@ static retvalue senddata(struct aptmethod *method) {
}
static retvalue checkchilds(struct aptmethodrun *run) {
pid_t child;int status;
pid_t child;int status;
retvalue result = RET_OK;
while( (child = waitpid(-1,&status,WNOHANG)) > 0 ) {
......@@ -1054,7 +1054,7 @@ static retvalue readwrite(struct aptmethodrun *run,int *workleft,filesdb filesdb
maxfd = 0;
*workleft = 0;
for( method = run->methods ; method != NULL ; method = method->next ) {
if( method->status == ams_ok &&
if( method->status == ams_ok &&
( method->command != NULL || method->nexttosend != NULL )) {
FD_SET(method->stdin,&writefds);
if( method->stdin > maxfd )
......
/* This file is part of "reprepro"
* Copyright (C) 2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -180,7 +180,7 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
fprintf(stderr,"Corrupt ar-file %s\n",ar->filename);
return RET_ERROR;
}
/* calculate the length and mark possible fillers being needed */
ar->currentheader.ah_size[11] = '\0'; // ugly, but it works
......@@ -190,7 +190,7 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
fprintf(stderr,"Error calculating length field in ar-file %s\n",ar->filename);
return RET_ERROR;
}
if( (ar->bytes_left & 1) != 0 )
if( (ar->bytes_left & 1) != 0 )
ar->wasodd = TRUE;
/* get the name of the file */
......
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -120,7 +120,7 @@ static retvalue binaries_parse_chunk(const char *chunk,const char *packagename,c
static retvalue binaries_parse_getfilekeys(const char *chunk,struct strlist *files) {
retvalue r;
char *filename;
/* Read the filename given there */
r = chunk_getvalue(chunk,"Filename",&filename);
if( !RET_IS_OK(r) ) {
......@@ -189,7 +189,7 @@ retvalue binaries_getversion(UNUSED(struct target *t),const char *control,char *
}
return r;
}
retvalue binaries_getinstalldata(struct target *t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
char *sourcename,*basename;
struct strlist mymd5sums;
......
......@@ -24,7 +24,7 @@ retvalue binaries_doreoverride(const struct alloverrides *alloverrides,const cha
retvalue ubinaries_doreoverride(const struct alloverrides *alloverrides,const char *packagename,const char *controlchunk,/*@out@*/char **newcontrolchunk);
retvalue binaries_retrack(struct target *t,const char *packagename,const char *chunk, trackingdb tracks,references refs);
retvalue binaries_getsourceandversion(struct target *,const char *chunk,const char *packagename,char **source,char **version);
#endif
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -98,7 +98,7 @@ retvalue changes_parsefileline(const char *fileline, filetype *result_type,
versionstart = p;
// We cannot say where the version ends and the filename starts,
// but as the packagetypes would be valid part of the version, too,
// this check gets the broken things.
// this check gets the broken things.
names_overversion(&p,TRUE);
if( *p != '\0' && *p != '_' ) {
fprintf(stderr,"Unexpected character '%c' in filename within '%s'!\n",*p,fileline);
......
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -186,7 +186,7 @@ static retvalue newentry(struct fileentry **entry,const char *fileline,const cha
}
if( forcearchitecture != NULL ) {
if( strcmp(forcearchitecture,"source") != 0 &&
if( strcmp(forcearchitecture,"source") != 0 &&
strcmp(e->architecture,"all") == 0 ) {
if( verbose > 2 )
fprintf(stderr,"Placing '%s' only in architecture '%s' as requested.\n",e->basename,forcearchitecture);
......@@ -242,7 +242,7 @@ static retvalue check(const char *filename,struct changes *changes,const char *f
return RET_OK;
} else {
return RET_ERROR;
}
}
}
return r;
}
......@@ -269,14 +269,14 @@ static retvalue changes_read(const char *filename,/*@out@*/struct changes **chan
return r; \
} \
}
c = calloc(1,sizeof(struct changes));
if( c == NULL )
return RET_ERROR_OOM;
r = signature_readsignedchunk(filename,&c->control,&c->fingerprints, NULL, &broken);
R;
if( broken && !IGNORING_(brokensignatures,
if( broken && !IGNORING_(brokensignatures,
"'%s' contains only broken signatures.\n"
"This most likely means the file was damaged (or edited improperly)\n",
filename) ) {
......@@ -336,7 +336,7 @@ static retvalue changes_fixfields(const struct distribution *distribution,const
fprintf(stderr,"No files given in '%s'!\n",filename);
return RET_ERROR;
}
while( e != NULL ) {
const struct overrideinfo *oinfo = NULL;
const char *force = NULL;
......@@ -345,8 +345,8 @@ static retvalue changes_fixfields(const struct distribution *distribution,const
FE_BINARY(e->type)?(e->type==fe_UDEB?ao->udeb:ao->deb):ao->dsc,
e->name);
}
if( forcesection != NULL )
if( forcesection != NULL )
force = forcesection;
else
force = override_get(oinfo,SECTION_FIELDNAME);
......@@ -417,7 +417,7 @@ static retvalue changes_fixfields(const struct distribution *distribution,const
if( RET_WAS_ERROR(r) )
return r;
// Let's just check here, perhaps
if( e->type == fe_UDEB &&
if( e->type == fe_UDEB &&
!strlist_in(&distribution->udebcomponents,e->component)) {
fprintf(stderr,"Cannot put file '%s' into component '%s', as it is not listed in UDebComponents!\n",e->basename,e->component);
return RET_ERROR;
......@@ -472,7 +472,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
struct fileentry *e;
retvalue r = RET_OK;
bool_t havedsc=FALSE, haveorig=FALSE, havetar=FALSE, havediff=FALSE;
/* First check for each given architecture, if it has files: */
if( forcearchitecture != NULL ) {
if( !strlist_in(&changes->architectures,forcearchitecture) ){
......@@ -568,9 +568,9 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
return RET_ERROR;
}
if( strlist_in(&changes->architectures,"source") && !havedsc &&
( forcearchitecture == NULL
( forcearchitecture == NULL
|| strcmp(forcearchitecture,"source") == 0 ) &&
( packagetypeonly == NULL
( packagetypeonly == NULL
|| strcmp(packagetypeonly,"dsc") == 0 )
) {
fprintf(stderr,"I don't know what to do with a source-upload not containing a .dsc in '%s'!\n",filename);
......@@ -703,7 +703,7 @@ static retvalue changes_deleteleftoverfiles(struct changes *changes,int delete)
fullorigfilename, e, strerror(e));
r = RET_ERRNO(e);
RET_UPDATE(result,r);
}
}
free(fullorigfilename);
}
......@@ -764,7 +764,7 @@ static retvalue changes_checkpkgs(filesdb filesdb,struct distribution *distribut
if( r == RET_NOTHING )
somethingwasmissed = TRUE;
}
free(fullfilename);
if( RET_WAS_ERROR(r) )
break;
......@@ -810,7 +810,7 @@ static retvalue changes_includepkgs(const char *dbdir,references refs,struct dis
if( r == RET_NOTHING )
somethingwasmissed = TRUE;
}
if( RET_WAS_ERROR(r) )
break;
e = e->next;
......@@ -840,7 +840,7 @@ retvalue changes_add(const char *dbdir,trackingdb const tracks,references refs,f
if( RET_WAS_ERROR(r) )
return r;
if( (distribution->suite == NULL ||
if( (distribution->suite == NULL ||
!strlist_in(&changes->distributions,distribution->suite)) &&
!strlist_in(&changes->distributions,distribution->codename) ) {
if( !IGNORING("Ignoring","To ignore",wrongdistribution,".changes put in a distribution not listed within it!\n") ) {
......@@ -935,7 +935,7 @@ retvalue changes_add(const char *dbdir,trackingdb const tracks,references refs,f
assert( changes->srcdirectory != NULL );
basename = dirs_basename(changesfilename);
changes->changesfilekey =
changes->changesfilekey =
calc_dirconcat(changes->srcdirectory,basename);
if( changes->changesfilekey == NULL ) {
changes_free(changes);
......
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -44,9 +44,9 @@
extern int verbose;
/* This file includes the code to include binaries, i.e.
to create the chunk for the Packages.gz-file and
to create the chunk for the Packages.gz-file and
to put it in the various databases.
Things to do with .deb's checkin by hand: (by comparison with apt-ftparchive)
- extract the control file (that's the hard part -> extractcontrol.c )
- check for Package, Version, Architecture, Maintainer, Description
......@@ -194,7 +194,7 @@ static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename,
deb->sourceversion = strdup(deb->version);
if( deb->sourceversion == NULL )
r = RET_ERROR_OOM;
else
else
r = RET_OK;
} else
......@@ -276,7 +276,7 @@ static retvalue deb_complete(struct debpackage *pkg,const struct overrideinfo *o
static retvalue deb_calclocations(struct debpackage *pkg,/*@null@*/const char *givenfilekey,const char *packagetype) {
retvalue r;
char *basename;
basename = calc_binary_basename(pkg->package,pkg->version,pkg->architecture,packagetype);
if( basename == NULL )
return RET_ERROR_OOM;
......@@ -378,7 +378,7 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb,filesdb filesdb,const char
deb_free(pkg);
return RET_ERROR;
}
/* decide where it has to go */
if( strcmp(packagetype,"udeb") == 0 )
......@@ -395,7 +395,7 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb,filesdb filesdb,const char
if( verbose > 0 && forcecomponent == NULL ) {
fprintf(stderr,"%s: component guessed as '%s'\n",debfilename,pkg->component);
}
/* some sanity checks: */
if( forcearchitecture != NULL && strcmp(forcearchitecture,"all") != 0 &&
......@@ -463,7 +463,7 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb,filesdb filesdb,const char
if( RET_WAS_ERROR(r) ) {
deb_free(pkg);
return r;
}
}
*deb = pkg;
return RET_OK;
}
......@@ -471,9 +471,9 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb,filesdb filesdb,const char
retvalue deb_hardlinkfiles(struct debpackage *deb,filesdb filesdb,const char *debfilename) {
assert( deb != NULL );
assert( deb->filekey != NULL && deb-> md5sum != NULL );
return files_hardlink(filesdb, debfilename, deb->filekey, deb->md5sum);
return files_hardlink(filesdb, debfilename, deb->filekey, deb->md5sum);
}
retvalue deb_addprepared(const struct debpackage *pkg, const char *dbdir,references refs,const char *forcearchitecture,const char *packagetype,struct distribution *distribution,struct strlist *dereferencedfilekeys,struct trackingdata *trackingdata){
retvalue r,result;
int i;
......@@ -563,6 +563,6 @@ retvalue deb_add(const char *dbdir,references refs,filesdb filesdb,const char *f
r2 = trackingdata_finish(tracks, &trackingdata, refs, dereferencedfilekeys);
RET_ENDUPDATE(r,r2);
}
return r;
}
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -46,7 +46,7 @@
extern int verbose;
/* This file includes the code to include sources, i.e.
to create the chunk for the Sources.gz-file and
to create the chunk for the Sources.gz-file and
to put it in the various databases.
things to do with .dsc's checkin by hand: (by comparison with apt-ftparchive)
......@@ -62,7 +62,7 @@ things to do with .dsc's checkin by hand: (by comparison with apt-ftparchive)
* Get overwrite information, ecspecially
the priority(if there is a binaries field,
check the one with the highest) and the section
check the one with the highest) and the section
(...what else...?)
* Rename Source-Field to Package-Field
......@@ -157,7 +157,7 @@ static retvalue dsc_read(/*@out@*/struct dscpackage **pkg, const char *filename)
dsc_free(dsc);
return r;
}
if( broken && !IGNORING_(brokensignatures,
if( broken && !IGNORING_(brokensignatures,
"'%s' contains only broken signatures.\n"
"This most likely means the file was damaged (or edited improperly)\n",
filename) ) {
......@@ -241,7 +241,7 @@ static retvalue dsc_calclocations(struct dscpackage *pkg,/*@null@*/const char *f
if( pkg->directory == NULL ) {
return RET_ERROR_OOM;
}
/* Calculate the filekeys: */
r = calc_dirconcats(pkg->directory,&pkg->basenames,&pkg->filekeys);
if( RET_WAS_ERROR(r) ) {
......@@ -324,7 +324,7 @@ static retvalue dsc_complete(struct dscpackage *pkg,const struct overrideinfo *o
free(newchunk2);
return RET_ERROR_OOM;
}
newchunk = chunk_replacefields(newchunk2,replace,"Files");
free(newfilelines);
free(newchunk2);
......@@ -363,15 +363,15 @@ retvalue dsc_prepare(struct dscpackage **dsc,filesdb filesdb,const char *forceco
strcmp(expectedname, pkg->package) != 0 ) {
/* This cannot be ignored, as too much depends on it yet */
fprintf(stderr,
"'%s' says it is '%s', while .changes file said it is '%s'\n",
"'%s' says it is '%s', while .changes file said it is '%s'\n",
basename, pkg->package, expectedname);
dsc_free(pkg);
return RET_ERROR;
}
if( expectedversion != NULL &&
strcmp(expectedversion, pkg->version) != 0 &&
!IGNORING_(wrongversion,
"'%s' says it is version '%s', while .changes file said it is '%s'\n",
!IGNORING_(wrongversion,
"'%s' says it is version '%s', while .changes file said it is '%s'\n",
basename, pkg->version, expectedversion)) {
dsc_free(pkg);
return RET_ERROR;
......@@ -412,7 +412,7 @@ retvalue dsc_prepare(struct dscpackage **dsc,filesdb filesdb,const char *forceco
dsc_free(pkg);
return RET_ERROR;
}
/* decide where it has to go */
r = guess_component(distribution->codename,&distribution->components,
......@@ -441,7 +441,7 @@ retvalue dsc_prepare(struct dscpackage **dsc,filesdb filesdb,const char *forceco
}
/* Calculate the chunk to include: */
if( !RET_WAS_ERROR(r) )
r = dsc_adddsc(pkg);
......@@ -464,7 +464,7 @@ retvalue dsc_addprepared(const struct dscpackage *pkg,const char *dbdir,referenc
r = target_initpackagesdb(t,dbdir);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
if( interrupted() )
if( interrupted() )
r = RET_ERROR_INTERUPTED;
else
r = target_addpackage(t,refs,pkg->package,pkg->version,pkg->control,&pkg->filekeys,FALSE,dereferencedfilekeys,trackingdata,ft_SOURCE);
......@@ -477,8 +477,8 @@ retvalue dsc_addprepared(const struct dscpackage *pkg,const char *dbdir,referenc
/* insert the given .dsc into the mirror in <component> in the <distribution>
* if component is NULL, guessing it from the section.
* If basename, filekey and directory are != NULL, then they are used instead
* of being newly calculated.
* If basename, filekey and directory are != NULL, then they are used instead
* of being newly calculated.
* (And all files are expected to already be in the pool). */
retvalue dsc_add(const char *dbdir,references refs,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const struct overrideinfo *srcoverride,int delete,struct strlist *dereferencedfilekeys, trackingdb tracks){
retvalue r;
......
......@@ -21,8 +21,8 @@
retvalue dsc_add(const char *dbdir,references refs,filesdb filesdb,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,struct distribution *distribution,const char *dscfilename,/*@null@*/const struct overrideinfo *srcoverride,int delete,/*@null@*/struct strlist *dereferencedfilekeys, /*@null@*/trackingdb tracks);
/* in two steps:
* If basename, filekey and directory are != NULL, then they are used instead
* of being newly calculated.
* If basename, filekey and directory are != NULL, then they are used instead
* of being newly calculated.
* (And all files are expected to already be in the pool),
* delete should be D_INPLACE then
*/
......
......@@ -219,7 +219,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
q++;
if( *q == '\n' )
q++;
}
if( p == chunk )
chunk = q;
......@@ -239,7 +239,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
while( *e != '\0' && *e != '\n' )
e++;
}
if( i < 0 ) {
if( i < 0 ) {
/* not known, we'll have to copy it */
maxlen += 1+e-p;
if( *e == '\0' )
......@@ -251,7 +251,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
fields[i].startofs = p-chunk;
fields[i].endofs = e-chunk;
if( fields[i].cef->action == CEF_KEEP ||
fields[i].cef->action == CEF_ADDMISSED )
fields[i].cef->action == CEF_ADDMISSED )
maxlen += 1+e-q;
}
if( *e == '\0' )
......@@ -311,7 +311,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
n[len++] = '\n';
for( j = 0 ; j < ef->lines[i].wordcount ; j++ ) {
n[len++] = ' ';
memcpy( n+len, ef->lines[i].words[j],
memcpy( n+len, ef->lines[i].words[j],
ef->lines[i].wordlen[j]);
len += ef->lines[i].wordlen[j];
}
......@@ -335,7 +335,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
q++;
if( *q == '\n' )
q++;
}
p = q;
continue;
......@@ -353,7 +353,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
while( *e != '\0' && *e != '\n' )
e++;
}
if( i < 0 ) {
if( i < 0 ) {
/* not known, copy it */
size_t l = e - p;
assert( maxlen >= len + l );
......@@ -414,7 +414,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
n[len++] = '\n';
for( j = 0 ; j < ef->lines[i].wordcount ; j++ ) {
n[len++] = ' ';
memcpy( n+len, ef->lines[i].words[j],
memcpy( n+len, ef->lines[i].words[j],
ef->lines[i].wordlen[j]);
len += ef->lines[i].wordlen[j];
}
......
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
......@@ -143,7 +143,7 @@ retvalue chunk_read(gzFile f,char **chunk) {
static const char *chunk_getfield(const char *name,const char *chunk) {
size_t l;
if( chunk == NULL )
if( chunk == NULL )
return NULL;
l = strlen(name);
while( *chunk != '\0' ) {
......@@ -161,7 +161,7 @@ static const char *chunk_getfield(const char *name,const char *chunk) {
}
/* get the content of the given field, including all following lines, in a format
* that may be put into chunk_replacefields
* that may be put into chunk_replacefields
static retvalue chunk_getcontent(const char *chunk,const char *name,char **value) {
const char *field;
char *val;
......@@ -193,7 +193,7 @@ static retvalue chunk_getcontent(const char *chunk,const char *name,char **value
e--;
if( e > b )
val = strndup(b,e-b+1);
else
else
val = strdup("");
if( val == NULL )
return RET_ERROR_OOM;
......@@ -226,7 +226,7 @@ retvalue chunk_getvalue(const char *chunk,const char *name,char **value) {
e--;
if( !xisspace(*e) )
val = strndup(b,e-b+1);
else
else
val = strdup("");
if( val == NULL )
return RET_ERROR_OOM;
......@@ -285,7 +285,7 @@ retvalue chunk_getextralinelist(const char *chunk,const char *name,struct strlis
e--;
if( !xisspace(*e) )
v = strndup(b,e-b+1);
else
else
v = strdup("");
if( v == NULL ) {
strlist_done(strlist);
......@@ -382,7 +382,7 @@ retvalue chunk_gettruth(const char *chunk,const char *name) {
return RET_OK;
}
/* return RET_OK, if field is found, RET_NOTHING, if not */
/* return RET_OK, if field is found, RET_NOTHING, if not */
retvalue chunk_checkfield(const char *chunk,const char *name){
const char *field;
......@@ -405,15 +405,15 @@ retvalue chunk_getname(const char *chunk,const char *name,
field++;
name_end = field;
/* this has now checked somewhere else for correctness and
* is only a pure separation process:
* is only a pure separation process:
* (as package(version) is possible, '(' must be checked) */
while( *name_end != '\0' && *name_end != '\n' && *name_end != '(' && !xisspace(*name_end) )
name_end++;
p = name_end;
while( *p != '\0' && *p != '\n' && xisspace(*p) )
p++;
if( name_end == field ||
( *p != '\0' && *p != '\n' &&
if( name_end == field ||
( *p != '\0' && *p != '\n' &&
( !allowversion || *p != '('))) {
if( *field == '\n' || *field == '\0' ) {
fprintf(stderr,"Error: Field '%s' is empty!\n",name);
......@@ -459,15 +459,15 @@ retvalue chunk_getnameandversion(const char *chunk,const char *name,
field++;
name_end = field;
/* this has now checked somewhere else for correctness and
* is only a pure separation process:
* is only a pure separation process:
* (as package(version) is possible, '(' must be checked) */
while( *name_end != '\0' && *name_end != '\n' && *name_end != '(' && !xisspace(*name_end) )
name_end++;
p = name_end;
while( *p != '\0' && *p != '\n' && xisspace(*p) )
p++;
if( name_end == field ||
( *p != '\0' && *p != '\n' &&