From 067243962cf9663a6e055dfb8b853c7f0b4319af Mon Sep 17 00:00:00 2001 From: stuartg Date: Wed, 16 Oct 2013 23:04:01 +0000 Subject: ticket:38 Fix sfntly compilation on VS2013 --- cpp/src/sfntly/port/file_input_stream.cc | 2 ++ cpp/src/sfntly/port/memory_input_stream.cc | 2 ++ 2 files changed, 4 insertions(+) (limited to 'cpp/src/sfntly/port') diff --git a/cpp/src/sfntly/port/file_input_stream.cc b/cpp/src/sfntly/port/file_input_stream.cc index 5bcb434..dfe9a7b 100644 --- a/cpp/src/sfntly/port/file_input_stream.cc +++ b/cpp/src/sfntly/port/file_input_stream.cc @@ -18,6 +18,8 @@ #include #endif +#include + #include "sfntly/port/file_input_stream.h" #include "sfntly/port/exception_type.h" diff --git a/cpp/src/sfntly/port/memory_input_stream.cc b/cpp/src/sfntly/port/memory_input_stream.cc index 56ee81e..f6f2b9b 100755 --- a/cpp/src/sfntly/port/memory_input_stream.cc +++ b/cpp/src/sfntly/port/memory_input_stream.cc @@ -20,6 +20,8 @@ #include +#include + #include "sfntly/port/memory_input_stream.h" #include "sfntly/port/exception_type.h" -- cgit v1.2.3 From f139ed9dd98ad05c7e5cfd7228597fe13b608407 Mon Sep 17 00:00:00 2001 From: arthurhsu Date: Tue, 5 Nov 2013 18:44:58 +0000 Subject: Issue 19330043: fix QNX build Patch by: efidler1@blackberry.com --- cpp/src/sfntly/port/type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cpp/src/sfntly/port') diff --git a/cpp/src/sfntly/port/type.h b/cpp/src/sfntly/port/type.h index 20a5ba8..9f82a5a 100644 --- a/cpp/src/sfntly/port/type.h +++ b/cpp/src/sfntly/port/type.h @@ -41,7 +41,7 @@ #include #endif -#include +#include #include #include -- cgit v1.2.3 From de776d4ef06ca29c240de3444348894f032b03ff Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 23 Sep 2015 16:06:28 -0700 Subject: Check for integer overflow in sfntly::FontData::Bound(). Also delete dead code and cleanup some nits. This is cl/96914065. --- cpp/src/sfntly/port/logging.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cpp/src/sfntly/port/logging.h (limited to 'cpp/src/sfntly/port') diff --git a/cpp/src/sfntly/port/logging.h b/cpp/src/sfntly/port/logging.h new file mode 100644 index 0000000..1d9e319 --- /dev/null +++ b/cpp/src/sfntly/port/logging.h @@ -0,0 +1,31 @@ +/* + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SFNTLY_CPP_SRC_SFNTLY_PORT_LOGGING_H_ +#define SFNTLY_CPP_SRC_SFNTLY_PORT_LOGGING_H_ + +#include +#include + +// Cheap base/logging.h knock off. + +#define CHECK(expr) \ + if (!(expr)) { \ + printf("CHECK failed\n"); \ + abort(); \ + } + +#endif // SFNTLY_CPP_SRC_SFNTLY_PORT_LOGGING_H_ -- cgit v1.2.3 From 427f36e967318da60e86404a638bcecb10c97dbd Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 28 Oct 2016 17:41:01 -0700 Subject: Fix invalid cast found by Control Flow Integrity. Instead of casting RefCounted objects to type NoAddRefRelease, make AddRef() and Release() private methods that are only accessible to a limited number of friends. Fixes https://crbug.com/517959 --- cpp/src/sfntly/port/refcount.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'cpp/src/sfntly/port') diff --git a/cpp/src/sfntly/port/refcount.h b/cpp/src/sfntly/port/refcount.h index eed5162..6353b08 100644 --- a/cpp/src/sfntly/port/refcount.h +++ b/cpp/src/sfntly/port/refcount.h @@ -99,22 +99,18 @@ namespace sfntly { +template +class Ptr; + class RefCount { public: // Make gcc -Wnon-virtual-dtor happy. virtual ~RefCount() {} - virtual size_t AddRef() const = 0; - virtual size_t Release() const = 0; -}; - -template -class NoAddRefRelease : public T { - public: - NoAddRefRelease(); - ~NoAddRefRelease(); - private: + template + friend class Ptr; + virtual size_t AddRef() const = 0; virtual size_t Release() const = 0; }; @@ -142,6 +138,7 @@ class RefCounted : virtual public RefCount { return *this; } + private: virtual size_t AddRef() const { size_t new_count = AtomicIncrement(&ref_count_); DEBUG_OUTPUT("A "); @@ -224,8 +221,8 @@ class Ptr { return *p_; // It can throw! } - NoAddRefRelease* operator->() const { - return (NoAddRefRelease*)p_; // It can throw! + T* operator->() const { + return p_; // It can throw! } bool operator!() const { -- cgit v1.2.3