MCPcopy Create free account
hub / github.com/chen3feng/toft / ShellUnescape

Function ShellUnescape

encoding/shell.cpp:224–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224bool ShellUnescape(const std::string& str, std::string* result)
225{
226 std::string::const_iterator pos = str.begin();
227 std::string::const_iterator end = str.end();
228 while (pos < end) {
229 char c = *pos++;
230 if (c == '\\') {
231 char e;
232 int unescaped_size = UnescapeChar(pos, end, &e);
233 if (unescaped_size > 0) {
234 *result += e;
235 pos += unescaped_size;
236 } else {
237 *result += *pos++;
238 }
239 } else { // Not '\\'
240 *result += c;
241 }
242 }
243 return true;
244}
245
246static void UnescapeCharToArg(std::string::const_iterator* pos,
247 std::string::const_iterator end,

Callers 1

TESTFunction · 0.85

Calls 3

UnescapeCharFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68