summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index a991b8988..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;
@@ -304,13 +315,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;