Bug 1374629 - Add mozilla::NotNull to mozilla::Encoding constant declarations. r=froydnj,hsivonen

MozReview-Commit-ID: s1sYrq6tqm

--HG--
extra : rebase_source : 0ffeab4554408fc6e28bd18478121aad73439a30
This commit is contained in:
Masatoshi Kimura 2017-06-20 22:04:18 +09:00
parent af86c88b2f
commit bdc7c83579
4 changed files with 8 additions and 3 deletions

View File

@ -18,7 +18,7 @@ using namespace mozilla;
using namespace mozilla::dom;
FormData::FormData(nsISupports* aOwner)
: HTMLFormSubmission(WrapNotNull(UTF_8_ENCODING), nullptr)
: HTMLFormSubmission(UTF_8_ENCODING, nullptr)
, mOwner(aOwner)
{
}
@ -402,7 +402,7 @@ NS_IMETHODIMP
FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
nsACString& aContentTypeWithCharset, nsACString& aCharset)
{
FSMultipartFormData fs(WrapNotNull(UTF_8_ENCODING), nullptr);
FSMultipartFormData fs(UTF_8_ENCODING, nullptr);
for (uint32_t i = 0; i < mFormData.Length(); ++i) {
if (mFormData[i].wasNullBlob) {

View File

@ -889,7 +889,7 @@ GetSubmitEncoding(nsGenericHTMLElement* aForm)
if (doc) {
return Encoding::ForName(doc->GetDocumentCharacterSet());
}
return WrapNotNull(UTF_8_ENCODING);
return UTF_8_ENCODING;
}
void

View File

@ -27,6 +27,7 @@ class Encoder;
}; // namespace mozilla
#define ENCODING_RS_ENCODING mozilla::Encoding
#define ENCODING_RS_NOT_NULL_CONST_ENCODING_PTR mozilla::NotNull<const mozilla::Encoding*>
#define ENCODING_RS_ENCODER mozilla::Encoder
#define ENCODING_RS_DECODER mozilla::Decoder

View File

@ -4,11 +4,15 @@
#include "gtest/gtest.h"
#include "mozilla/Encoding.h"
#include <type_traits>
#define ENCODING_TEST(name) TEST(EncodingTest, name)
using namespace mozilla;
static_assert(std::is_standard_layout<NotNull<const Encoding*>>::value,
"NotNull<const Encoding*> must be a standard layout type.");
// These tests mainly test that the C++ interface seems to
// reach the Rust code. More thorough testing of the back
// end is done in Rust.