| 1 |
// { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } |
| 2 |
#include <vector> |
| 3 |
#include <cstdlib> |
| 4 |
typedef unsigned short uint16; |
| 5 |
|
| 6 |
namespace base { |
| 7 |
class StringPiece |
| 8 |
{ |
| 9 |
public: |
| 10 |
typedef std::size_t size_type; |
| 11 |
size_type size() const { return length_; } |
| 12 |
size_type length_; |
| 13 |
}; |
| 14 |
} |
| 15 |
|
| 16 |
namespace net { |
| 17 |
class DNSSECKeySet |
| 18 |
{ |
| 19 |
bool CheckSignature (const base::StringPiece& name, const |
| 20 |
base::StringPiece& zone, const |
| 21 |
base::StringPiece& signature, uint16 rrtype, |
| 22 |
const std::vector<base::StringPiece>& rrdatas); |
| 23 |
}; |
| 24 |
} |
| 25 |
|
| 26 |
template <class C> class scoped_array |
| 27 |
{ |
| 28 |
public: typedef C element_type; |
| 29 |
explicit scoped_array(C* p = __null):array_(p) {} |
| 30 |
private: C* array_; |
| 31 |
}; |
| 32 |
|
| 33 |
namespace net { |
| 34 |
bool DNSSECKeySet::CheckSignature (const base::StringPiece& name, |
| 35 |
const base::StringPiece& zone, const base::StringPiece& signature, |
| 36 |
uint16 rrtype, const std::vector<base::StringPiece>& rrdatas) |
| 37 |
{ |
| 38 |
unsigned signed_data_len = 0; |
| 39 |
for (std::vector<base::StringPiece>::const_iterator i = |
| 40 |
rrdatas.begin(); |
| 41 |
i != rrdatas.end(); i++) { |
| 42 |
signed_data_len += 2; |
| 43 |
signed_data_len += i->size(); |
| 44 |
} |
| 45 |
scoped_array<unsigned char> signed_data(new unsigned |
| 46 |
char[signed_data_len]); |
| 47 |
|
| 48 |
return true; |
| 49 |
} |
| 50 |
} |
| 51 |
|