Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsSharedPrefHandler.cpp File Reference
#include "nsSharedPrefHandler.h"
#include "nsPrefService.h"
#include "nsServiceManagerUtils.h"
#include "nsILocalFile.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsReadableUtils.h"
#include "ipcMessageReader.h"
#include "ipcMessageWriter.h"

Go to the source code of this file.

Defines

#define LOG(args)
#define kPrefsTSQueueName   NS_LITERAL_CSTRING("prefs")
#define kExceptionListFileName   NS_LITERAL_CSTRING("nonshared.txt")

Functions

static PRBool PR_CALLBACK enumFind (void *aElement, void *aData)
static PRBool PR_CALLBACK enumFree (void *aElement, void *aData)
static PRInt32 ReadLine (FILE *inStm, nsACString &destString)
nsresult NS_CreateSharedPrefHandler (nsPrefService *aOwner)
 Global method to create gSharedPrefHandler.

Variables

nsSharedPrefHandlergSharedPrefHandler = nsnull
const char kExceptionListCommentChar = '#'
const PRUint32 kCurrentPrefsTransactionDataVersion = 1

Define Documentation

Definition at line 63 of file nsSharedPrefHandler.cpp.

Definition at line 61 of file nsSharedPrefHandler.cpp.

#define LOG (   args)

Definition at line 55 of file nsSharedPrefHandler.cpp.


Function Documentation

static PRBool PR_CALLBACK enumFind ( void aElement,
void aData 
) [static]

Definition at line 366 of file nsSharedPrefHandler.cpp.

{
  char *elemStr = NS_STATIC_CAST(char*, aElement);
  char *searchStr = NS_STATIC_CAST(char*, aData);
  // return PR_FALSE for a match and to stop search
  return (strncmp(elemStr, searchStr, strlen(elemStr)) != 0);
}

Here is the caller graph for this function:

static PRBool PR_CALLBACK enumFree ( void aElement,
void aData 
) [static]

Definition at line 374 of file nsSharedPrefHandler.cpp.

{
  if (aElement)
    nsMemory::Free(aElement);
  return PR_TRUE;
}

Here is the caller graph for this function:

Global method to create gSharedPrefHandler.

Parameters:
aOwner

Definition at line 417 of file nsSharedPrefHandler.cpp.

{
  nsSharedPrefHandler *local = new nsSharedPrefHandler;
  if (!local)
    return NS_ERROR_OUT_OF_MEMORY;
  nsresult rv = local->Init(aOwner);
  if (NS_FAILED(rv)) {
    delete local;
    return rv;
  }
  NS_ADDREF(gSharedPrefHandler = local);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 ReadLine ( FILE inStm,
nsACString &  destString 
) [static]

Definition at line 381 of file nsSharedPrefHandler.cpp.

{
  char stackBuf[512];
  PRUint32 charsInBuf = 0;
  destString.Truncate();
  int c;
  
  while (1) {
    c = getc(inStm);
    if (c == EOF)
      break;
    else if (c == '\r') {
      c = getc(inStm);
      if (c != '\n')
        ungetc(c, inStm);
      break;
    }
    else if (c == '\n')
      break;
    else {
      if (charsInBuf >= sizeof(stackBuf)) {
        destString.Append(stackBuf, charsInBuf);
        charsInBuf = 0;
      }
      stackBuf[charsInBuf++] = c;
    }
  }
  if (charsInBuf)
    destString.Append(stackBuf, charsInBuf);
  return (c == EOF && destString.IsEmpty()) ? EOF : 1;
}

Variable Documentation

Definition at line 58 of file nsSharedPrefHandler.cpp.

Definition at line 66 of file nsSharedPrefHandler.cpp.

Definition at line 64 of file nsSharedPrefHandler.cpp.