MCPcopy Create free account
hub / github.com/LUX-Core/lux / PutDecodedDatumInto

Function PutDecodedDatumInto

src/cryptopp/datatest.cpp:96–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransformation &target)
97{
98 std::string s1 = GetRequiredDatum(data, name), s2;
99 ByteQueue q;
100
101 while (!s1.empty())
102 {
103 while (s1[0] == ' ')
104 {
105 s1 = s1.substr(1);
106 if (s1.empty())
107 goto end; // avoid invalid read if s1 is empty
108 }
109
110 int repeat = 1;
111 if (s1[0] == 'r')
112 {
113 repeat = atoi(s1.c_str()+1);
114 s1 = s1.substr(s1.find(' ')+1);
115 }
116
117 s2 = ""; // MSVC 6 doesn't have clear();
118
119 if (s1[0] == '\"')
120 {
121 s2 = s1.substr(1, s1.find('\"', 1)-1);
122 s1 = s1.substr(s2.length() + 2);
123 }
124 else if (s1.substr(0, 2) == "0x")
125 {
126 StringSource(s1.substr(2, s1.find(' ')), true, new HexDecoder(new StringSink(s2)));
127 s1 = s1.substr(STDMIN(s1.find(' '), s1.length()));
128 }
129 else
130 {
131 StringSource(s1.substr(0, s1.find(' ')), true, new HexDecoder(new StringSink(s2)));
132 s1 = s1.substr(STDMIN(s1.find(' '), s1.length()));
133 }
134
135 while (repeat--)
136 {
137 q.Put((const byte *)s2.data(), s2.size());
138 RandomizedTransfer(q, target, false);
139 }
140 }
141
142end:
143 RandomizedTransfer(q, target, true);
144}
145
146std::string GetDecodedDatum(const TestData &data, const char *name)
147{

Callers 5

GetDecodedDatumFunction · 0.85
GetOptionalDecodedDatumFunction · 0.85
GetVoidValueMethod · 0.85
TestSignatureSchemeFunction · 0.85
TestDigestOrMACFunction · 0.85

Calls 9

atoiFunction · 0.85
RandomizedTransferFunction · 0.85
StringSourceFunction · 0.70
emptyMethod · 0.45
findMethod · 0.45
lengthMethod · 0.45
PutMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected