author | tille <tille> | 2002-11-24 16:28:25 (UTC) |
---|---|---|
committer | tille <tille> | 2002-11-24 16:28:25 (UTC) |
commit | 5b029ef4b109d50ae41a3fd8bfae0b30864745f8 (patch) (unidiff) | |
tree | f5a3d81a404a57dd21c5205e70dca985bb948416 /noncore/unsupported | |
parent | 9387bc3f63b1e48c559d0758c50d9af857e7feeb (diff) | |
download | opie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.zip opie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.tar.gz opie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.tar.bz2 |
valgrind found bugs
thanks to simon
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 30 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 5 |
4 files changed, 27 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index e020601..190b3fb 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -10,84 +10,94 @@ | |||
10 | #include "package.h" | 10 | #include "package.h" |
11 | 11 | ||
12 | #include <qpe/process.h> | 12 | #include <qpe/process.h> |
13 | #include <qpe/stringutil.h> | 13 | #include <qpe/stringutil.h> |
14 | #include <qfile.h> | 14 | #include <qfile.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <stdlib.h> | 16 | #include <stdlib.h> |
17 | #include <unistd.h> | 17 | #include <unistd.h> |
18 | 18 | ||
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | 20 | ||
21 | OipkgPackage::OipkgPackage( QObject *parent, const char *name ) | 21 | OipkgPackage::OipkgPackage( QObject *parent, const char *name ) |
22 | : QObject(parent,name) | 22 | : QObject(parent,name) |
23 | { | 23 | { |
24 | 24 | init(); | |
25 | } | 25 | } |
26 | 26 | ||
27 | OipkgPackage::~OipkgPackage() | 27 | OipkgPackage::~OipkgPackage() |
28 | { | 28 | { |
29 | |||
29 | } | 30 | } |
30 | 31 | ||
31 | OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name ) | 32 | OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name ) |
32 | : QObject(parent,name) | 33 | : QObject(parent,name) |
33 | { | 34 | { |
34 | init(s); | 35 | settings = s; |
36 | init(); | ||
35 | } | 37 | } |
36 | 38 | ||
37 | void OipkgPackage::init( PackageManagerSettings *s ) | 39 | // void OipkgPackage::init( PackageManagerSettings *s ) |
40 | // { | ||
41 | // settings = s; | ||
42 | // init(); | ||
43 | // } | ||
44 | |||
45 | void OipkgPackage::init( ) | ||
38 | { | 46 | { |
39 | settings = s; | ||
40 | _size = ""; | 47 | _size = ""; |
41 | _section = ""; | 48 | _section = ""; |
42 | _subsection = ""; | 49 | _subsection = ""; |
43 | _shortDesc = ""; | 50 | _shortDesc = ""; |
44 | _desc = ""; | 51 | _desc = ""; |
45 | _name = ""; | 52 | _name = ""; |
46 | _toProcess = false; | 53 | _toProcess = false; |
47 | _useFileName = false; | 54 | _useFileName = false; |
48 | _old = false; | 55 | _old = false; |
49 | _status = ""; | 56 | _status = ""; |
50 | _dest = settings->getDestinationName(); | 57 | _dest = settings->getDestinationName(); |
51 | _link = settings->createLinks(); | 58 | _link = settings->createLinks(); |
52 | _versions=0; | 59 | _versions=0; |
53 | _version=""; | 60 | _version=""; |
54 | } | 61 | } |
55 | 62 | ||
56 | OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) | 63 | OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
57 | : QObject(parent,name) | 64 | : QObject(parent,name) |
58 | { | 65 | { |
59 | init(s); | 66 | settings = s; |
67 | init(); | ||
60 | parsePackage( pack ); | 68 | parsePackage( pack ); |
61 | } | 69 | } |
62 | 70 | ||
63 | OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) | 71 | OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
64 | : QObject(parent,name) | 72 | : QObject(parent,name) |
65 | { | 73 | { |
66 | init(s); | 74 | settings = s; |
75 | init(); | ||
67 | if ( !QFile::exists( n ) ) | 76 | if ( !QFile::exists( n ) ) |
68 | { | 77 | { |
69 | _name = QString( n ); | 78 | _name = QString( n ); |
70 | }else{ | 79 | }else{ |
71 | pvDebug(4,"remote file: "+n); | 80 | pvDebug(4,"remote file: "+n); |
72 | parseIpkgFile( n ); | 81 | parseIpkgFile( n ); |
73 | _useFileName = true; | 82 | _useFileName = true; |
74 | _fileName = QString( n ); | 83 | _fileName = QString( n ); |
75 | } | 84 | } |
76 | } | 85 | } |
77 | 86 | ||
78 | OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name ) | 87 | OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name ) |
79 | : QObject(parent,name) | 88 | : QObject(parent,name) |
80 | { | 89 | { |
81 | init(pi->settings); | 90 | settings = pi->settings; |
91 | init(); | ||
82 | copyValues( pi ); | 92 | copyValues( pi ); |
83 | } | 93 | } |
84 | 94 | ||
85 | 95 | ||
86 | void OipkgPackage::setValue( QString n, QString t ) | 96 | void OipkgPackage::setValue( QString n, QString t ) |
87 | { | 97 | { |
88 | if ( n == "Package" ) | 98 | if ( n == "Package" ) |
89 | { | 99 | { |
90 | _name = QString( t ); | 100 | _name = QString( t ); |
91 | }else if ( n == "Installed-Size" ) | 101 | }else if ( n == "Installed-Size" ) |
92 | { | 102 | { |
93 | _size = t; | 103 | _size = t; |
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 2334c31..02d8eff 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -81,20 +81,21 @@ private: | |||
81 | bool _hasVersions; | 81 | bool _hasVersions; |
82 | bool _toProcess; | 82 | bool _toProcess; |
83 | bool _link; | 83 | bool _link; |
84 | QString _status; | 84 | QString _status; |
85 | QString _size; | 85 | QString _size; |
86 | QString _section; | 86 | QString _section; |
87 | QString _subsection; | 87 | QString _subsection; |
88 | QString _shortDesc; | 88 | QString _shortDesc; |
89 | QString _desc; | 89 | QString _desc; |
90 | QString _version; | 90 | QString _version; |
91 | QString _dest; | 91 | QString _dest; |
92 | QDict<QString> _values; | 92 | QDict<QString> _values; |
93 | QDict<OipkgPackage> *_versions; | 93 | QDict<OipkgPackage> *_versions; |
94 | bool _useFileName; | 94 | bool _useFileName; |
95 | void parsePackage( QStringList ); | 95 | void parsePackage( QStringList ); |
96 | void init(PackageManagerSettings *); | 96 | void init(); |
97 | // void init(PackageManagerSettings*); | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | 100 | ||
100 | #endif | 101 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 5f79ec1..6f0b56f 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -197,24 +197,25 @@ void PackageList::readFileEntries( QString filename, QString dest ) | |||
197 | //there might be no nl at the end of the package file | 197 | //there might be no nl at the end of the package file |
198 | if ( ! packEntry.isEmpty() ) | 198 | if ( ! packEntry.isEmpty() ) |
199 | { | 199 | { |
200 | OipkgPackage *p = new OipkgPackage( packEntry, settings ); | 200 | OipkgPackage *p = new OipkgPackage( packEntry, settings ); |
201 | if ( p ) | 201 | if ( p ) |
202 | { | 202 | { |
203 | p->setDest( dest ); | 203 | p->setDest( dest ); |
204 | insertPackage( p ); | 204 | insertPackage( p ); |
205 | packEntry.clear(); | 205 | packEntry.clear(); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | delete statusStream; | 208 | delete statusStream; |
209 | f.close(); | ||
209 | return; | 210 | return; |
210 | } | 211 | } |
211 | 212 | ||
212 | void PackageList::setSettings( PackageManagerSettings *s ) | 213 | void PackageList::setSettings( PackageManagerSettings *s ) |
213 | { | 214 | { |
214 | settings = s; | 215 | settings = s; |
215 | } | 216 | } |
216 | 217 | ||
217 | OipkgPackage* PackageList::getByName( QString n ) | 218 | OipkgPackage* PackageList::getByName( QString n ) |
218 | { | 219 | { |
219 | return origPackageList[n]; | 220 | return origPackageList[n]; |
220 | } | 221 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 51d024b..1610a37 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -35,30 +35,31 @@ PackageListItem::PackageListItem(QListView* lv, OipkgPackage *pi, PackageManager | |||
35 | :ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package) | 35 | :ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package) |
36 | { | 36 | { |
37 | init(pi,s); | 37 | init(pi,s); |
38 | } | 38 | } |
39 | 39 | ||
40 | PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s) | 40 | PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s) |
41 | :ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package) | 41 | :ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package) |
42 | { | 42 | { |
43 | init(pi,s); | 43 | init(pi,s); |
44 | } | 44 | } |
45 | PackageListItem::~PackageListItem() | 45 | PackageListItem::~PackageListItem() |
46 | { | 46 | { |
47 | delete popupMenu; | 47 | delete popupMenu; |
48 | delete destsMenu; | 48 | delete destsMenu; |
49 | } | 49 | } |
50 | 50 | ||
51 | void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s) | 51 | void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s) |
52 | { | 52 | { |
53 | //waring pass something different than 0 | ||
53 | popupMenu = new QPopupMenu( 0 ); | 54 | popupMenu = new QPopupMenu( 0 ); |
54 | destsMenu = new QPopupMenu( 0 ); | 55 | destsMenu = new QPopupMenu( 0 ); |
55 | package = pi; | 56 | package = pi; |
56 | settings = s; | 57 | settings = s; |
57 | setExpandable( true ); | 58 | setExpandable( true ); |
58 | ListViewItemOipkg *item; | 59 | ListViewItemOipkg *item; |
59 | nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" ); | 60 | nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" ); |
60 | item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() ); | 61 | item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() ); |
61 | item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() ); | 62 | item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() ); |
62 | destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" ); | 63 | destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" ); |
63 | linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" ); | 64 | linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" ); |
64 | statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" ); | 65 | statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" ); |