diff --git a/gfx/ots/README.mozilla b/gfx/ots/README.mozilla new file mode 100644 index 00000000000..1d70edd1a32 --- /dev/null +++ b/gfx/ots/README.mozilla @@ -0,0 +1,10 @@ +This is the Sanitiser for OpenType project, from http://code.google.com/p/ots/. + +Current revision: r62 + +Applied local patches: + ots-fix-vc10.patch - workaround for VS10 STL wrappers (bug 602558) + + ots-fix-gcc46.patch - fix os2.cc compile error for GCC 4.6 (bug 628252) + + ots-fix-sparc64.patch - fix alignment error on sparc64 (bug 643137) diff --git a/gfx/ots/include/opentype-sanitiser.h b/gfx/ots/include/opentype-sanitiser.h index 63bf65f7046..6434171a165 100644 --- a/gfx/ots/include/opentype-sanitiser.h +++ b/gfx/ots/include/opentype-sanitiser.h @@ -62,8 +62,10 @@ class OTSStream { } while (length >= 4) { - chksum_ += ntohl(*reinterpret_cast( - reinterpret_cast(data) + offset)); + uint32_t tmp; + std::memcpy(&tmp, reinterpret_cast(data) + offset, + sizeof(uint32_t)); + chksum_ += ntohl(tmp); length -= 4; offset += 4; } diff --git a/gfx/ots/ots-fix-gcc46.patch b/gfx/ots/ots-fix-gcc46.patch new file mode 100644 index 00000000000..8b4c25c618a --- /dev/null +++ b/gfx/ots/ots-fix-gcc46.patch @@ -0,0 +1,18 @@ +diff --git a/gfx/ots/src/os2.cc b/gfx/ots/src/os2.cc +--- a/gfx/ots/src/os2.cc ++++ b/gfx/ots/src/os2.cc +@@ -1,12 +1,14 @@ + // Copyright (c) 2009 The Chromium Authors. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + ++#include ++ + #include "os2.h" + + #include "head.h" + + // OS/2 - OS/2 and Windows Metrics + // http://www.microsoft.com/opentype/otspec/os2.htm + + namespace ots { diff --git a/gfx/ots/ots-fix-sparc64.patch b/gfx/ots/ots-fix-sparc64.patch new file mode 100644 index 00000000000..2f5bed550ae --- /dev/null +++ b/gfx/ots/ots-fix-sparc64.patch @@ -0,0 +1,26 @@ +diff --git a/gfx/ots/include/opentype-sanitiser.h b/gfx/ots/include/opentype-sanitiser.h +--- a/gfx/ots/include/opentype-sanitiser.h ++++ b/gfx/ots/include/opentype-sanitiser.h +@@ -57,18 +57,20 @@ class OTSStream { + + if (chksum_buffer_offset_ == 4) { + // TODO(yusukes): This cast breaks the strict-aliasing rule. + chksum_ += ntohl(*reinterpret_cast(chksum_buffer_)); + chksum_buffer_offset_ = 0; + } + + while (length >= 4) { +- chksum_ += ntohl(*reinterpret_cast( +- reinterpret_cast(data) + offset)); ++ uint32_t tmp; ++ std::memcpy(&tmp, reinterpret_cast(data) + offset, ++ sizeof(uint32_t)); ++ chksum_ += ntohl(tmp); + length -= 4; + offset += 4; + } + + if (length) { + if (chksum_buffer_offset_ != 0) return false; // not reached + if (length > 4) return false; // not reached + std::memcpy(chksum_buffer_, diff --git a/gfx/ots/ots-fix-vc10.patch b/gfx/ots/ots-fix-vc10.patch new file mode 100644 index 00000000000..bd09f38f911 --- /dev/null +++ b/gfx/ots/ots-fix-vc10.patch @@ -0,0 +1,60 @@ +diff --git a/gfx/ots/src/gasp.h b/gfx/ots/src/gasp.h +--- a/gfx/ots/src/gasp.h ++++ b/gfx/ots/src/gasp.h +@@ -1,15 +1,16 @@ + // Copyright (c) 2009 The Chromium Authors. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + + #ifndef OTS_GASP_H_ + #define OTS_GASP_H_ + ++#include + #include // std::pair + #include + + #include "ots.h" + + namespace ots { + + struct OpenTypeGASP { +diff --git a/gfx/ots/src/glyf.h b/gfx/ots/src/glyf.h +--- a/gfx/ots/src/glyf.h ++++ b/gfx/ots/src/glyf.h +@@ -1,15 +1,16 @@ + // Copyright (c) 2009 The Chromium Authors. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + + #ifndef OTS_GLYF_H_ + #define OTS_GLYF_H_ + ++#include + #include // std::pair + #include + + #include "ots.h" + + namespace ots { + + struct OpenTypeGLYF { +diff --git a/gfx/ots/src/metrics.h b/gfx/ots/src/metrics.h +--- a/gfx/ots/src/metrics.h ++++ b/gfx/ots/src/metrics.h +@@ -1,15 +1,16 @@ + // Copyright (c) 2011 The Chromium Authors. All rights reserved. + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + + #ifndef OTS_METRICS_H_ + #define OTS_METRICS_H_ + ++#include + #include // std::pair + #include + + #include "ots.h" + + namespace ots { + + struct OpenTypeMetricsHeader { diff --git a/gfx/ots/src/Makefile.in b/gfx/ots/src/Makefile.in index d0a381df39e..84b42f4a75d 100644 --- a/gfx/ots/src/Makefile.in +++ b/gfx/ots/src/Makefile.in @@ -52,15 +52,19 @@ CPPSRCS = \ hhea.cc \ hmtx.cc \ kern.cc \ + layout.cc \ loca.cc \ ltsh.cc \ maxp.cc \ + metrics.cc \ name.cc \ os2.cc \ ots.cc \ post.cc \ prep.cc \ vdmx.cc \ + vhea.cc \ + vmtx.cc \ vorg.cc \ gdef.cc \ gpos.cc \ @@ -82,3 +86,9 @@ include $(topsrcdir)/config/rules.mk DEFINES += -DPACKAGE_VERSION="\"moz\"" DEFINES += -DPACKAGE_BUGREPORT="\"http://bugzilla.mozilla.org/\"" +DEFINES += -DNOMINMAX + +# Suppress ANSI strict warnings +# because Googlers don't care about comma-at-end-of-enumerator errors. +CXXFLAGS := $(filter-out -pedantic,$(CXXFLAGS)) +CFLAGS := $(filter-out -pedantic,$(CFLAGS)) diff --git a/gfx/ots/src/gasp.h b/gfx/ots/src/gasp.h index f3f434ffe2a..d8c0b033f23 100644 --- a/gfx/ots/src/gasp.h +++ b/gfx/ots/src/gasp.h @@ -5,6 +5,7 @@ #ifndef OTS_GASP_H_ #define OTS_GASP_H_ +#include #include // std::pair #include diff --git a/gfx/ots/src/glyf.h b/gfx/ots/src/glyf.h index d2eda7752c7..2b54260fbc8 100644 --- a/gfx/ots/src/glyf.h +++ b/gfx/ots/src/glyf.h @@ -5,6 +5,7 @@ #ifndef OTS_GLYF_H_ #define OTS_GLYF_H_ +#include #include // std::pair #include diff --git a/gfx/ots/src/metrics.h b/gfx/ots/src/metrics.h index 46559e1772a..05b9ad5a04b 100644 --- a/gfx/ots/src/metrics.h +++ b/gfx/ots/src/metrics.h @@ -5,6 +5,7 @@ #ifndef OTS_METRICS_H_ #define OTS_METRICS_H_ +#include #include // std::pair #include diff --git a/gfx/ots/src/os2.cc b/gfx/ots/src/os2.cc index 23688ef289f..2e93edd72cc 100644 --- a/gfx/ots/src/os2.cc +++ b/gfx/ots/src/os2.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "os2.h" #include "head.h"