This file is indexed.

/usr/include/eiskaltdcpp/dcpp/SimpleXMLReader.h is in libeiskaltdcpp-dev 2.2.9-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "typedefs.h"

namespace dcpp {

class InputStream;

class SimpleXMLReader {
public:
    struct CallBack : private boost::noncopyable {
        virtual ~CallBack() { }
        virtual void startTag(const std::string& name, StringPairList& attribs, bool simple) = 0;
        virtual void endTag(const std::string& name, const std::string& data) = 0;

    protected:
        static const std::string& getAttrib(dcpp::StringPairList& attribs, const std::string& name, size_t hint);
    };

    SimpleXMLReader(CallBack* callback);
    virtual ~SimpleXMLReader() { }

    void parse(InputStream& is, size_t maxSize = 0);
    bool parse(const char* data, size_t len, bool more);
private:

    static const size_t MAX_NAME_SIZE = 256;
    static const size_t MAX_VALUE_SIZE = 64*1024;
    static const size_t MAX_NESTING = 32;

    enum ParseState {
        /// Start of document
        STATE_START,

        /// In <?xml declaration, expect version
        STATE_DECL_VERSION,

        /// In <?xml declaration, expect =
        STATE_DECL_VERSION_EQ,

        /// In <?xml declaration, expect version number
        STATE_DECL_VERSION_NUM,

        /// In <?xml declaration, expect encoding
        STATE_DECL_ENCODING,

        /// In <?xml declaration, expect =
        STATE_DECL_ENCODING_EQ,

        /// In <?xml declaration, expect encoding name
        STATE_DECL_ENCODING_NAME,

        STATE_DECL_ENCODING_NAME_APOS,

        STATE_DECL_ENCODING_NAME_QUOT,

        /// in <?xml declaration, expect standalone
        STATE_DECL_STANDALONE,

        /// in <?xml declaration, expect =
        STATE_DECL_STANDALONE_EQ,

        /// in <?xml declaration, expect standalone yes
        STATE_DECL_STANDALONE_YES,

        /// In <?xml declaration, expect %>
        STATE_DECL_END,

        /// In < element, expect element name
        STATE_ELEMENT_NAME,

        /// In < element, expect attribute or element end
        STATE_ELEMENT_ATTR,

        /// In < element, in attribute name
        STATE_ELEMENT_ATTR_NAME,

        /// In < element, expect %
        STATE_ELEMENT_ATTR_EQ,

        /// In < element, waiting for attribute value start
        STATE_ELEMENT_ATTR_VALUE,

        STATE_ELEMENT_ATTR_VALUE_QUOT,

        STATE_ELEMENT_ATTR_VALUE_APOS,

        STATE_ELEMENT_END_SIMPLE,

        STATE_ELEMENT_END,

        STATE_ELEMENT_END_END,

        /// In <!-- comment field
        STATE_COMMENT,

        STATE_CONTENT,

        STATE_END
    };


    std::string buf;
    std::string::size_type bufPos;
    uint64_t pos;

    dcpp::StringPairList attribs;
    std::string value;

    CallBack* cb;
    std::string encoding;

    ParseState state;

    dcpp::StringList elements;

    void append(std::string& str, size_t maxLen, int c);
    void append(std::string& str, size_t maxLen, std::string::const_iterator begin, std::string::const_iterator end);

    bool needChars(size_t n) const;
    int charAt(size_t n) const;
    bool skipSpace(bool store = false);
    void advancePos(size_t n = 1);
    std::string::size_type bufSize() const;

    bool literal(const char* lit, size_t len, bool withSpace, ParseState newState);
    bool character(int c, ParseState newState);

    bool declVersionNum();
    bool declEncodingValue();

    bool element();
    bool elementName();
    bool elementEnd();
    bool elementEndEnd();
    bool elementEndSimple();
    bool elementEndComplex();
    bool elementAttr();
    bool elementAttrName();
    bool elementAttrValue();

    bool comment();

    bool content();

    bool entref(std::string& d);

    bool process();
    bool spaceOrError(const char* error);

    bool error(const char* message);
};

}