summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller/FFL_Utils.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /fpdfsdk/src/formfiller/FFL_Utils.cpp
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'fpdfsdk/src/formfiller/FFL_Utils.cpp')
-rw-r--r--fpdfsdk/src/formfiller/FFL_Utils.cpp173
1 files changed, 79 insertions, 94 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_Utils.cpp b/fpdfsdk/src/formfiller/FFL_Utils.cpp
index 8d2d76d73c..d2ce56ac52 100644
--- a/fpdfsdk/src/formfiller/FFL_Utils.cpp
+++ b/fpdfsdk/src/formfiller/FFL_Utils.cpp
@@ -9,106 +9,91 @@
#include "../../include/formfiller/FormFiller.h"
#include "../../include/formfiller/FFL_Utils.h"
-CPDF_Rect CFFL_Utils::MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2)
-{
- CPDF_Rect rcRet;
+CPDF_Rect CFFL_Utils::MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2) {
+ CPDF_Rect rcRet;
- rcRet.left = std::min(rect1.left, rect2.left);
- rcRet.bottom = std::min(rect1.bottom, rect2.bottom);
- rcRet.right = std::max(rect1.right, rect2.right);
- rcRet.top = std::max(rect1.top, rect2.top);
+ rcRet.left = std::min(rect1.left, rect2.left);
+ rcRet.bottom = std::min(rect1.bottom, rect2.bottom);
+ rcRet.right = std::max(rect1.right, rect2.right);
+ rcRet.top = std::max(rect1.top, rect2.top);
- return rcRet;
+ return rcRet;
}
-CPDF_Rect CFFL_Utils::InflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSize)
-{
- CPDF_Rect crNew(crRect.left - fSize,
- crRect.bottom - fSize,
- crRect.right + fSize,
- crRect.top + fSize);
- crNew.Normalize();
- return crNew;
+CPDF_Rect CFFL_Utils::InflateRect(const CPDF_Rect& crRect,
+ const FX_FLOAT& fSize) {
+ CPDF_Rect crNew(crRect.left - fSize, crRect.bottom - fSize,
+ crRect.right + fSize, crRect.top + fSize);
+ crNew.Normalize();
+ return crNew;
}
-CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSize)
-{
- CPDF_Rect crNew(crRect.left + fSize,
- crRect.bottom + fSize,
- crRect.right - fSize,
- crRect.top - fSize);
- crNew.Normalize();
- return crNew;
+CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect& crRect,
+ const FX_FLOAT& fSize) {
+ CPDF_Rect crNew(crRect.left + fSize, crRect.bottom + fSize,
+ crRect.right - fSize, crRect.top - fSize);
+ crNew.Normalize();
+ return crNew;
}
-FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj)
-{
- if (!pObj) return FALSE;
-
- FX_DWORD dwObjNum = pObj->GetObjNum();
- switch (pObj->GetType())
- {
- case PDFOBJ_ARRAY:
- {
- CPDF_Array* pArray = (CPDF_Array*)pObj;
- for (FX_DWORD i = 0; i < pArray->GetCount(); i ++)
- {
- CPDF_Object* pElement = pArray->GetElementValue(i);
- TraceObject(pElement);
- }
- }
- break;
-
- case PDFOBJ_DICTIONARY:
- {
- CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
-
- FX_POSITION fPos = pDict->GetStartPos();
- CFX_ByteString csKey;
- do
- {
- CPDF_Object* pElement = pDict->GetNextElement(fPos, csKey);
- //TRACE(csKey + "\n");
- if (!pElement) break;
- TraceObject(pElement);
- }while (TRUE);
- }
- break;
-
- case PDFOBJ_STREAM:
- {
- CPDF_Stream* pStream = (CPDF_Stream*)pObj;
- CPDF_Dictionary* pDict = pStream->GetDict();
- TraceObject(pDict);
- }
- break;
-
- case PDFOBJ_REFERENCE:
- {
- CPDF_Object* pDirectObj = pObj->GetDirect();
- TraceObject(pDirectObj);
- }
- break;
-
- case PDFOBJ_BOOLEAN:
- break;
- case PDFOBJ_NUMBER:
- //TRACE("%d\n",(int32_t)pObj);
- break;
- case PDFOBJ_STRING:
- //TRACE(((CPDF_String*)pObj)->GetString() + "\n");
- break;
- case PDFOBJ_NAME:
- //TRACE(((CPDF_Name*)pObj)->GetString() + "\n");
- break;
- case PDFOBJ_NULL:
-// case PDFOBJ_KEYWORD:
-// case PDFOBJ_EOF:
- default:
- break;
- }
- if (dwObjNum == 0) return FALSE;
-
- return TRUE;
+FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) {
+ if (!pObj)
+ return FALSE;
+
+ FX_DWORD dwObjNum = pObj->GetObjNum();
+ switch (pObj->GetType()) {
+ case PDFOBJ_ARRAY: {
+ CPDF_Array* pArray = (CPDF_Array*)pObj;
+ for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ CPDF_Object* pElement = pArray->GetElementValue(i);
+ TraceObject(pElement);
+ }
+ } break;
+
+ case PDFOBJ_DICTIONARY: {
+ CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
+
+ FX_POSITION fPos = pDict->GetStartPos();
+ CFX_ByteString csKey;
+ do {
+ CPDF_Object* pElement = pDict->GetNextElement(fPos, csKey);
+ // TRACE(csKey + "\n");
+ if (!pElement)
+ break;
+ TraceObject(pElement);
+ } while (TRUE);
+ } break;
+
+ case PDFOBJ_STREAM: {
+ CPDF_Stream* pStream = (CPDF_Stream*)pObj;
+ CPDF_Dictionary* pDict = pStream->GetDict();
+ TraceObject(pDict);
+ } break;
+
+ case PDFOBJ_REFERENCE: {
+ CPDF_Object* pDirectObj = pObj->GetDirect();
+ TraceObject(pDirectObj);
+ } break;
+
+ case PDFOBJ_BOOLEAN:
+ break;
+ case PDFOBJ_NUMBER:
+ // TRACE("%d\n",(int32_t)pObj);
+ break;
+ case PDFOBJ_STRING:
+ // TRACE(((CPDF_String*)pObj)->GetString() + "\n");
+ break;
+ case PDFOBJ_NAME:
+ // TRACE(((CPDF_Name*)pObj)->GetString() + "\n");
+ break;
+ case PDFOBJ_NULL:
+ // case PDFOBJ_KEYWORD:
+ // case PDFOBJ_EOF:
+ default:
+ break;
+ }
+ if (dwObjNum == 0)
+ return FALSE;
+
+ return TRUE;
}
-