зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311669
- replace string literals containing escaped characters with raw string literals. r=valentin
MozReview-Commit-ID: 2e9j55eNTop --HG-- extra : rebase_source : e633f6731ebabbca1a128fcc995b2dbf5d7c6a0b
This commit is contained in:
Родитель
702a3fbf63
Коммит
204bb10a86
|
@ -1157,7 +1157,7 @@ nsresult DecodeQOrBase64Str(const char *aEncoded, size_t aLen, char aQOrBase64,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char especials[] = "()<>@,;:\\\"/[]?.=";
|
||||
static const char especials[] = R"(()<>@,;:\"/[]?.=)";
|
||||
|
||||
// |decode_mime_part2_str| taken from comi18n.c
|
||||
// Decode RFC2047-encoded words in the input and convert the result to UTF-8.
|
||||
|
|
|
@ -331,7 +331,7 @@ nsHttpHandler::Init()
|
|||
appInfo->GetName(mAppName);
|
||||
}
|
||||
appInfo->GetVersion(mAppVersion);
|
||||
mAppName.StripChars(" ()<>@,;:\\\"/[]?={}");
|
||||
mAppName.StripChars(R"( ()<>@,;:\"/[]?={})");
|
||||
} else {
|
||||
mAppVersion.AssignLiteral(MOZ_APP_UA_VERSION);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ SetACookie(nsICookieService *aCookieService, const char *aSpec1, const char *aSp
|
|||
if (aSpec2)
|
||||
NS_NewURI(getter_AddRefs(uri2), aSpec2);
|
||||
|
||||
sBuffer = PR_sprintf_append(sBuffer, " for host \"%s\": SET ", aSpec1);
|
||||
sBuffer = PR_sprintf_append(sBuffer, R"( for host "%s": SET )", aSpec1);
|
||||
nsresult rv = aCookieService->SetCookieStringFromHttp(uri1, uri2, nullptr, (char *)aCookieString, aServerTime, nullptr);
|
||||
// the following code is useless. the cookieservice blindly returns NS_OK
|
||||
// from SetCookieString. we have to call GetCookie to see if the cookie was
|
||||
|
@ -90,7 +90,7 @@ SetACookieNoHttp(nsICookieService *aCookieService, const char *aSpec, const char
|
|||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), aSpec);
|
||||
|
||||
sBuffer = PR_sprintf_append(sBuffer, " for host \"%s\": SET ", aSpec);
|
||||
sBuffer = PR_sprintf_append(sBuffer, R"( for host "%s": SET )", aSpec);
|
||||
nsresult rv = aCookieService->SetCookieString(uri, nullptr, (char *)aCookieString, nullptr);
|
||||
// the following code is useless. the cookieservice blindly returns NS_OK
|
||||
// from SetCookieString. we have to call GetCookie to see if the cookie was
|
||||
|
@ -113,7 +113,7 @@ GetACookie(nsICookieService *aCookieService, const char *aSpec1, const char *aSp
|
|||
if (aSpec2)
|
||||
NS_NewURI(getter_AddRefs(uri2), aSpec2);
|
||||
|
||||
sBuffer = PR_sprintf_append(sBuffer, " \"%s\": GOT ", aSpec1);
|
||||
sBuffer = PR_sprintf_append(sBuffer, R"( "%s": GOT )", aSpec1);
|
||||
nsresult rv = aCookieService->GetCookieStringFromHttp(uri1, uri2, nullptr, aCookie);
|
||||
if (NS_FAILED(rv)) {
|
||||
sBuffer = PR_sprintf_append(sBuffer, "XXX GetCookieString() failed!\n");
|
||||
|
@ -134,7 +134,7 @@ GetACookieNoHttp(nsICookieService *aCookieService, const char *aSpec, char **aCo
|
|||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), aSpec);
|
||||
|
||||
sBuffer = PR_sprintf_append(sBuffer, " \"%s\": GOT ", aSpec);
|
||||
sBuffer = PR_sprintf_append(sBuffer, R"( "%s": GOT )", aSpec);
|
||||
nsresult rv = aCookieService->GetCookieString(uri, nullptr, aCookie);
|
||||
if (NS_FAILED(rv)) {
|
||||
sBuffer = PR_sprintf_append(sBuffer, "XXX GetCookieString() failed!\n");
|
||||
|
@ -355,7 +355,7 @@ main(int32_t argc, char *argv[])
|
|||
GetACookie(cookieService, "http://foo.domain.com", nullptr, getter_Copies(cookie));
|
||||
rv[13] = CheckResult(cookie.get(), MUST_BE_NULL);
|
||||
|
||||
SetACookie(cookieService, "http://path.net/path/file", nullptr, "test=taco; path=\"/bogus\"", nullptr);
|
||||
SetACookie(cookieService, "http://path.net/path/file", nullptr, R"(test=taco; path="/bogus")", nullptr);
|
||||
GetACookie(cookieService, "http://path.net/path/file", nullptr, getter_Copies(cookie));
|
||||
rv[14] = CheckResult(cookie.get(), MUST_EQUAL, "test=taco");
|
||||
SetACookie(cookieService, "http://path.net/path/file", nullptr, "test=taco; max-age=-1", nullptr);
|
||||
|
@ -455,10 +455,10 @@ main(int32_t argc, char *argv[])
|
|||
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=Thu, 10 Apr 1980 16:33:12 GMT", nullptr);
|
||||
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
|
||||
rv[3] = CheckResult(cookie.get(), MUST_BE_NULL);
|
||||
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT", nullptr);
|
||||
SetACookie(cookieService, "http://expireme.org/", nullptr, R"(test=expiry; expires="Thu, 10 Apr 1980 16:33:12 GMT)", nullptr);
|
||||
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
|
||||
rv[4] = CheckResult(cookie.get(), MUST_BE_NULL);
|
||||
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT\"", nullptr);
|
||||
SetACookie(cookieService, "http://expireme.org/", nullptr, R"(test=expiry; expires="Thu, 10 Apr 1980 16:33:12 GMT")", nullptr);
|
||||
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
|
||||
rv[5] = CheckResult(cookie.get(), MUST_BE_NULL);
|
||||
|
||||
|
@ -555,7 +555,7 @@ main(int32_t argc, char *argv[])
|
|||
rv[1] = CheckResult(cookie.get(), MUST_BE_NULL);
|
||||
SetACookie(cookieService, "http://parser.test/", nullptr, "test=\"fubar! = foo;bar\\\";\" parser; domain=.parser.test; max-age=6\nfive; max-age=2.63,", nullptr);
|
||||
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
|
||||
rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, "test=\"fubar! = foo");
|
||||
rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, R"(test="fubar! = foo)");
|
||||
rv[3] = CheckResult(cookie.get(), MUST_CONTAIN, "five");
|
||||
SetACookie(cookieService, "http://parser.test/", nullptr, "test=kill; domain=.parser.test; max-age=0 \n five; max-age=0", nullptr);
|
||||
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
|
||||
|
|
|
@ -799,7 +799,7 @@ nsresult LoadURLsFromFile(char *aFileName)
|
|||
nsresult LoadURLFromConsole()
|
||||
{
|
||||
char buffer[1024];
|
||||
printf("Enter URL (\"q\" to start): ");
|
||||
printf(R"(Enter URL ("q" to start): )");
|
||||
Unused << scanf("%s", buffer);
|
||||
if (buffer[0]=='q')
|
||||
gAskUserForInput = false;
|
||||
|
|
|
@ -339,7 +339,7 @@ nsresult doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0)
|
|||
{ "http://a/b/c/d;p?q#f", "g/h/../H?http://foo#bar", "http://a/b/c/g/H?http://foo#bar" },
|
||||
{ "http://a/b/c/d;p?q#f", "g/h/../H;baz?http://foo", "http://a/b/c/g/H;baz?http://foo" },
|
||||
{ "http://a/b/c/d;p?q#f", "g/h/../H;baz?http://foo#bar", "http://a/b/c/g/H;baz?http://foo#bar" },
|
||||
{ "http://a/b/c/d;p?q#f", "g/h/../H;baz?C:\\temp", "http://a/b/c/g/H;baz?C:\\temp" },
|
||||
{ "http://a/b/c/d;p?q#f", R"(g/h/../H;baz?C:\temp)", R"(http://a/b/c/g/H;baz?C:\temp)" },
|
||||
{ "http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q" },
|
||||
{ "http://a/b/c/d;p?q#f", "#", "http://a/b/c/d;p?q#" },
|
||||
{ "http://a/b/c;p/d;p?q#f", "../g;p" , "http://a/b/g;p" },
|
||||
|
|
Загрузка…
Ссылка в новой задаче