[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Release-critical Bugreport for June 23, 2000



On Fri, Jun 23, 2000 at 01:21:00PM +0200, Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> was heard to say:
> Please use string::size_type to refer to a position in a string.

  Ok, I believe that this patch should fix the 64-bitness problems observed
on the Alpha.  If someone could verify that, it would be great, but I think
I did exactly what you said to do, and it even still compiles :).  AT: if
this patch can't be applied before the next test cycle, aptitude should
probably be removed from the Alpha distribution if possible..

  The CVS tree still has the bug, I'll address it when I finish the current
rewrite -- some of the bad code may just be thrown out anyway, in which case
I don't have to think about it :-)

   Thanks for hunting this one down,
  Daniel

-- 
/----------------- Daniel Burrows <Daniel_Burrows@brown.edu> -----------------\
|  f u cn rd ths,  |  "Oh my god!  The entire map is written in GIBBERISH!"   |
|  u cn gt a jb s  |  "Worse, my friend.  It's written in German!" -- Fluble  |
| a cmptr prgrmr.  |                                                          |
\-------- Classes are first-class objects. -- http://www.python.org ----------/
diff -ru aptitude-0.0.4a.orig/src/apt.cc aptitude-0.0.4a/src/apt.cc
--- aptitude-0.0.4a.orig/src/apt.cc	Tue Dec 28 11:54:44 1999
+++ aptitude-0.0.4a/src/apt.cc	Sun Jun 25 10:50:39 2000
@@ -92,7 +92,7 @@
 	_error->Error("Invalid entry in keybinding group: \"%s\"", i->Value.c_str());
       else
 	{
-	  unsigned int split=0,newsplit;
+	  string::size_type split=0,newsplit;
 	  keybinding newbinding;
 	  do
 	    {
diff -ru aptitude-0.0.4a.orig/src/curses++.cc aptitude-0.0.4a/src/curses++.cc
--- aptitude-0.0.4a.orig/src/curses++.cc	Mon Jan 10 17:14:57 2000
+++ aptitude-0.0.4a/src/curses++.cc	Sun Jun 25 10:52:03 2000
@@ -99,7 +99,7 @@
       if(i==size1)
 	attrset(attr2);
 
-      if(((unsigned int) i)<s.size())
+      if(((string::size_type) i)<s.size())
 	// -- make the compiler happy about signed and unsigned stuff.
 	addch(s[i]);
       else
diff -ru aptitude-0.0.4a.orig/src/pkg_description_treeitem.cc aptitude-0.0.4a/src/pkg_description_treeitem.cc
--- aptitude-0.0.4a.orig/src/pkg_description_treeitem.cc	Fri Jan  7 17:21:26 2000
+++ aptitude-0.0.4a/src/pkg_description_treeitem.cc	Sun Jun 25 10:51:11 2000
@@ -26,7 +26,7 @@
 pkg_description::pkg_description(pkgCache::VerIterator ver, const string &_title):title(_title)
 {
   string long_desc=apt_package_records->Lookup(ver.FileList()).LongDesc();
-  unsigned int start=0, nextnl=long_desc.find('\n',start);
+  string::size_type start=0, nextnl=long_desc.find('\n',start);
 
   if(nextnl!=string::npos)
     {
diff -ru aptitude-0.0.4a.orig/src/pkg_tree.cc aptitude-0.0.4a/src/pkg_tree.cc
--- aptitude-0.0.4a.orig/src/pkg_tree.cc	Mon Jan 10 10:32:45 2000
+++ aptitude-0.0.4a/src/pkg_tree.cc	Sun Jun 25 10:53:00 2000
@@ -243,14 +243,14 @@
       else if((*apt_cache_file)->UsrSize()<0)
 	sizeinf+="Will Free "+SizeToStr((*apt_cache_file)->UsrSize())+"B of disk space";
 
-      unsigned int start_sizeinf=width-sizeinf.size();
+      string::size_type start_sizeinf=width-sizeinf.size();
       if(start_sizeinf<=get_header().size())
 	start_sizeinf=get_header().size()+1;
 
       attrset(COLOR_PAIR(get_header_color())|A_BOLD);
       mvaddnstr(0, 0, get_header().c_str(), width);
 
-      for(unsigned int i=get_header().size(); i<(unsigned) width && i<start_sizeinf; i++)
+      for(string::size_type i=get_header().size(); i<(string::size_type) width && i<start_sizeinf; i++)
 	// Yuck.  Let one unsigned into your code and you'll never hear the end
 	// of it >=)
 	addch(' ');
@@ -258,7 +258,7 @@
       if(start_sizeinf<(unsigned) width)
 	{
 	  mvaddnstr(0, start_sizeinf, sizeinf.c_str(), width-start_sizeinf);
-	  for(unsigned int i=start_sizeinf+sizeinf.size(); i<(unsigned) width; i++)
+	  for(string::size_type i=start_sizeinf+sizeinf.size(); i<(string::size_type) width; i++)
 	    addch(' ');
 	}
     }
diff -ru aptitude-0.0.4a.orig/src/vs_staticitem.cc aptitude-0.0.4a/src/vs_staticitem.cc
--- aptitude-0.0.4a.orig/src/vs_staticitem.cc	Mon Jan 10 08:21:43 2000
+++ aptitude-0.0.4a/src/vs_staticitem.cc	Sun Jun 25 10:53:12 2000
@@ -36,7 +36,7 @@
     return;
 
   win->addnstr(name.c_str(), width-basex-1);
-  if((basex+name.size())>(unsigned) width)
+  if((basex+name.size())>(string::size_type) width)
     return;
 
   win->attroff(A_BOLD);

Reply to: