Browse Source

* 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.

Guillem Jover 17 years ago
parent
commit
b0fe0b8d43
7 changed files with 50 additions and 27 deletions
  1. 11 0
      ChangeLog
  2. 12 6
      dpkg-deb/build.c
  3. 1 1
      dpkg-deb/dpkg-deb.h
  4. 4 4
      dpkg-deb/extract.c
  5. 4 4
      dpkg-deb/main.c
  6. 10 9
      lib/compression.c
  7. 8 3
      lib/dpkg.h

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+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

+ 12 - 6
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,

+ 1 - 1
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     "!<arch>\ndebian-binary   "
 #define ADMINMEMBER		"control.tar.gz  "

+ 4 - 4
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);

+ 4 - 4
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);
 }

+ 10 - 9
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:

+ 8 - 3
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 ***/