Index: third_party/harfbuzz-ng/src/hb-open-type-private.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-open-type-private.hh b/third_party/harfbuzz-ng/src/hb-open-type-private.hh |
index 6a8b98be6840c2bc6e141c353c70966f9ecfa726..ee3a21dc3b168a70bdc51241d3d8046686a50336 100644 |
--- a/third_party/harfbuzz-ng/src/hb-open-type-private.hh |
+++ b/third_party/harfbuzz-ng/src/hb-open-type-private.hh |
@@ -642,15 +642,21 @@ struct LongOffset : ULONG |
/* CheckSum */ |
struct CheckSum : ULONG |
{ |
- static uint32_t CalcTableChecksum (ULONG *Table, uint32_t Length) |
+ /* This is reference implementation from the spec. */ |
+ static inline uint32_t CalcTableChecksum (const ULONG *Table, uint32_t Length) |
{ |
uint32_t Sum = 0L; |
- ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size; |
+ const ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size; |
while (Table < EndPtr) |
Sum += *Table++; |
return Sum; |
} |
+ |
+ /* Note: data should be 4byte aligned and have 4byte padding at the end. */ |
+ inline void set_for_data (const void *data, unsigned int length) |
+ { set (CalcTableChecksum ((const ULONG *) data, length)); } |
+ |
public: |
DEFINE_SIZE_STATIC (4); |
}; |