security/manager/pki/src/nsPKIParamBlock.cpp

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsPKIParamBlock.h"
michael@0 8 #include "nsIServiceManager.h"
michael@0 9 #include "nsIDialogParamBlock.h"
michael@0 10 #include "nsIMutableArray.h"
michael@0 11
michael@0 12 NS_IMPL_ISUPPORTS(nsPKIParamBlock, nsIPKIParamBlock, nsIDialogParamBlock)
michael@0 13
michael@0 14 nsPKIParamBlock::nsPKIParamBlock()
michael@0 15 {
michael@0 16 }
michael@0 17
michael@0 18 nsresult
michael@0 19 nsPKIParamBlock::Init()
michael@0 20 {
michael@0 21 mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
michael@0 22 return !mDialogParamBlock ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
michael@0 23 }
michael@0 24
michael@0 25 nsPKIParamBlock::~nsPKIParamBlock()
michael@0 26 {
michael@0 27 }
michael@0 28
michael@0 29
michael@0 30 NS_IMETHODIMP
michael@0 31 nsPKIParamBlock::SetNumberStrings( int32_t inNumStrings )
michael@0 32 {
michael@0 33 return mDialogParamBlock->SetNumberStrings(inNumStrings);
michael@0 34 }
michael@0 35
michael@0 36 NS_IMETHODIMP
michael@0 37 nsPKIParamBlock::SetInt(int32_t inIndex, int32_t inInt)
michael@0 38 {
michael@0 39 return mDialogParamBlock->SetInt(inIndex, inInt);
michael@0 40 }
michael@0 41
michael@0 42 NS_IMETHODIMP
michael@0 43 nsPKIParamBlock::GetInt(int32_t inIndex, int32_t *outInt)
michael@0 44 {
michael@0 45 return mDialogParamBlock->GetInt(inIndex, outInt);
michael@0 46 }
michael@0 47
michael@0 48
michael@0 49 NS_IMETHODIMP
michael@0 50 nsPKIParamBlock::GetString(int32_t inIndex, char16_t **_retval)
michael@0 51 {
michael@0 52 return mDialogParamBlock->GetString(inIndex, _retval);
michael@0 53 }
michael@0 54
michael@0 55 NS_IMETHODIMP
michael@0 56 nsPKIParamBlock::SetString(int32_t inIndex, const char16_t *inString)
michael@0 57 {
michael@0 58 return mDialogParamBlock->SetString(inIndex, inString);
michael@0 59 }
michael@0 60
michael@0 61 NS_IMETHODIMP
michael@0 62 nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
michael@0 63 {
michael@0 64 return mDialogParamBlock->GetObjects(aObjects);
michael@0 65 }
michael@0 66
michael@0 67 NS_IMETHODIMP
michael@0 68 nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
michael@0 69 {
michael@0 70 return mDialogParamBlock->SetObjects(aObjects);
michael@0 71 }
michael@0 72
michael@0 73
michael@0 74
michael@0 75 /* void setISupportAtIndex (in int32_t index, in nsISupports object); */
michael@0 76 NS_IMETHODIMP
michael@0 77 nsPKIParamBlock::SetISupportAtIndex(int32_t index, nsISupports *object)
michael@0 78 {
michael@0 79 if (!mSupports) {
michael@0 80 mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
michael@0 81 if (!mSupports) {
michael@0 82 return NS_ERROR_OUT_OF_MEMORY;
michael@0 83 }
michael@0 84 }
michael@0 85 // Ignore any InsertElementAt error, because this function always did that
michael@0 86 mSupports->InsertElementAt(object, index-1);
michael@0 87 return NS_OK;
michael@0 88 }
michael@0 89
michael@0 90 /* nsISupports getISupportAtIndex (in int32_t index); */
michael@0 91 NS_IMETHODIMP
michael@0 92 nsPKIParamBlock::GetISupportAtIndex(int32_t index, nsISupports **_retval)
michael@0 93 {
michael@0 94 NS_ENSURE_ARG(_retval);
michael@0 95
michael@0 96 return mSupports->GetElementAt(index - 1, _retval);
michael@0 97 }
michael@0 98
michael@0 99

mercurial