This file is indexed.

/usr/include/eiskaltdcpp/dcpp/Wildcards.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
// Copyright (C) 1996 - 2002 Florian Schintke
// Modified 2002 by Opera, opera@home.se
//
// This 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, or (at your option) any later
// version.
//
// Thanks to the E.S.O. - ACS project that has done this C++ interface
// to the wildcards pttern matching algorithm

#pragma once

#include "StringTokenizer.h"
#include "Util.h"
#include "Text.h"

// Implementation of the UN*X wildcards
// Supported wild-characters: '*', '?'; sets: [a-z], '!' negation
// Examples:
//       '[a-g]l*i?n' matches 'florian'
//       '[!abc]*e' matches 'smile'
//       '[-z] matches 'a'

class Wildcard
{
    public:
        // This function implements the UN*X wildcards and returns:
        // 0 - if *wildcard does not match *test
        // 1 - if *wildcard matches *test
        static int wildcardfit(const char *wildcard, const char *test, bool useSet = true);
        static int wildcardfit(const wchar_t *wildcard, const wchar_t *test, bool useSet = true);

        // Checks whether a text matches a pattern
        static bool patternMatch(const std::string& text, const std::string& pattern, bool useSet = true);
        static bool patternMatch(const std::wstring& text, const std::wstring& pattern, bool useSet = true);

        // Checks whether a text matches any pattern in a patternlist
        static bool patternMatch(const std::string& text, const std::string& patternlist, char delimiter, bool useSet = true);
        static bool patternMatch(const std::wstring& text, const std::wstring& patternlist, wchar_t delimiter, bool useSet = true);

    private:
        // Scans a set of characters and returns 0 if the set mismatches at this
        // position in the teststring and 1 if it is matching
        // wildcard is set to the closing ] and test is unmodified if mismatched
        // and otherwise the char pointer is pointing to the next character
        static int set(const char **wildcard, const char **test);
        static int set(const wchar_t **wildcard, const wchar_t **test);

        // Scans an asterisk
        static int asterisk(const char **wildcard, const char **test);
        static int asterisk(const wchar_t **wildcard, const wchar_t **test);
};