bug 643460 pt 2 - apply patches to OTS for local build/platform issues. r=jfkthame

This commit is contained in:
Masatoshi Kimura 2011-04-26 16:29:39 +01:00
parent 53b6da83b9
commit 8c7a95115c
10 changed files with 133 additions and 2 deletions

10
gfx/ots/README.mozilla Normal file
View File

@ -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)

View File

@ -62,8 +62,10 @@ class OTSStream {
}
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;
}

View File

@ -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 {

View File

@ -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_,

View File

@ -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 {

View File

@ -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))

View File

@ -5,6 +5,7 @@
#ifndef OTS_GASP_H_
#define OTS_GASP_H_
#include <new>
#include <utility> // std::pair
#include <vector>

View File

@ -5,6 +5,7 @@
#ifndef OTS_GLYF_H_
#define OTS_GLYF_H_
#include <new>
#include <utility> // std::pair
#include <vector>

View File

@ -5,6 +5,7 @@
#ifndef OTS_METRICS_H_
#define OTS_METRICS_H_
#include <new>
#include <utility> // std::pair
#include <vector>

View File

@ -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 <cstddef>
#include "os2.h"
#include "head.h"