diff --git a/netwerk/mime/nsMIMEHeaderParamImpl.cpp b/netwerk/mime/nsMIMEHeaderParamImpl.cpp index f25baa5c5036..b799d2ed88db 100644 --- a/netwerk/mime/nsMIMEHeaderParamImpl.cpp +++ b/netwerk/mime/nsMIMEHeaderParamImpl.cpp @@ -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. diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 503f9a7b93de..70c2a77d3330 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -331,7 +331,7 @@ nsHttpHandler::Init() appInfo->GetName(mAppName); } appInfo->GetVersion(mAppVersion); - mAppName.StripChars(" ()<>@,;:\\\"/[]?={}"); + mAppName.StripChars(R"( ()<>@,;:\"/[]?={})"); } else { mAppVersion.AssignLiteral(MOZ_APP_UA_VERSION); } diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index f1b259c2c985..ee3393cc4271 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -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 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 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)); diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index f6126551097e..7bec14f856d2 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -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; diff --git a/netwerk/test/urltest.cpp b/netwerk/test/urltest.cpp index eaef3472c476..df6f3f301fe6 100644 --- a/netwerk/test/urltest.cpp +++ b/netwerk/test/urltest.cpp @@ -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" },