Bug 907904 Fix string correctness issues r=bsmith
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Thu, 22 Aug 2013 08:38:57 +0100
changeset 143792 92beaab780c0df447c5f60e9b9f7736a3f80b137
parent 143791 806a989ec3ad14b440ee043ea92263639c7d5338
child 143793 7e6fb33fdf224bfb5d54decdcecfd18ab398ef4a
push id32774
push userneil@parkwaycc.co.uk
push dateThu, 22 Aug 2013 07:39:08 +0000
treeherdermozilla-inbound@92beaab780c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmith
bugs907904
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 907904 Fix string correctness issues r=bsmith
security/manager/ssl/src/JARSignatureVerification.cpp
--- a/security/manager/ssl/src/JARSignatureVerification.cpp
+++ b/security/manager/ssl/src/JARSignatureVerification.cpp
@@ -249,18 +249,18 @@ ReadLine(/*in/out*/ const char* & nextLi
     ++nextLineStart; // skip space and keep appending
   }
 }
 
 // The header strings are defined in the JAR specification.
 #define JAR_MF_SEARCH_STRING "(M|/M)ETA-INF/(M|m)(ANIFEST|anifest).(MF|mf)$"
 #define JAR_SF_SEARCH_STRING "(M|/M)ETA-INF/*.(SF|sf)$"
 #define JAR_RSA_SEARCH_STRING "(M|/M)ETA-INF/*.(RSA|rsa)$"
-#define JAR_MF_HEADER (const char*)"Manifest-Version: 1.0"
-#define JAR_SF_HEADER (const char*)"Signature-Version: 1.0"
+#define JAR_MF_HEADER "Manifest-Version: 1.0"
+#define JAR_SF_HEADER "Signature-Version: 1.0"
 
 nsresult
 ParseAttribute(const nsAutoCString & curLine,
                /*out*/ nsAutoCString & attrName,
                /*out*/ nsAutoCString & attrValue)
 {
   // Find the colon that separates the name from the value.
   int32_t colonPos = curLine.FindChar(':');
@@ -334,17 +334,17 @@ CheckManifestVersion(const char* & nextL
 // filebuf must be null-terminated. On output, mfDigest will contain the
 // decoded value of SHA1-Digest-Manifest.
 nsresult
 ParseSF(const char* filebuf, /*out*/ SECItem & mfDigest)
 {
   nsresult rv;
 
   const char* nextLineStart = filebuf;
-  rv = CheckManifestVersion(nextLineStart, nsLiteralCString(JAR_SF_HEADER));
+  rv = CheckManifestVersion(nextLineStart, NS_LITERAL_CSTRING(JAR_SF_HEADER));
   if (NS_FAILED(rv))
     return rv;
 
   // Find SHA1-Digest-Manifest
   for (;;) {
     nsAutoCString curLine;
     rv = ReadLine(nextLineStart, curLine);
     if (NS_FAILED(rv)) {
@@ -394,17 +394,17 @@ nsresult
 ParseMF(const char* filebuf, nsIZipReader * zip,
         /*out*/ nsTHashtable<nsCStringHashKey> & mfItems,
         ScopedAutoSECItem & buf)
 {
   nsresult rv;
 
   const char* nextLineStart = filebuf;
 
-  rv = CheckManifestVersion(nextLineStart, nsLiteralCString(JAR_MF_HEADER));
+  rv = CheckManifestVersion(nextLineStart, NS_LITERAL_CSTRING(JAR_MF_HEADER));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // Skip the rest of the header section, which ends with a blank line.
   {
     nsAutoCString line;
     do {
@@ -637,17 +637,17 @@ OpenSignedJARFile(nsIFile * aJarFile,
 
   rv = ParseMF(char_ptr_cast(manifestBuffer.data), zip, items, buf);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // Verify every entry in the file.
   nsCOMPtr<nsIUTF8StringEnumerator> entries;
-  rv = zip->FindEntries(NS_LITERAL_CSTRING(""), getter_AddRefs(entries));
+  rv = zip->FindEntries(EmptyCString(), getter_AddRefs(entries));
   if (NS_SUCCEEDED(rv) && !entries) {
     rv = NS_ERROR_UNEXPECTED;
   }
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   for (;;) {