From b0fe0b8d43051f156827154210eacaaeb2fcaab0 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 12 Mar 2007 01:40:55 +0000 Subject: [PATCH] * lib/dpkg.h (compression_type): Rename to ... (compress_type): ... this. Fix all users. (CAT): Rename to ... (compress_type_cat): ... this. Fix all users. (GZ): Rename to ... (compress_type_gzip): ... this. Fix all users. (BZ2): Rename to ... (compress_type_bzip2): ... this. Fix all users. --- ChangeLog | 11 +++++++++++ dpkg-deb/build.c | 18 ++++++++++++------ dpkg-deb/dpkg-deb.h | 2 +- dpkg-deb/extract.c | 8 ++++---- dpkg-deb/main.c | 8 ++++---- lib/compression.c | 19 ++++++++++--------- lib/dpkg.h | 11 ++++++++--- 7 files changed, 50 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a7c251c..96cfddf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-03-12 Guillem Jover + + * lib/dpkg.h (compression_type): Rename to ... + (compress_type): ... this. Fix all users. + (CAT): Rename to ... + (compress_type_cat): ... this. Fix all users. + (GZ): Rename to ... + (compress_type_gzip): ... this. Fix all users. + (BZ2): Rename to ... + (compress_type_bzip2): ... this. Fix all users. + 2007-03-06 Guillem Jover * lib/compression.c (fd_fd_filter): New function, refactored. As diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index e1aa9afe..9f9af39a 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -342,7 +342,7 @@ void do_build(const char *const *argv) { /* And run gzip to compress our control archive */ if (!(c2= m_fork())) { m_dup2(p1[0],0); m_dup2(gzfd,1); close(p1[0]); close(gzfd); - compress_cat(GZ, 0, 1, "9", _("control")); + compress_cat(compress_type_gzip, 0, 1, "9", _("control")); } close(p1[0]); waitsubproc(c2,"gzip -9c",0); @@ -446,11 +446,17 @@ void do_build(const char *const *argv) { if (!oldformatflag) { const char *datamember; switch (compress_type) { - case GZ: datamember= DATAMEMBER_GZ; break; - case BZ2: datamember= DATAMEMBER_BZ2; break; - case CAT: datamember= DATAMEMBER_CAT; break; - default: - ohshit(_("Internal error, compress_type `%i' unknown!"), compress_type); + case compress_type_gzip: + datamember = DATAMEMBER_GZ; + break; + case compress_type_bzip2: + datamember = DATAMEMBER_BZ2; + break; + case compress_type_cat: + datamember = DATAMEMBER_CAT; + break; + default: + ohshit(_("Internal error, compress_type `%i' unknown!"), compress_type); } if (fstat(gzfd,&datastab)) ohshite("_(failed to fstat tmpfile (data))"); if (fprintf(ar, diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h index cc8dc7e7..b88ba471 100644 --- a/dpkg-deb/dpkg-deb.h +++ b/dpkg-deb/dpkg-deb.h @@ -36,7 +36,7 @@ void extracthalf(const char *debar, const char *directory, extern const char *compression; extern const char* showformat; -extern enum compression_type compress_type; +extern enum compress_type compress_type; #define DEBMAGIC "!\ndebian-binary " #define ADMINMEMBER "control.tar.gz " diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 4db9eb7e..1541980e 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -99,7 +99,7 @@ void extracthalf(const char *debar, const char *directory, #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ > 0) fpos_t fpos; #endif - enum compression_type compress_type = GZ; + enum compress_type compress_type = compress_type_gzip; ar= fopen(debar,"r"); if (!ar) ohshite(_("failed to read archive `%.255s'"),debar); if (fstat(fileno(ar),&stab)) ohshite(_("failed to fstat archive")); @@ -152,11 +152,11 @@ void extracthalf(const char *debar, const char *directory, if (!memcmp(arh.ar_name,DATAMEMBER_GZ,sizeof(arh.ar_name)) || !memcmp(arh.ar_name,DATAMEMBER_COMPAT_GZ,sizeof(arh.ar_name))) { adminmember= 0; - compress_type= GZ; + compress_type = compress_type_gzip; } else if (!memcmp(arh.ar_name,DATAMEMBER_BZ2,sizeof(arh.ar_name)) || !memcmp(arh.ar_name,DATAMEMBER_COMPAT_BZ2,sizeof(arh.ar_name))) { adminmember= 0; - compress_type= BZ2; + compress_type = compress_type_bzip2; } else if (!memcmp(arh.ar_name, DATAMEMBER_LZMA, sizeof(arh.ar_name)) || !memcmp(arh.ar_name, DATAMEMBER_COMPAT_LZMA, sizeof(arh.ar_name))) { adminmember = 0; @@ -164,7 +164,7 @@ void extracthalf(const char *debar, const char *directory, } else if (!memcmp(arh.ar_name,DATAMEMBER_CAT,sizeof(arh.ar_name)) || !memcmp(arh.ar_name,DATAMEMBER_COMPAT_CAT,sizeof(arh.ar_name))) { adminmember= 0; - compress_type= CAT; + compress_type = compress_type_cat; } else { ohshit(_("file `%.250s' contains ununderstood data member %.*s, giving up"), debar, (int)sizeof(arh.ar_name), arh.ar_name); diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c index a75917bc..13ae7478 100644 --- a/dpkg-deb/main.c +++ b/dpkg-deb/main.c @@ -117,7 +117,7 @@ const char printforhelp[]= int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT; const char* compression=NULL; -enum compression_type compress_type = GZ; +enum compress_type compress_type = compress_type_gzip; const struct cmdinfo *cipaction=0; dofunction *action=0; @@ -183,11 +183,11 @@ static void setaction(const struct cmdinfo *cip, const char *value) { static void setcompresstype(const struct cmdinfo *cip, const char *value) { if (!strcmp(value, "gzip")) - compress_type= GZ; + compress_type = compress_type_gzip; else if (!strcmp(value, "bzip2")) - compress_type= BZ2; + compress_type = compress_type_bzip2; else if (!strcmp(value, "none")) - compress_type= CAT; + compress_type = compress_type_cat; else ohshit(_("unknown compression type `%s'!"), value); } diff --git a/lib/compression.c b/lib/compression.c index 5d096cf1..f761ca6a 100644 --- a/lib/compression.c +++ b/lib/compression.c @@ -34,7 +34,7 @@ fd_fd_filter(int fd_in, int fd_out, ohshite(_("%s: failed to exec '%s %s'"), desc, cmd, args); } -void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *desc, ...) { +void decompress_cat(enum compress_type type, int fd_in, int fd_out, char *desc, ...) { va_list al; struct varbuf v; @@ -45,7 +45,7 @@ void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *des va_end(al); switch(type) { - case GZ: + case compress_type_gzip: #ifdef WITH_ZLIB { char buffer[4096]; @@ -68,7 +68,7 @@ void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *des #else fd_fd_filter(fd_in, fd_out, GZIP, "gzip", "-dc", v.buf); #endif - case BZ2: + case compress_type_bzip2: #ifdef WITH_BZ2 { char buffer[4096]; @@ -93,7 +93,7 @@ void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *des #endif case compress_type_lzma: fd_fd_filter(fd_in, fd_out, LZMA, "lzma", "-dc", v.buf); - case CAT: + case compress_type_cat: fd_fd_copy(fd_in, fd_out, -1, _("%s: decompression"), v.buf); exit(0); default: @@ -101,7 +101,7 @@ void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *des } } -void compress_cat(enum compression_type type, int fd_in, int fd_out, const char *compression, char *desc, ...) { +void compress_cat(enum compress_type type, int fd_in, int fd_out, const char *compression, char *desc, ...) { va_list al; struct varbuf v; char combuf[6]; @@ -113,10 +113,11 @@ void compress_cat(enum compression_type type, int fd_in, int fd_out, const char va_end(al); if(compression == NULL) compression= "9"; - else if(*compression == '0') type = CAT; + else if (*compression == '0') + type = compress_type_cat; switch(type) { - case GZ: + case compress_type_gzip: #ifdef WITH_ZLIB { int actualread, actualwrite; @@ -151,7 +152,7 @@ void compress_cat(enum compression_type type, int fd_in, int fd_out, const char combuf[1]= *compression; fd_fd_filter(fd_in, fd_out, GZIP, "gzip", combuf, v.buf); #endif - case BZ2: + case compress_type_bzip2: #ifdef WITH_BZ2 { int actualread, actualwrite; @@ -186,7 +187,7 @@ void compress_cat(enum compression_type type, int fd_in, int fd_out, const char combuf[1]= *compression; fd_fd_filter(fd_in, fd_out, BZIP2, "bzip2", combuf, v.buf); #endif - case CAT: + case compress_type_cat: fd_fd_copy(fd_in, fd_out, -1, _("%s: compression"), v.buf); exit(0); default: diff --git a/lib/dpkg.h b/lib/dpkg.h index 46c5e432..ff3ac9ac 100644 --- a/lib/dpkg.h +++ b/lib/dpkg.h @@ -374,10 +374,15 @@ int cisalpha(int c); /*** from compression.c ***/ -enum compression_type { CAT, GZ, BZ2, compress_type_lzma }; +enum compress_type { + compress_type_cat, + compress_type_gzip, + compress_type_bzip2, + compress_type_lzma, +}; -void decompress_cat(enum compression_type type, int fd_in, int fd_out, char *desc, ...) NONRETURNING; -void compress_cat(enum compression_type type, int fd_in, int fd_out, const char *compression, char *desc, ...) NONRETURNING; +void decompress_cat(enum compress_type type, int fd_in, int fd_out, char *desc, ...) NONRETURNING; +void compress_cat(enum compress_type type, int fd_in, int fd_out, const char *compression, char *desc, ...) NONRETURNING; /*** from compat.c ***/ -- 2.39.5