Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
secerror.c File Reference
#include "nspr.h"
#include "secerr.h"
#include "sslerr.h"
#include "SSLerrs.h"
#include "SECerrs.h"
#include "NSPRerrs.h"

Go to the source code of this file.


struct  tuple_str


#define ER2(a, b)   {a, b},
#define ER3(a, b, c)   {a, c},


typedef struct tuple_str


const char * SECU_Strerror (PRErrorCode errNum)


const tuple_str errStrings []
const PRInt32 numStrings = sizeof(errStrings) / sizeof(tuple_str)

Class Documentation

struct tuple_str

Definition at line 105 of file errormap.c.

Class Members
CK_RV errNum
PRErrorCode errNum
const char * errString

Define Documentation

#define ER2 (   a,
)    {a, b},

Definition at line 45 of file secerror.c.

#define ER3 (   a,
)    {a, c},

Definition at line 46 of file secerror.c.

Typedef Documentation

typedef struct tuple_str

Definition at line 43 of file secerror.c.

Function Documentation

const char* SECU_Strerror ( PRErrorCode  errNum)

Definition at line 66 of file secerror.c.

    PRInt32 low  = 0;
    PRInt32 high = numStrings - 1;
    PRInt32 i;
    PRErrorCode num;
    static int initDone;

    /* make sure table is in ascending order.
     * binary search depends on it.
    if (!initDone) {
       PRErrorCode lastNum = ((PRInt32)0x80000000);
       for (i = low; i <= high; ++i) {
           num = errStrings[i].errNum;
           if (num <= lastNum) {
"sequence error in error strings at item %d\n"
"error %d (%s)\n"
"should come after \n"
"error %d (%s)\n",
                      i, lastNum, errStrings[i-1].errString, 
                     num, errStrings[i].errString);
           lastNum = num;
       initDone = 1;

    /* Do binary search of table. */
    while (low + 1 < high) {
       i = (low + high) / 2;
       num = errStrings[i].errNum;
       if (errNum == num) 
           return errStrings[i].errString;
        if (errNum < num)
           high = i;
           low = i;
    if (errNum == errStrings[low].errNum)
       return errStrings[low].errString;
    if (errNum == errStrings[high].errNum)
       return errStrings[high].errString;
    return NULL;

Variable Documentation

Definition at line 51 of file secerror.c.

Definition at line 60 of file secerror.c.