Skip to content

Commit

Permalink
Bug 1374629 - Add mozilla::NotNull to mozilla::Encoding constant decl…
Browse files Browse the repository at this point in the history
…arations. r=froydnj,hsivonen

MozReview-Commit-ID: s1sYrq6tqm

--HG--
extra : rebase_source : 0ffeab4554408fc6e28bd18478121aad73439a30
  • Loading branch information
vyv03354 committed Jun 20, 2017
1 parent af86c88 commit bdc7c83
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dom/base/FormData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion dom/html/HTMLFormSubmission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ GetSubmitEncoding(nsGenericHTMLElement* aForm)
if (doc) {
return Encoding::ForName(doc->GetDocumentCharacterSet());
}
return WrapNotNull(UTF_8_ENCODING);
return UTF_8_ENCODING;
}

void
Expand Down
1 change: 1 addition & 0 deletions intl/Encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions intl/gtest/TestEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bdc7c83

Please sign in to comment.