// static std::string LLWLParamManager::escapeString(const std::string& str) { // Don't use LLURI::escape() because it doesn't encode '-' characters // which may break handling of some system presets like "A-12AM". char* curl_str = curl_escape(str.c_str(), str.size()); std::string escaped_str(curl_str); curl_free(curl_str); return escaped_str; }
// windows command-line escaping rules are a disaster, partly because how the command-line is // parsed depends on what program you're running. In windows, the command line is passed in // as a single string, and the process is left to interpret it as it sees fit. The standard // C runtime uses one set of rules, the function CommandLineToArgvW usually used by // GUI-mode programs uses a different set. // Here we try to find a common denominator that works well for simple cases // it's only minimally tested right now due to time constraints. fc::string detail::process_impl::windows_shell_escape(const fc::string& str) { if (str.find_first_of(" \"") == fc::string::npos) return str; fc::string escaped_quotes(str); for (size_t start = escaped_quotes.find("\""); start != fc::string::npos; start = escaped_quotes.find("\"", start + 2)) escaped_quotes.replace(start, 1, "\\\""); fc::string escaped_str("\""); escaped_str += escaped_quotes; escaped_str += "\""; return escaped_str; }
// these rules work pretty well for a standard bash shell on unix fc::string detail::process_impl::unix_shell_escape(const fc::string& str) { if (str.find_first_of(" ;&|><*?`$(){}[]!#'\"") == fc::string::npos) return str; fc::string escaped_quotes(str); for (size_t start = escaped_quotes.find("'"); start != fc::string::npos; start = escaped_quotes.find("'", start + 5)) escaped_quotes.replace(start, 1, "'\"'\"'"); fc::string escaped_str("\'"); escaped_str += escaped_quotes; escaped_str += "\'"; return escaped_str; }
// static std::string LLWLParamManager::escapeString(const std::string& str) { // Don't use LLURI::escape() because it doesn't encode '-' characters // which may break handling of some system presets like "A-12AM". char* curl_str = curl_escape(str.c_str(), str.size()); std::string escaped_str(curl_str); curl_free(curl_str); // <FS:Ansariel> FIRE-10861: Fix Windlight settings order // And neither does cURL... LLStringUtil::replaceString(escaped_str, "-", "%2D"); LLStringUtil::replaceString(escaped_str, ".", "%2E"); // </FS:Ansariel> return escaped_str; }
static void __init test_pointer(void) { plain(); null_pointer(); invalid_pointer(); symbol_ptr(); kernel_ptr(); struct_resource(); addr(); escaped_str(); hex_string(); mac(); ip(); uuid(); dentry(); struct_va_format(); struct_rtc_time(); struct_clk(); bitmap(); netdev_features(); flags(); }