summaryrefslogtreecommitdiff
path: root/core/src/fxcrt
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 16:58:33 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 16:58:33 -0800
commitd983b09c3ae29a97cba8e9ec9c6351545f6087ee (patch)
tree5641a4bc6eddaa8069904c29c3e3897043411646 /core/src/fxcrt
parentf86d3f946e2f1977c7eaea01dcb9d7ecb3064cd1 (diff)
downloadpdfium-d983b09c3ae29a97cba8e9ec9c6351545f6087ee.tar.xz
Merge to XFA: Remove FX_BSTRC.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1521563002 . (cherry picked from commit 1956a174020686f91cd3b34294e91f4560fe45aa) Review URL: https://codereview.chromium.org/1526823002 .
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r--core/src/fxcrt/fx_basic_bstring.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp2
-rw-r--r--core/src/fxcrt/fx_basic_wstring_unittest.cpp14
-rw-r--r--core/src/fxcrt/fx_xml_parser.cpp26
-rw-r--r--core/src/fxcrt/fxcrt_platforms.cpp6
5 files changed, 25 insertions, 27 deletions
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp
index 574e57a9a6..7576ab86eb 100644
--- a/core/src/fxcrt/fx_basic_bstring.cpp
+++ b/core/src/fxcrt/fx_basic_bstring.cpp
@@ -981,7 +981,7 @@ void CFX_ByteString::TrimRight(FX_CHAR chTarget) {
TrimRight(CFX_ByteStringC(chTarget));
}
void CFX_ByteString::TrimRight() {
- TrimRight(FX_BSTRC("\x09\x0a\x0b\x0c\x0d\x20"));
+ TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
}
void CFX_ByteString::TrimLeft(const CFX_ByteStringC& lpszTargets) {
if (m_pData == NULL) {
@@ -1018,7 +1018,7 @@ void CFX_ByteString::TrimLeft(FX_CHAR chTarget) {
TrimLeft(CFX_ByteStringC(chTarget));
}
void CFX_ByteString::TrimLeft() {
- TrimLeft(FX_BSTRC("\x09\x0a\x0b\x0c\x0d\x20"));
+ TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
}
FX_DWORD CFX_ByteString::GetID(FX_STRSIZE start_pos) const {
return CFX_ByteStringC(*this).GetID(start_pos);
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 220ffbd57d..78746e383c 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -288,7 +288,7 @@ CFX_ByteString CFX_WideString::UTF8Encode() const {
}
CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
if (m_pData == NULL) {
- return CFX_ByteString(FX_BSTRC("\0\0"));
+ return CFX_ByteString("\0\0", 2);
}
int len = m_pData->m_nDataLength;
CFX_ByteString result;
diff --git a/core/src/fxcrt/fx_basic_wstring_unittest.cpp b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
index 74410ddda3..64d694c436 100644
--- a/core/src/fxcrt/fx_basic_wstring_unittest.cpp
+++ b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
@@ -276,19 +276,17 @@ TEST(fxcrt, WideStringConcatInPlace) {
EXPECT_EQ(L"xxxxxx", not_aliased);
}
-#define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str))
-
TEST(fxcrt, WideStringUTF16LE_Encode) {
struct UTF16LEEncodeCase {
CFX_WideString ws;
CFX_ByteString bs;
} utf16le_encode_cases[] = {
- {L"", ByteStringLiteral("\0\0")},
- {L"abc", ByteStringLiteral("a\0b\0c\0\0\0")},
- {L"abcdef", ByteStringLiteral("a\0b\0c\0d\0e\0f\0\0\0")},
- {L"abc\0def", ByteStringLiteral("a\0b\0c\0\0\0")},
- {L"\xaabb\xccdd", ByteStringLiteral("\xbb\xaa\xdd\xcc\0\0")},
- {L"\x3132\x6162", ByteStringLiteral("\x32\x31\x62\x61\0\0")},
+ {L"", CFX_ByteString("\0\0", 2)},
+ {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
+ {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
+ {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
+ {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
+ {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
};
for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp
index 2d3ff6631e..dcae0c58c0 100644
--- a/core/src/fxcrt/fx_xml_parser.cpp
+++ b/core/src/fxcrt/fx_xml_parser.cpp
@@ -200,15 +200,15 @@ FX_DWORD CXML_Parser::GetCharRef() {
m_dwIndex++;
if (ch == ';') {
CFX_ByteStringC ref = buf.GetByteString();
- if (ref == FX_BSTRC("gt")) {
+ if (ref == "gt") {
code = '>';
- } else if (ref == FX_BSTRC("lt")) {
+ } else if (ref == "lt") {
code = '<';
- } else if (ref == FX_BSTRC("amp")) {
+ } else if (ref == "amp") {
code = '&';
- } else if (ref == FX_BSTRC("apos")) {
+ } else if (ref == "apos") {
code = '\'';
- } else if (ref == FX_BSTRC("quot")) {
+ } else if (ref == "quot") {
code = '"';
}
iState = 10;
@@ -327,12 +327,12 @@ void CXML_Parser::GetTagName(CFX_ByteString& space,
case 1:
if (ch == '?') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("?>"));
+ SkipLiterals("?>");
iState = 0;
break;
} else if (ch == '!') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("-->"));
+ SkipLiterals("-->");
iState = 0;
break;
}
@@ -441,7 +441,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
if (ch == '!') {
iState = 2;
} else if (ch == '?') {
- SkipLiterals(FX_BSTRC("?>"));
+ SkipLiterals("?>");
SkipWhiteSpaces();
iState = 0;
} else if (ch == '/') {
@@ -474,12 +474,12 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
break;
case 2:
if (ch == '[') {
- SkipLiterals(FX_BSTRC("]]>"));
+ SkipLiterals("]]>");
} else if (ch == '-') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("-->"));
+ SkipLiterals("-->");
} else {
- SkipLiterals(FX_BSTRC(">"));
+ SkipLiterals(">");
}
decoder.Clear();
SkipWhiteSpaces();
@@ -607,9 +607,9 @@ CFX_ByteString CXML_Element::GetNamespaceURI(
const CXML_Element* pElement = this;
do {
if (qName.IsEmpty()) {
- pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC(""), FX_BSTRC("xmlns"));
+ pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns");
} else {
- pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC("xmlns"), qName);
+ pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName);
}
if (pwsSpace) {
break;
diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp
index 849e3a8500..190605cb60 100644
--- a/core/src/fxcrt/fxcrt_platforms.cpp
+++ b/core/src/fxcrt/fxcrt_platforms.cpp
@@ -17,11 +17,11 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() {
}
void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) {
if (dwModes & FX_FILEMODE_ReadOnly) {
- bsMode = FX_BSTRC("rb");
+ bsMode = "rb";
} else if (dwModes & FX_FILEMODE_Truncate) {
- bsMode = FX_BSTRC("w+b");
+ bsMode = "w+b";
} else {
- bsMode = FX_BSTRC("a+b");
+ bsMode = "a+b";
}
}
void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode) {