Initial push
[termux-packages] / packages / apt / strutl.c.patch
1 diff -u -r ../upstream.git/apt-pkg/contrib/strutl.cc ./apt-pkg/contrib/strutl.cc
2 --- ../upstream.git/apt-pkg/contrib/strutl.cc 2014-06-18 13:17:17.000000000 +0200
3 +++ ./apt-pkg/contrib/strutl.cc 2014-07-01 16:49:25.305832759 +0200
4 @@ -35,7 +35,9 @@
5 #include <regex.h>
6 #include <errno.h>
7 #include <stdarg.h>
8 +#ifndef __ANDROID__
9 #include <iconv.h>
10 +#endif
11
12 #include <apti18n.h>
13 /*}}}*/
14 @@ -68,6 +70,7 @@
15 // UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/
16 // ---------------------------------------------------------------------
17 /* This is handy to use before display some information for enduser */
18 +#ifndef __ANDROID__
19 bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
20 {
21 iconv_t cd;
22 @@ -134,6 +137,7 @@
23
24 return true;
25 }
26 +#endif
27 /*}}}*/
28 // strstrip - Remove white space from the front and back of a string /*{{{*/
29 // ---------------------------------------------------------------------
30 @@ -375,13 +379,13 @@
31 {
32 if (ASize < 100 && I != 0)
33 {
34 - sprintf(S,"%'.1f %c",ASize,Ext[I]);
35 + sprintf(S,"%.1f %c",ASize,Ext[I]);
36 break;
37 }
38
39 if (ASize < 10000)
40 {
41 - sprintf(S,"%'.0f %c",ASize,Ext[I]);
42 + sprintf(S,"%.0f %c",ASize,Ext[I]);
43 break;
44 }
45 ASize /= 1000.0;
46 @@ -909,14 +913,16 @@
47 setlocale (LC_ALL,"C");
48 bool const invalid =
49 // Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
50 - (strptime(str, "%a, %d %b %Y %H:%M:%S %Z", &Tm) == NULL &&
51 + (strptime(str, "%a, %d %b %Y %H:%M:%S", &Tm) == NULL &&
52 // Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
53 - strptime(str, "%A, %d-%b-%y %H:%M:%S %Z", &Tm) == NULL &&
54 + strptime(str, "%A, %d-%b-%y %H:%M:%S", &Tm) == NULL &&
55 // Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
56 strptime(str, "%a %b %d %H:%M:%S %Y", &Tm) == NULL);
57 setlocale (LC_ALL,"");
58 - if (invalid == true)
59 + if (invalid == true) {
60 + if (str != NULL && strlen(str) > 1) printf("Invalid time str '%s'\n", str);
61 return false;
62 + }
63
64 time = timegm(&Tm);
65 return true;