Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
CertReader.cpp File Reference
#include "zlib.h"
#include "zipstruct.h"
#include "CertReader.h"
#include "nsCRT.h"
#include "nsIServiceManager.h"
#include "nsISignatureVerifier.h"
#include "nsIInputStream.h"
#include "nsIPrincipal.h"
#include "nsIURI.h"
#include "nsPICertNotification.h"
#include "nsNetUtil.h"

Go to the source code of this file.

Defines

#define MAX_SIGNATURE_SIZE   (32*1024)

Functions

static unsigned int xtoint (unsigned char *ii)
static unsigned long xtolong (unsigned char *ll)
static int my_inflate (unsigned char *compr, PRUint32 comprLen, unsigned char *uncompr, PRUint32 uncomprLen)

Define Documentation

#define MAX_SIGNATURE_SIZE   (32*1024)

Definition at line 53 of file CertReader.cpp.


Function Documentation

static int my_inflate ( unsigned char *  compr,
PRUint32  comprLen,
unsigned char *  uncompr,
PRUint32  uncomprLen 
) [static]

Definition at line 89 of file CertReader.cpp.

{
  int err;
  z_stream d_stream; /* decompression stream */
  memset (&d_stream, 0, sizeof (d_stream));

  // buffer is way to small to even deal with.
  if (uncomprLen < 10)
    return -1;

  *uncompr = '\0';

  if (inflateInit2 (&d_stream, -MAX_WBITS) != Z_OK)
    return -1;

  d_stream.next_in  = compr;
  d_stream.avail_in = (uInt)comprLen;

  d_stream.next_out = uncompr;
  d_stream.avail_out = (uInt)uncomprLen;

  err = inflate(&d_stream, Z_NO_FLUSH);

  if (err != Z_OK && err != Z_STREAM_END) {
    inflateEnd(&d_stream);
    return -1;
  }

  err = inflateEnd(&d_stream);
  if (err != Z_OK) {
    return -1;
  }
  return 0;
}

Here is the call graph for this function:

static unsigned int xtoint ( unsigned char *  ii) [static]

Definition at line 64 of file CertReader.cpp.

{
  return (int) (ii [0]) | ((int) ii [1] << 8);
}
static unsigned long xtolong ( unsigned char *  ll) [static]

Definition at line 77 of file CertReader.cpp.

{
  unsigned long ret;

  ret =  ((((unsigned long) ll [0]) <<  0) |
          (((unsigned long) ll [1]) <<  8) |
          (((unsigned long) ll [2]) << 16) |
          (((unsigned long) ll [3]) << 24) );

  return ret;
}