bug 643460 pt 2 - apply patches to OTS for local build/platform issues. r=jfkthame
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Tue, 26 Apr 2011 16:29:39 +0100
changeset 68767 32f760d04b38a52dfae7c6a9bc5d22430baf4d79
parent 68766 31b6ab15760edada63a494ea72269c46ce55e166
child 68768 3007eb62abc46564a4b22d2da5d58825f0d61c38
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs643460
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 643460 pt 2 - apply patches to OTS for local build/platform issues. r=jfkthame
gfx/ots/README.mozilla
gfx/ots/include/opentype-sanitiser.h
gfx/ots/ots-fix-gcc46.patch
gfx/ots/ots-fix-sparc64.patch
gfx/ots/ots-fix-vc10.patch
gfx/ots/src/Makefile.in
gfx/ots/src/gasp.h
gfx/ots/src/glyf.h
gfx/ots/src/metrics.h
gfx/ots/src/os2.cc
new file mode 100644
--- /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)
--- 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<const uint32_t*>(chksum_buffer_));
       chksum_buffer_offset_ = 0;
     }
 
     while (length >= 4) {
-      chksum_ += ntohl(*reinterpret_cast<const uint32_t*>(
-          reinterpret_cast<const uint8_t*>(data) + offset));
+      uint32_t tmp;
+      std::memcpy(&tmp, reinterpret_cast<const uint8_t *>(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_,
new file mode 100644
--- /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 <cstddef>
++
+ #include "os2.h"
+ 
+ #include "head.h"
+ 
+ // OS/2 - OS/2 and Windows Metrics
+ // http://www.microsoft.com/opentype/otspec/os2.htm
+ 
+ namespace ots {
new file mode 100644
--- /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<const uint32_t*>(chksum_buffer_));
+       chksum_buffer_offset_ = 0;
+     }
+ 
+     while (length >= 4) {
+-      chksum_ += ntohl(*reinterpret_cast<const uint32_t*>(
+-          reinterpret_cast<const uint8_t*>(data) + offset));
++      uint32_t tmp;
++      std::memcpy(&tmp, reinterpret_cast<const uint8_t *>(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_,
new file mode 100644
--- /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 <new>
+ #include <utility>  // std::pair
+ #include <vector>
+ 
+ #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 <new>
+ #include <utility>  // std::pair
+ #include <vector>
+ 
+ #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 <new>
+ #include <utility>  // std::pair
+ #include <vector>
+ 
+ #include "ots.h"
+ 
+ namespace ots {
+ 
+ struct OpenTypeMetricsHeader {
--- a/gfx/ots/src/Makefile.in
+++ b/gfx/ots/src/Makefile.in
@@ -47,25 +47,29 @@ CPPSRCS	= \
   fpgm.cc \
   gasp.cc \
   glyf.cc \
   hdmx.cc \
   head.cc \
   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 \
   gsub.cc \
   $(NULL)
 
 EXPORTS = \
   ../include/opentype-sanitiser.h \
@@ -77,8 +81,14 @@ LOCAL_INCLUDES  += -I$(srcdir)
 FORCE_STATIC_LIB = 1
 # This library is used by other shared libs in a static build
 FORCE_USE_PIC = 1
 
 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))
--- 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 <new>
 #include <utility>  // std::pair
 #include <vector>
 
 #include "ots.h"
 
 namespace ots {
 
 struct OpenTypeGASP {
--- 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 <new>
 #include <utility>  // std::pair
 #include <vector>
 
 #include "ots.h"
 
 namespace ots {
 
 struct OpenTypeGLYF {
--- 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 <new>
 #include <utility>  // std::pair
 #include <vector>
 
 #include "ots.h"
 
 namespace ots {
 
 struct OpenTypeMetricsHeader {
--- 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 <cstddef>
+
 #include "os2.h"
 
 #include "head.h"
 
 // OS/2 - OS/2 and Windows Metrics
 // http://www.microsoft.com/opentype/otspec/os2.htm
 
 namespace ots {