From: Arch Librarian Date: Mon, 20 Sep 2004 17:01:46 +0000 (+0000) Subject: - Clean up some string handling, patch from Peter Lundkvist X-Git-Tag: 0.7.24ubuntu1~741 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/d48c6a7dd41a43a3753b8d15ba0a9deac4526cc5 - Clean up some string handling, patch from Peter Lundkvist Author: mdz Date: 2003-07-18 14:15:11 GMT - Clean up some string handling, patch from Peter Lundkvist (Closes: #192225) --- diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index 27d4d9ba4..b423eb4cb 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: arfile.cc,v 1.5 2003/02/10 00:36:12 doogie Exp $ +// $Id: arfile.cc,v 1.6 2003/07/18 14:15:11 mdz Exp $ /* ###################################################################### AR File - Handle an 'AR' archive @@ -115,7 +115,7 @@ bool ARArchive::LoadHeaders() { unsigned int I = sizeof(Head.Name) - 1; for (; Head.Name[I] == ' '; I--); - Memb->Name = string(Head.Name,0,I+1); + Memb->Name = string(Head.Name,I+1); } // Account for the AR header alignment diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 4987307be..a75fbdf92 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: strutl.cc,v 1.47 2003/02/02 22:20:27 jgg Exp $ +// $Id: strutl.cc,v 1.48 2003/07/18 14:15:11 mdz Exp $ /* ###################################################################### String Util - Some useful string functions. @@ -652,7 +652,7 @@ bool ReadMessages(int Fd, vector &List) continue; // Pull the message out - string Message(Buffer,0,I-Buffer); + string Message(Buffer,I-Buffer); // Fix up the buffer for (; I < End && *I == '\n'; I++); @@ -1045,7 +1045,7 @@ void URI::CopyFrom(string U) Path = "/"; // Now we attempt to locate a user:pass@host fragment - if (FirstColon[1] == '/' && FirstColon[2] == '/') + if (FirstColon + 2 <= U.end() && FirstColon[1] == '/' && FirstColon[2] == '/') FirstColon += 3; else FirstColon += 1;