summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-10 22:01:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-10 22:01:56 +0000
commit486f39568b6f336b4e6c81300ee9caae54ebdff2 (patch)
treead87a740cab424d781178c438aea07af8df762c0 /core/fxcrt
parentcd7b4ab7519c31a27c8d31e0cb694257fea84fd1 (diff)
downloadpdfium-486f39568b6f336b4e6c81300ee9caae54ebdff2.tar.xz
Add static_asserts for FX_RECT and FX_COLORREF.
Make sure they match their win32 equivalent data types. Change-Id: I395054ce5c5ae110c78dbae30dd985fc498045fb Reviewed-on: https://pdfium-review.googlesource.com/30070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_coordinates.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
index ad64f0b43e..13c6f1b6bc 100644
--- a/core/fxcrt/fx_coordinates.cpp
+++ b/core/fxcrt/fx_coordinates.cpp
@@ -6,7 +6,6 @@
#include "core/fxcrt/fx_coordinates.h"
-#include <algorithm>
#include <utility>
#include "core/fxcrt/fx_extension.h"
@@ -24,6 +23,26 @@ void MatchFloatRange(float f1, float f2, int* i1, int* i2) {
*i2 = *i1 + length;
}
+#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+static_assert(sizeof(FX_RECT) == sizeof(RECT), "FX_RECT vs. RECT mismatch");
+static_assert(offsetof(FX_RECT, left) == offsetof(RECT, left),
+ "FX_RECT vs. RECT mismatch");
+static_assert(offsetof(FX_RECT, top) == offsetof(RECT, top),
+ "FX_RECT vs. RECT mismatch");
+static_assert(offsetof(FX_RECT, right) == offsetof(RECT, right),
+ "FX_RECT vs. RECT mismatch");
+static_assert(offsetof(FX_RECT, bottom) == offsetof(RECT, bottom),
+ "FX_RECT vs. RECT mismatch");
+static_assert(sizeof(FX_RECT::left) == sizeof(RECT::left),
+ "FX_RECT vs. RECT mismatch");
+static_assert(sizeof(FX_RECT::top) == sizeof(RECT::top),
+ "FX_RECT vs. RECT mismatch");
+static_assert(sizeof(FX_RECT::right) == sizeof(RECT::right),
+ "FX_RECT vs. RECT mismatch");
+static_assert(sizeof(FX_RECT::bottom) == sizeof(RECT::bottom),
+ "FX_RECT vs. RECT mismatch");
+#endif
+
} // namespace
void FX_RECT::Normalize() {