Remove stream operators from safe_conversions.h and clamped_math.h Avoid dragging <ostream> into all modules using safe math. -- fix resulting IWYU. Change-Id: Id81b198ad1a60f0d8e81b5a7069dee76d7da9d1e Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/87130 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index d8c5e99..38f56d1 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp
@@ -10,6 +10,7 @@ #include <string.h> #include <algorithm> +#include <sstream> #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h"
diff --git a/third_party/base/numerics/README.pdfium b/third_party/base/numerics/README.pdfium new file mode 100644 index 0000000..636f2df --- /dev/null +++ b/third_party/base/numerics/README.pdfium
@@ -0,0 +1,7 @@ +Description: +Chromium's safe numerics library + +Local Modifications: + +Namespaced from base:: to pdfium::base:: in all files. +Remove ostream operators in safe_conversions.h and clamped_math.h
diff --git a/third_party/base/numerics/clamped_math.h b/third_party/base/numerics/clamped_math.h index 5ae9633..c2f25c5 100644 --- a/third_party/base/numerics/clamped_math.h +++ b/third_party/base/numerics/clamped_math.h
@@ -193,15 +193,6 @@ return value; } -#if !BASE_NUMERICS_DISABLE_OSTREAM_OPERATORS -// Overload the ostream output operator to make logging work nicely. -template <typename T> -std::ostream& operator<<(std::ostream& os, const ClampedNumeric<T>& value) { - os << static_cast<T>(value); - return os; -} -#endif - // These implement the variadic wrapper for the math operations. template <template <typename, typename, typename> class M, typename L,
diff --git a/third_party/base/numerics/safe_conversions.h b/third_party/base/numerics/safe_conversions.h index 3a07849..244f16c 100644 --- a/third_party/base/numerics/safe_conversions.h +++ b/third_party/base/numerics/safe_conversions.h
@@ -19,10 +19,6 @@ #define BASE_HAS_OPTIMIZED_SAFE_CONVERSIONS (0) #endif -#if !BASE_NUMERICS_DISABLE_OSTREAM_OPERATORS -#include <ostream> -#endif - namespace pdfium { namespace base { namespace internal { @@ -312,15 +308,6 @@ return value; } -#if !BASE_NUMERICS_DISABLE_OSTREAM_OPERATORS -// Overload the ostream output operator to make logging work nicely. -template <typename T> -std::ostream& operator<<(std::ostream& os, const StrictNumeric<T>& value) { - os << static_cast<T>(value); - return os; -} -#endif - #define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP) \ template <typename L, typename R, \ typename std::enable_if< \