Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Unified Diff: src/ots.h

Issue 13918002: [OTS] Integrate WOFF 2.0 algorithm into OTS (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gsub.cc ('k') | src/ots.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ots.h
===================================================================
--- src/ots.h (revision 99)
+++ src/ots.h (working copy)
@@ -11,9 +11,15 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <limits>
#include "opentype-sanitiser.h"
+// arraysize borrowed from base/basictypes.h
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+#define arraysize(array) (sizeof(ArraySizeHelper(array)))
+
namespace ots {
#if defined(_MSC_VER) || !defined(OTS_DEBUG)
@@ -158,6 +164,17 @@
size_t offset_;
};
+// Round a value up to the nearest multiple of 4. Don't round the value in the
+// case that rounding up overflows.
+template<typename T> T Round4(T value) {
+ if (std::numeric_limits<T>::max() - value < 3) {
+ return value;
+ }
+ return (value + 3) & ~3;
+}
+
+bool IsValidVersionTag(uint32_t tag);
+
#define FOR_EACH_TABLE_TYPE \
F(cff, CFF) \
F(cmap, CMAP) \
« no previous file with comments | « src/gsub.cc ('k') | src/ots.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698