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