blob: c48f3f5945f3148f6b4a7eeaf80ace4e80973f46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include <string>
/*void basic_string<char,string_char_traits<char>,alloc>::Rep::release()
{
cout << "Release " << (void *)this << ' ' << ref << endl;
if (--ref == 0) delete this;
}
basic_string<char,string_char_traits<char>,alloc>::~basic_string()
{
cout << "Destroy " << (void *)this << ',' << rep()->ref << endl;
rep ()->release ();
}*/
#include <apt-pkg/tagfile.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
#include <signal.h>
#include <stdio.h>
#include <malloc.h>
struct Rep
{
size_t len, res, ref;
bool selfish;
};
int main(int argc,char *argv[])
{
pkgCacheFile Cache;
OpProgress Prog;
pkgInitialize(*_config);
if (Cache.Open(Prog,false) == false)
{
_error->DumpErrors();
return 0;
}
pkgRecords rec(*Cache);
while (1)
{
pkgCache::VerIterator V = (*Cache)[Cache->PkgBegin()].CandidateVerIter(*Cache);
pkgRecords::Parser &Parse = rec.Lookup(V.FileList());
string Foo = Parse.ShortDesc();
cout << (reinterpret_cast<Rep *>(Foo.begin()) - 1)[0].ref << endl;
// cout << Foo << endl;
// cout << rec.Lookup(V.FileList()).ShortDesc() << endl;
malloc_stats();
}
#if 0
URI U(argv[1]);
cout << U.Access << endl;
cout << U.User << endl;
cout << U.Password << endl;
cout << U.Host << endl;
cout << U.Path << endl;
cout << U.Port << endl;
/*
FileFd F(argv[1],FileFd::ReadOnly);
pkgTagFile Reader(F);
pkgTagSection Sect;
while (Reader.Step(Sect) == true)
{
Sect.FindS("Package");
Sect.FindS("Section");
Sect.FindS("Version");
Sect.FindI("Size");
};*/
#endif
return 0;
}
|