From 22a71eae082c0be01abcbc881c3160d310a35dab Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 21 Aug 2015 08:29:06 +0900 Subject: [PATCH] Bug 1189891 - Avoid including from pkix/Input.h. r=bsmith --- security/pkix/include/pkix/Input.h | 8 ++++---- security/pkix/test/lib/pkixtestutil.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/security/pkix/include/pkix/Input.h b/security/pkix/include/pkix/Input.h index 8ff9bb09243..4b7232c42ac 100644 --- a/security/pkix/include/pkix/Input.h +++ b/security/pkix/include/pkix/Input.h @@ -25,7 +25,7 @@ #ifndef mozilla_pkix_Input_h #define mozilla_pkix_Input_h -#include +#include #include "pkix/Result.h" #include "stdint.h" @@ -133,7 +133,7 @@ inline bool InputsAreEqual(const Input& a, const Input& b) { return a.GetLength() == b.GetLength() && - !std::memcmp(a.UnsafeGetData(), b.UnsafeGetData(), a.GetLength()); + !std::equal(a.UnsafeGetData(), a.UnsafeGetData() + a.GetLength(), b.UnsafeGetData()); } // An Reader is a cursor/iterator through the contents of an Input, designed to @@ -205,7 +205,7 @@ public: if (static_cast(end - input) != N) { return false; } - if (memcmp(input, toMatch, N)) { + if (std::equal(input, end, toMatch)) { return false; } input = end; @@ -221,7 +221,7 @@ public: if (toMatch.GetLength() != remaining) { return false; } - if (std::memcmp(input, toMatch.UnsafeGetData(), remaining)) { + if (std::equal(input, end, toMatch.UnsafeGetData())) { return false; } input = end; diff --git a/security/pkix/test/lib/pkixtestutil.h b/security/pkix/test/lib/pkixtestutil.h index 896ab5eb9bf..5a445cc1775 100644 --- a/security/pkix/test/lib/pkixtestutil.h +++ b/security/pkix/test/lib/pkixtestutil.h @@ -28,6 +28,7 @@ #include #include // Some Mozilla-supported compilers lack #include +#include #include "pkix/pkixtypes.h" #include "../../lib/ScopedPtr.h"