From 09fab2442c2ab9a503841d3dcd56b3c0c3efb502 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 9 Apr 2009 04:36:34 +0200 Subject: * apt-pkg/contrib/strutl.cc: - fix TimeToStr i18n (LP: #289807) * [ABI break] merge support for http redirects, thanks to Jeff Licquia and Anthony Towns * [ABI break] use int for the package IDs (thanks to Steve Cotton) * apt-pkg/pkgcache.cc: - do not run "dpkg --configure pkg" if pkg is in trigger-awaited state (LP: #322955) * methods/https.cc: - add Acquire::https::AllowRedirect support * Clarify the --help for 'purge' (LP: #243948) * cmdline/apt-get.cc - fix "apt-get source pkg" if there is a binary package and a source package of the same name but from different packages (LP: #330103) * cmdline/acqprogress.cc: - Call pkgAcquireStatus::Pulse even if quiet, so that we still get dlstatus messages on the status-fd (LP: #290234). --- apt-pkg/contrib/strutl.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'apt-pkg/contrib/strutl.cc') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index bd374fd1e..a69cf01ec 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -331,23 +331,27 @@ string TimeToStr(unsigned long Sec) { if (Sec > 60*60*24) { - sprintf(S,"%lid %lih%limin%lis",Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60); + //d means days, h means hours, min means minutes, s means seconds + sprintf(S,_("%lid %lih %limin %lis"),Sec/60/60/24,(Sec/60/60) % 24,(Sec/60) % 60,Sec % 60); break; } if (Sec > 60*60) { - sprintf(S,"%lih%limin%lis",Sec/60/60,(Sec/60) % 60,Sec % 60); + //h means hours, min means minutes, s means seconds + sprintf(S,_("%lih %limin %lis"),Sec/60/60,(Sec/60) % 60,Sec % 60); break; } if (Sec > 60) { - sprintf(S,"%limin%lis",Sec/60,Sec % 60); + //min means minutes, s means seconds + sprintf(S,_("%limin %lis"),Sec/60,Sec % 60); break; } - - sprintf(S,"%lis",Sec); + + //s means seconds + sprintf(S,_("%lis"),Sec); break; } -- cgit v1.2.3 From fa3b09450ed3da175f619ca77d9dceb9a6f81972 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Jun 2009 18:23:07 +0200 Subject: merge r1797 from lp:~donkult/apt/experimental --- apt-pkg/contrib/strutl.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'apt-pkg/contrib/strutl.cc') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index a69cf01ec..61c582b85 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -387,6 +387,17 @@ string SubstVar(string Str,const struct SubstVar *Vars) return Str; } /*}}}*/ +// OutputInDepth - return a string with separator multiplied with depth /*{{{*/ +// --------------------------------------------------------------------- +/* Returns a string with the supplied separator depth + 1 times in it */ +std::string OutputInDepth(const unsigned long Depth, const char* Separator) +{ + std::string output = ""; + for(unsigned long d=Depth+1; d > 0; d--) + output.append(Separator); + return output; +} + /*}}}*/ // URItoFileName - Convert the uri into a unique file name /*{{{*/ // --------------------------------------------------------------------- /* This converts a URI into a safe filename. It quotes all unsafe characters -- cgit v1.2.3 From d95cf70db1c0cc7d80d862b826ea67ac70c3e92d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 31 Jul 2009 20:42:06 +0200 Subject: [apt-pkg/contrib/strutl.cc] enable thousand separator according to the current locale. Patch from Luca Bruno (Closes: #223712) --- apt-pkg/contrib/strutl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib/strutl.cc') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index a991b8988..1683868c8 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -304,13 +304,13 @@ string SizeToStr(double Size) { if (ASize < 100 && I != 0) { - sprintf(S,"%.1f%c",ASize,Ext[I]); + sprintf(S,"%'.1f%c",ASize,Ext[I]); break; } if (ASize < 10000) { - sprintf(S,"%.0f%c",ASize,Ext[I]); + sprintf(S,"%'.0f%c",ASize,Ext[I]); break; } ASize /= 1000.0; -- cgit v1.2.3 From 1f99b6d338186efe80e314268db44600d3c94a1e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 8 Sep 2009 09:47:12 +0200 Subject: replace unknown multibytes with ? in UTF8ToCharset (Closes: #545208) instead of ignoring the returncode and truncating the string on error --- apt-pkg/contrib/strutl.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib/strutl.cc') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 1683868c8..4c05f2df8 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -67,9 +67,20 @@ bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest) outbuf = new char[insize+1]; outptr = outbuf; - iconv(cd, &inptr, &insize, &outptr, &outsize); - *outptr = '\0'; + while (insize != 0) + { + size_t const err = iconv(cd, &inptr, &insize, &outptr, &outsize); + if (err == (size_t)(-1)) + { + insize--; + outsize++; + inptr++; + *outptr = '?'; + outptr++; + } + } + *outptr = '\0'; *dest = outbuf; delete[] outbuf; -- cgit v1.2.3