From a39b3caf5170778981f50cc1dffea47f28acd50e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 20:42:48 +0000 Subject: Remove default params from some Map Module methods This CL removes the default value from {Set|Get}MapModuleBuffer and inlines into the call sites. Change-Id: Ia003bec3908a1531e572e25ea0a762973b8beebe Reviewed-on: https://pdfium-review.googlesource.com/17630 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fxjs/cjx_node.cpp | 9 +++++---- fxjs/cjx_node.h | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index e0fbe2f51d..7d919c1cff 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -3014,7 +3014,7 @@ bool CJX_Node::SetMeasure(XFA_ATTRIBUTE eAttr, bool bNotify) { void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); OnChanging(eAttr, bNotify); - SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement)); + SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement), nullptr); OnChanged(eAttr, bNotify, false); return true; } @@ -3025,7 +3025,8 @@ bool CJX_Node::TryMeasure(XFA_ATTRIBUTE eAttr, void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); void* pValue; int32_t iBytes; - if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { + if (GetMapModuleBuffer(pKey, pValue, iBytes, true) && + iBytes == sizeof(mValue)) { memcpy(&mValue, pValue, sizeof(mValue)); return true; } @@ -3692,13 +3693,13 @@ bool CJX_Node::GetMapModuleValue(void* pKey, void*& pValue) { void CJX_Node::SetMapModuleString(void* pKey, const WideStringView& wsValue) { SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(), - wsValue.GetLength() * sizeof(wchar_t)); + wsValue.GetLength() * sizeof(wchar_t), nullptr); } bool CJX_Node::GetMapModuleString(void* pKey, WideStringView& wsValue) { void* pValue; int32_t iBytes; - if (!GetMapModuleBuffer(pKey, pValue, iBytes)) + if (!GetMapModuleBuffer(pKey, pValue, iBytes, true)) return false; // Defensive measure: no out-of-bounds pointers even if zero length. int32_t iChars = iBytes / sizeof(wchar_t); diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index 1864643f91..77092d434b 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -434,15 +434,14 @@ class CJX_Node : public CJX_Object { bool GetMapModuleValue(void* pKey, void*& pValue); void SetMapModuleString(void* pKey, const WideStringView& wsValue); bool GetMapModuleString(void* pKey, WideStringView& wsValue); - void SetMapModuleBuffer( - void* pKey, - void* pValue, - int32_t iBytes, - XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo = nullptr); + void SetMapModuleBuffer(void* pKey, + void* pValue, + int32_t iBytes, + XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo); bool GetMapModuleBuffer(void* pKey, void*& pValue, int32_t& iBytes, - bool bProtoAlso = true) const; + bool bProtoAlso) const; bool HasMapModuleKey(void* pKey); void RemoveMapModuleKey(void* pKey = nullptr); void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey); -- cgit v1.2.3