summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr49938.C
blob: d2c73e73871a330fca3e96372a2abc0bda7355a3 (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
#include <vector>
#include <cstdlib>
typedef unsigned short uint16;

namespace base {
    class StringPiece
      {
    public:
	typedef std::size_t size_type;
	size_type size() const { return length_; }
	size_type length_;
      };
}

namespace net {
    class DNSSECKeySet
      {
	bool CheckSignature (const base::StringPiece& name, const
			     base::StringPiece& zone, const
			     base::StringPiece& signature, uint16 rrtype,
			     const std::vector<base::StringPiece>& rrdatas);
      };
}

template <class C> class scoped_array
{
public: typedef C element_type;
	explicit scoped_array(C* p = __null):array_(p) {}
private:   C* array_;
};

namespace net {
    bool DNSSECKeySet::CheckSignature (const base::StringPiece& name,
				       const base::StringPiece& zone, const base::StringPiece& signature,
				       uint16 rrtype, const std::vector<base::StringPiece>& rrdatas)
      {
	unsigned signed_data_len = 0;
	for (std::vector<base::StringPiece>::const_iterator i =
	     rrdatas.begin();
	     i != rrdatas.end(); i++) {
	    signed_data_len += 2;
	    signed_data_len += i->size();
	}
	scoped_array<unsigned char> signed_data(new unsigned
						char[signed_data_len]);

	return true;
      }
}