security/manager/pki/src/nsPKIParamBlock.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial