summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfattachment.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-18 14:23:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-18 18:40:16 +0000
commit275e260a6cd4a8e506ba974feb85ebcd926c1739 (patch)
tree2029b9158ec044764ceff122fe5fb5d0a3f123d1 /fpdfsdk/fpdfattachment.cpp
parent450fbeaaabf1ab340c1018de2e58f1950657517e (diff)
downloadpdfium-275e260a6cd4a8e506ba974feb85ebcd926c1739.tar.xz
Convert string class names
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfattachment.cpp')
-rw-r--r--fpdfsdk/fpdfattachment.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/fpdfsdk/fpdfattachment.cpp b/fpdfsdk/fpdfattachment.cpp
index d984cf8910..7402114756 100644
--- a/fpdfsdk/fpdfattachment.cpp
+++ b/fpdfsdk/fpdfattachment.cpp
@@ -25,24 +25,23 @@ namespace {
constexpr char kChecksumKey[] = "CheckSum";
-CFX_ByteString CFXByteStringHexDecode(const CFX_ByteString& bsHex) {
+ByteString CFXByteStringHexDecode(const ByteString& bsHex) {
uint8_t* result = nullptr;
uint32_t size = 0;
HexDecode(bsHex.raw_str(), bsHex.GetLength(), &result, &size);
- CFX_ByteString bsDecoded(result, size);
+ ByteString bsDecoded(result, size);
FX_Free(result);
return bsDecoded;
}
-CFX_ByteString GenerateMD5Base16(const void* contents,
- const unsigned long len) {
+ByteString GenerateMD5Base16(const void* contents, const unsigned long len) {
uint8_t digest[16];
CRYPT_MD5Generate(reinterpret_cast<const uint8_t*>(contents), len, digest);
char buf[32];
for (int i = 0; i < 16; ++i)
FXSYS_IntToTwoHexChars(digest[i], &buf[i * 2]);
- return CFX_ByteString(buf, 32);
+ return ByteString(buf, 32);
}
} // namespace
@@ -59,8 +58,8 @@ FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document) {
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- CFX_WideString wsName =
- CFX_WideString::FromUTF16LE(name, CFX_WideString::WStringLength(name));
+ WideString wsName =
+ WideString::FromUTF16LE(name, WideString::WStringLength(name));
if (!pDoc || wsName.IsEmpty())
return nullptr;
@@ -110,7 +109,7 @@ FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index) {
if (static_cast<size_t>(index) >= nameTree.GetCount())
return nullptr;
- CFX_WideString csName;
+ WideString csName;
return nameTree.LookupValueAndName(index, &csName);
}
@@ -171,8 +170,8 @@ FPDFAttachment_SetStringValue(FPDF_ATTACHMENT attachment,
if (!pParamsDict)
return false;
- CFX_ByteString bsKey = key;
- CFX_ByteString bsValue = CFXByteStringFromFPDFWideString(value);
+ ByteString bsKey = key;
+ ByteString bsValue = CFXByteStringFromFPDFWideString(value);
bool bEncodedAsHex = bsKey == kChecksumKey;
if (bEncodedAsHex)
bsValue = CFXByteStringHexDecode(bsValue);
@@ -194,12 +193,12 @@ FPDFAttachment_GetStringValue(FPDF_ATTACHMENT attachment,
if (!pParamsDict)
return 0;
- CFX_ByteString bsKey = key;
- CFX_WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
+ ByteString bsKey = key;
+ WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
if (bsKey == kChecksumKey && !value.IsEmpty()) {
CPDF_String* stringValue = pParamsDict->GetObjectFor(bsKey)->AsString();
if (stringValue->IsHex()) {
- CFX_ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
+ ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
value = CPDF_String(nullptr, encoded, false).GetUnicodeText();
}
}
@@ -233,7 +232,7 @@ FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment,
// Set the creation date of the new attachment in the dictionary.
CFX_DateTime dateTime;
dateTime.Now();
- CFX_ByteString bsDateTime;
+ ByteString bsDateTime;
bsDateTime.Format("D:%d%02d%02d%02d%02d%02d", dateTime.GetYear(),
dateTime.GetMonth(), dateTime.GetDay(), dateTime.GetHour(),
dateTime.GetMinute(), dateTime.GetSecond());