MCPcopy Create free account
hub / github.com/Kitware/CMake / StringToBinaryImpl

Method StringToBinaryImpl

Source/cmUuid.cxx:129–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129bool cmUuid::StringToBinaryImpl(cm::string_view input,
130 std::vector<unsigned char>& output) const
131{
132 if (input.size() % 2) {
133 return false;
134 }
135
136 for (size_t i = 0; i < input.size(); i += 2) {
137 char c1 = 0;
138 if (!this->IntFromHexDigit(input[i], c1)) {
139 return false;
140 }
141
142 char c2 = 0;
143 if (!this->IntFromHexDigit(input[i + 1], c2)) {
144 return false;
145 }
146
147 output.push_back(static_cast<char>(c1 << 4 | c2));
148 }
149
150 return true;
151}
152
153bool cmUuid::IntFromHexDigit(char input, char& output) const
154{

Callers 1

StringToBinaryMethod · 0.95

Calls 3

IntFromHexDigitMethod · 0.95
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected