(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-12 Guillem Jover <guillem@debian.org>
+
+ * 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 <guillem@debian.org>
* lib/compression.c (fd_fd_filter): New function, refactored. As
/* 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);
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,
extern const char *compression;
extern const char* showformat;
-extern enum compression_type compress_type;
+extern enum compress_type compress_type;
#define DEBMAGIC "!<arch>\ndebian-binary "
#define ADMINMEMBER "control.tar.gz "
#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"));
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;
} 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);
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;
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);
}
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;
va_end(al);
switch(type) {
- case GZ:
+ case compress_type_gzip:
#ifdef WITH_ZLIB
{
char buffer[4096];
#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];
#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:
}
}
-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];
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;
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;
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:
/*** 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 ***/