Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
MimeRebuffer Class Reference

#include <nsMimeRebuffer.h>

List of all members.

Public Member Functions

 MimeRebuffer (void)
virtual ~MimeRebuffer (void)
PRUint32 GetSize ()
PRUint32 IncreaseBuffer (const char *addBuf, PRUint32 size)
PRUint32 ReduceBuffer (PRUint32 numBytes)
char * GetBuffer ()

Protected Attributes

PRUint32 mSize
char * mBuf

Detailed Description

Definition at line 46 of file nsMimeRebuffer.h.


Constructor & Destructor Documentation

Definition at line 41 of file nsMimeRebuffer.cpp.

{
  mSize = 0;
  mBuf = NULL;
}

Definition at line 47 of file nsMimeRebuffer.cpp.

{
  if (mBuf)
  {
    PR_FREEIF(mBuf);
    mBuf = NULL;
  }
}

Member Function Documentation

Definition at line 106 of file nsMimeRebuffer.cpp.

{
  return mBuf;
}

Definition at line 57 of file nsMimeRebuffer.cpp.

{
  return mSize;
}
PRUint32 MimeRebuffer::IncreaseBuffer ( const char *  addBuf,
PRUint32  size 
)

Definition at line 63 of file nsMimeRebuffer.cpp.

{
  if ( (!addBuf) || (size == 0) )
    return mSize;

  mBuf = (char *)PR_Realloc(mBuf, size + mSize);
  if (!mBuf)
  {
    mSize = 0;
    return mSize;
  }

  memcpy(mBuf+mSize, addBuf, size);
  mSize += size;
  return mSize;
}

Here is the call graph for this function:

Definition at line 81 of file nsMimeRebuffer.cpp.

{
  if (numBytes == 0)
    return mSize;

  if (!mBuf)
  {
    mSize = 0;
    return mSize;
  }

  if (numBytes >= mSize)
  {
    PR_FREEIF(mBuf);
    mBuf = NULL;
    mSize = 0;
    return mSize;
  }

  memcpy(mBuf, mBuf+numBytes, (mSize - numBytes));
  mSize -= numBytes;
  return mSize;
}

Here is the call graph for this function:


Member Data Documentation

char* MimeRebuffer::mBuf [protected]

Definition at line 58 of file nsMimeRebuffer.h.

Definition at line 57 of file nsMimeRebuffer.h.


The documentation for this class was generated from the following files: