Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This code is made available to you under your choice of the following sets |
michael@0 | 4 | * of licensing terms: |
michael@0 | 5 | */ |
michael@0 | 6 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 9 | */ |
michael@0 | 10 | /* Copyright 2014 Mozilla Contributors |
michael@0 | 11 | * |
michael@0 | 12 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 13 | * you may not use this file except in compliance with the License. |
michael@0 | 14 | * You may obtain a copy of the License at |
michael@0 | 15 | * |
michael@0 | 16 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 17 | * |
michael@0 | 18 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 19 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 21 | * See the License for the specific language governing permissions and |
michael@0 | 22 | * limitations under the License. |
michael@0 | 23 | */ |
michael@0 | 24 | |
michael@0 | 25 | #include "pkixgtest.h" |
michael@0 | 26 | |
michael@0 | 27 | namespace mozilla { namespace pkix { namespace test { |
michael@0 | 28 | |
michael@0 | 29 | std::ostream& |
michael@0 | 30 | operator<<(std::ostream& os, const ResultWithPRErrorCode& value) |
michael@0 | 31 | { |
michael@0 | 32 | switch (value.mRv) |
michael@0 | 33 | { |
michael@0 | 34 | case Success: |
michael@0 | 35 | os << "Success"; |
michael@0 | 36 | break; |
michael@0 | 37 | case RecoverableError: |
michael@0 | 38 | os << "RecoverableError"; |
michael@0 | 39 | break; |
michael@0 | 40 | case SECFailure: |
michael@0 | 41 | os << "FatalError"; |
michael@0 | 42 | break; |
michael@0 | 43 | default: |
michael@0 | 44 | os << "[Invalid Result: " << static_cast<int64_t>(value.mRv) << ']'; |
michael@0 | 45 | break; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | if (value.mRv != Success) { |
michael@0 | 49 | os << '('; |
michael@0 | 50 | const char* name = PR_ErrorToName(value.mErrorCode); |
michael@0 | 51 | if (name) { |
michael@0 | 52 | os << name; |
michael@0 | 53 | } else { |
michael@0 | 54 | os << value.mErrorCode; |
michael@0 | 55 | } |
michael@0 | 56 | os << ')'; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | return os; |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | } } } // namespace mozilla::pkix::test |