Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/uuid/name_generator.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
28 // TODO: add in common namesspace uuids | 28 // TODO: add in common namesspace uuids |
29 class name_generator { | 29 class name_generator { |
30 public: | 30 public: |
31 typedef uuid result_type; | 31 typedef uuid result_type; |
32 | 32 |
33 explicit name_generator(uuid const& namespace_uuid) | 33 explicit name_generator(uuid const& namespace_uuid_) |
34 : namespace_uuid(namespace_uuid) | 34 : namespace_uuid(namespace_uuid_) |
35 {} | 35 {} |
36 | 36 |
37 uuid operator()(const char* name) { | 37 uuid operator()(const char* name) { |
38 reset(); | 38 reset(); |
39 process_characters(name, std::strlen(name)); | 39 process_characters(name, std::strlen(name)); |
69 void process_characters(char_type const*const characters, size_t count) { | 69 void process_characters(char_type const*const characters, size_t count) { |
70 BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type)); | 70 BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type)); |
71 | 71 |
72 for (size_t i=0; i<count; i++) { | 72 for (size_t i=0; i<count; i++) { |
73 uint32_t c = characters[i]; | 73 uint32_t c = characters[i]; |
74 sha.process_byte( (c >> 0) & 0xFF ); | 74 sha.process_byte(static_cast<unsigned char>((c >> 0) & 0xFF)); |
75 sha.process_byte( (c >> 8) & 0xFF ); | 75 sha.process_byte(static_cast<unsigned char>((c >> 8) & 0xFF)); |
76 sha.process_byte( (c >> 16) & 0xFF ); | 76 sha.process_byte(static_cast<unsigned char>((c >> 16) & 0xFF)); |
77 sha.process_byte( (c >> 24) & 0xFF ); | 77 sha.process_byte(static_cast<unsigned char>((c >> 24) & 0xFF)); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void process_characters(char const*const characters, size_t count) { | 81 void process_characters(char const*const characters, size_t count) { |
82 sha.process_bytes(characters, count); | 82 sha.process_bytes(characters, count); |
94 | 94 |
95 sha.get_digest(digest); | 95 sha.get_digest(digest); |
96 | 96 |
97 uuid u; | 97 uuid u; |
98 for (int i=0; i<4; ++i) { | 98 for (int i=0; i<4; ++i) { |
99 *(u.begin() + i*4+0) = ((digest[i] >> 24) & 0xFF); | 99 *(u.begin() + i*4+0) = static_cast<uint8_t>((digest[i] >> 24) & 0xFF); |
100 *(u.begin() + i*4+1) = ((digest[i] >> 16) & 0xFF); | 100 *(u.begin() + i*4+1) = static_cast<uint8_t>((digest[i] >> 16) & 0xFF); |
101 *(u.begin() + i*4+2) = ((digest[i] >> 8) & 0xFF); | 101 *(u.begin() + i*4+2) = static_cast<uint8_t>((digest[i] >> 8) & 0xFF); |
102 *(u.begin() + i*4+3) = ((digest[i] >> 0) & 0xFF); | 102 *(u.begin() + i*4+3) = static_cast<uint8_t>((digest[i] >> 0) & 0xFF); |
103 } | 103 } |
104 | 104 |
105 // set variant | 105 // set variant |
106 // must be 0b10xxxxxx | 106 // must be 0b10xxxxxx |
107 *(u.begin()+8) &= 0xBF; | 107 *(u.begin()+8) &= 0xBF; |