RFC: [PATCH] Simplify installed.db format (take 3)

Igor Peshansky pechtcha@cs.nyu.edu
Mon Jan 23 15:08:00 GMT 2006


On Mon, 23 Jan 2006, Buzz wrote:

> Op Sun, 22 Jan 2006 23:28:04 -0500 (EST) schreef Igor Peshansky
> in <Pine.GSO.4.63.0601222324410.18707<at>access1.cims.nyu.edu>:
>
> :  On Sun, 22 Jan 2006, Igor Peshansky wrote:
>
> : > The attached patch fixes the parsing of installed.db package lines.
> : > Comments welcome.
>
> +		  sscanf (line, "%s %s", pkgname, inst);
>
> Won't this parse the `` 0'' into ``inst''? Did you mean
>
> +		  sscanf (line, "%s %s ", pkgname, inst);
>
> perhaps?

Umm, yes, good point.  In fact, let's use the attached patch instead.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"
-------------- next part --------------
Index: setup/cygpackage.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/cygpackage.cc,v
retrieving revision 2.15
diff -u -p -r2.15 cygpackage.cc
--- setup/cygpackage.cc	14 May 2005 15:57:29 -0000	2.15
+++ setup/cygpackage.cc	23 Jan 2006 15:06:52 -0000
@@ -66,7 +66,7 @@ cygpackage::createInstance (const String
 
 packageversion
 cygpackage::createInstance (String const &pkgname, String const &filename,
-			    size_t const fs, String const &version,
+			    String const &version,
 			    package_status_t const newstatus,
 			    package_type_t const newtype)
 {
@@ -75,7 +75,6 @@ cygpackage::createInstance (String const
   temp->fn = filename;
   temp->status = newstatus;
   temp->type = newtype;
-  temp->filesize = fs;
   temp->setCanonicalVersion (version);
   return packageversion(temp);
 }
Index: setup/cygpackage.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/cygpackage.h,v
retrieving revision 2.15
diff -u -p -r2.15 cygpackage.h
--- setup/cygpackage.h	14 May 2005 15:57:29 -0000	2.15
+++ setup/cygpackage.h	23 Jan 2006 15:06:52 -0000
@@ -72,7 +72,7 @@ public:
                                         const package_type_t type);
 
   static packageversion createInstance (String const &, String const &, 
-					size_t const, String const &,
+					String const &,
 					package_status_t const, 
 					package_type_t const);
 
@@ -92,7 +92,6 @@ private:
   package_type_t type;
 
   io_stream *listdata, *listfile;
-  size_t filesize;
 };
 
 #endif /* SETUP_CYGPACKAGE_H */
Index: setup/package_db.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_db.cc,v
retrieving revision 2.30
diff -u -p -r2.30 package_db.cc
--- setup/package_db.cc	14 Oct 2005 04:10:26 -0000	2.30
+++ setup/package_db.cc	23 Jan 2006 15:06:53 -0000
@@ -57,8 +57,8 @@ packagedb::packagedb ()
       if (!db)
 	return;
       /* flush_local_db_package_data */
-      char line[1000], pkgname[1000], inst[1000], src[1000];
-      int instsz, srcsz;
+      char line[1000], pkgname[1000], inst[1000];
+      int instsz;
 
       if (db->gets (line, 1000))
 	{
@@ -80,14 +80,11 @@ packagedb::packagedb ()
 	      while (db->gets (line, 1000))
 		{
 		  int parseable;
-		  src[0] = '\0';
+		  int ign;
 		  pkgname[0] = '\0';
 		  inst[0] = '\0';
-		  srcsz = 0;
-		  instsz = 0;
 
-		  sscanf (line, "%s %s %d %s %d", pkgname, inst, &instsz, src,
-			  &srcsz);
+		  sscanf (line, "%s %s %d", pkgname, inst, &ign);
 
 		  if (pkgname[0] == '\0' || inst[0] == '\0')
 			continue;
@@ -109,7 +106,7 @@ packagedb::packagedb ()
 		    }
 
 		  packageversion binary = 
-		    cygpackage::createInstance (pkgname, inst, instsz, f.ver,
+		    cygpackage::createInstance (pkgname, inst, f.ver,
 	    					package_installed,
 	    					package_binary);
 


More information about the Cygwin-apps mailing list