summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/version.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/version.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/version.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/version.cpp b/noncore/settings/aqpkg/version.cpp
index 59e6f3f..ce2de7b 100644
--- a/noncore/settings/aqpkg/version.cpp
+++ b/noncore/settings/aqpkg/version.cpp
@@ -1,89 +1,89 @@
1/* 1/*
2 * libdpkg - Debian packaging suite library routines 2 * libdpkg - Debian packaging suite library routines
3 * vercmp.c - comparison of version numbers 3 * vercmp.c - comparison of version numbers
4 * 4 *
5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> 5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
6 * 6 *
7 * This is free software; you can redistribute it and/or modify 7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as 8 * it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2, 9 * published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version. 10 * or (at your option) any later version.
11 * 11 *
12 * This is distributed in the hope that it will be useful, but 12 * This is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU General Public 17 * You should have received a copy of the GNU General Public
18 * License along with dpkg; if not, write to the Free Software 18 * License along with dpkg; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h> 22#include <stdlib.h>
23#include <ctype.h> 23#include <ctype.h>
24#include <string.h> 24#include <string.h>
25 25
26#include <qobject.h> 26#include <qobject.h>
27 27
28//# define _(Text) Text 28//# define _(Text) Text
29 29
30class versionrevision 30class versionrevision
31{ 31{
32public: 32public:
33 versionrevision() 33 versionrevision()
34 { 34 {
35 version = 0; 35 version = 0;
36 } 36 }
37 37
38 ~versionrevision() 38 ~versionrevision()
39 { 39 {
40 if ( version ) 40 if ( version )
41 delete version; 41 delete [] version;
42 } 42 }
43 43
44 void setVersion( const char *str ) 44 void setVersion( const char *str )
45 { 45 {
46 version = new char[(strlen(str)+1)]; 46 version = new char[(strlen(str)+1)];
47 strcpy( version, str ); 47 strcpy( version, str );
48 } 48 }
49 49
50 unsigned long epoch; 50 unsigned long epoch;
51 char *version; 51 char *version;
52 const char *revision; 52 const char *revision;
53 const char *familiar_revision; 53 const char *familiar_revision;
54}; 54};
55 55
56static int verrevcmp(const char *val, const char *ref) 56static int verrevcmp(const char *val, const char *ref)
57{ 57{
58 int vc, rc; 58 int vc, rc;
59 long vl, rl; 59 long vl, rl;
60 const char *vp, *rp; 60 const char *vp, *rp;
61 61
62 if (!val) val= ""; 62 if (!val) val= "";
63 if (!ref) ref= ""; 63 if (!ref) ref= "";
64 for (;;) { 64 for (;;) {
65 vp= val; while (*vp && !isdigit(*vp)) vp++; 65 vp= val; while (*vp && !isdigit(*vp)) vp++;
66 rp= ref; while (*rp && !isdigit(*rp)) rp++; 66 rp= ref; while (*rp && !isdigit(*rp)) rp++;
67 for (;;) { 67 for (;;) {
68 vc= val == vp ? 0 : *val++; 68 vc= val == vp ? 0 : *val++;
69 rc= ref == rp ? 0 : *ref++; 69 rc= ref == rp ? 0 : *ref++;
70 if (!rc && !vc) break; 70 if (!rc && !vc) break;
71 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */ 71 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */
72 if (rc && !isalpha(rc)) rc += 256; 72 if (rc && !isalpha(rc)) rc += 256;
73 if (vc != rc) return vc - rc; 73 if (vc != rc) return vc - rc;
74 } 74 }
75 val= vp; 75 val= vp;
76 ref= rp; 76 ref= rp;
77 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10); 77 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
78 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10); 78 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
79 if (vl != rl) return vl - rl; 79 if (vl != rl) return vl - rl;
80 if (!*val && !*ref) return 0; 80 if (!*val && !*ref) return 0;
81 if (!*val) return -1; 81 if (!*val) return -1;
82 if (!*ref) return +1; 82 if (!*ref) return +1;
83 } 83 }
84} 84}
85 85
86int versioncompare(const struct versionrevision *version, 86int versioncompare(const struct versionrevision *version,
87 const struct versionrevision *refversion) 87 const struct versionrevision *refversion)
88{ 88{
89 int r; 89 int r;