summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-11 09:03:14 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-11 14:24:24 +0000
commitd7120eead6f6e0b05c1197e55e899081deae1289 (patch)
tree824819037adf17bc2b291f5f0dbc922510a8ffe2 /xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
parent96e65ae3a3a328022f025805e9db02cbed1b5607 (diff)
downloadpdfium-d7120eead6f6e0b05c1197e55e899081deae1289.tar.xz
Disabiguate CreateStream calls
This CL creates a CreateReadStream and CreateWriteStream method instead of having a single overloaded method. This removes the need for the cast at the call sites. The access parameter has been rolled into the method as it was always passed the same way to each Create*Stream method. Change-Id: I845951c3fe386b8051daf4f6b2ee5ba29b5c7d54 Reviewed-on: https://pdfium-review.googlesource.com/4032 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp')
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index 66f4bbf928..aa7c17901a 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -30,7 +30,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, CData) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -77,7 +77,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -113,7 +113,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -147,7 +147,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -176,7 +176,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -205,7 +205,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -234,7 +234,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -270,7 +270,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -303,7 +303,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -336,7 +336,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -369,7 +369,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -396,7 +396,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -427,7 +427,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -458,7 +458,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -489,7 +489,7 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
// We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t.
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
- reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
+ reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len);
CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());