]> git.saurik.com Git - apt.git/blob - apt-pkg/tagfile-compat.cc
tests: don't do boundless string compares with data()
[apt.git] / apt-pkg / tagfile-compat.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: tagfile.cc,v 1.37.2.2 2003/12/31 16:02:30 mdz Exp $
4 /* ######################################################################
5
6 Fast scanner for RFC-822 type header information
7
8 This uses a rotating buffer to load the package information into.
9 The scanner runs over it and isolates and indexes a single section.
10
11 This defines compat functions for the external code.
12
13 ##################################################################### */
14 /*}}}*/
15
16 #include<config.h>
17 #define APT_COMPILING_TAGFILE_COMPAT_CC
18 #include <apt-pkg/tagfile.h>
19
20 using std::string;
21 using APT::StringView;
22
23
24 bool pkgTagSection::Exists(const char* const Tag) const
25 {
26 return Exists(StringView(Tag));
27 }
28
29 bool pkgTagSection::Find(const char *Tag,unsigned int &Pos) const
30 {
31 return Find(StringView(Tag), Pos);
32 }
33
34 bool pkgTagSection::Find(const char *Tag,const char *&Start,
35 const char *&End) const
36 {
37 return Find(StringView(Tag), Start, End);
38 }
39
40 string pkgTagSection::FindS(const char *Tag) const
41 {
42 return Find(StringView(Tag)).to_string();
43 }
44
45 string pkgTagSection::FindRawS(const char *Tag) const
46 {
47 return FindRaw(StringView(Tag)).to_string();
48 }
49
50 signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
51 {
52 return FindI(StringView(Tag), Default);
53 }
54
55 unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const
56 {
57 return FindULL(StringView(Tag), Default);
58 }
59 /*}}}*/
60
61 bool pkgTagSection::FindB(const char *Tag, bool const &Default) const
62 {
63 return FindB(StringView(Tag), Default);
64 }
65
66 bool pkgTagSection::FindFlag(const char * const Tag, uint8_t &Flags,
67 uint8_t const Flag) const
68 {
69 return FindFlag(StringView(Tag), Flags, Flag);
70 }
71
72 bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
73 unsigned long Flag) const
74 {
75 return FindFlag(StringView(Tag), Flags, Flag);
76 }