Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsOSHelperAppService.cpp File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include "nsOSHelperAppService.h"
#include "nsISupports.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "nsXPIDLString.h"
#include "nsIURL.h"
#include "nsIFileStreams.h"
#include "nsILineInputStream.h"
#include "nsILocalFile.h"
#include "nsIProcess.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsNetCID.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsHashtable.h"
#include "nsCRT.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "prenv.h"
#include "nsAutoPtr.h"
#include <stdlib.h>

Go to the source code of this file.

Defines

#define LOG(args)   PR_LOG(mLog, PR_LOG_DEBUG, args)
#define LOG_ENABLED()   PR_LOG_TEST(mLog, PR_LOG_DEBUG)

Functions

static nsresult FindSemicolon (nsAString::const_iterator &aSemicolon_iter, const nsAString::const_iterator &aEnd_iter)
static nsresult ParseMIMEType (const nsAString::const_iterator &aStart_iter, nsAString::const_iterator &aMajorTypeStart, nsAString::const_iterator &aMajorTypeEnd, nsAString::const_iterator &aMinorTypeStart, nsAString::const_iterator &aMinorTypeEnd, const nsAString::const_iterator &aEnd_iter)
PRBool IsNetscapeFormat (const nsACString &aBuffer)

Define Documentation

#define LOG (   args)    PR_LOG(mLog, PR_LOG_DEBUG, args)

Definition at line 71 of file nsOSHelperAppService.cpp.

Definition at line 72 of file nsOSHelperAppService.cpp.


Function Documentation

static nsresult FindSemicolon ( nsAString::const_iterator &  aSemicolon_iter,
const nsAString::const_iterator &  aEnd_iter 
) [static]

Definition at line 132 of file nsOSHelperAppService.cpp.

                                                        {
  PRBool semicolonFound = PR_FALSE;
  while (aSemicolon_iter != aEnd_iter && !semicolonFound) {
    switch(*aSemicolon_iter) {
    case '\\':
      aSemicolon_iter.advance(2);
      break;
    case ';':
      semicolonFound = PR_TRUE;
      break;
    default:
      ++aSemicolon_iter;
      break;
    }
  }
  return NS_OK;
}
PRBool IsNetscapeFormat ( const nsACString &  aBuffer) [inline]
static nsresult ParseMIMEType ( const nsAString::const_iterator &  aStart_iter,
nsAString::const_iterator &  aMajorTypeStart,
nsAString::const_iterator &  aMajorTypeEnd,
nsAString::const_iterator &  aMinorTypeStart,
nsAString::const_iterator &  aMinorTypeEnd,
const nsAString::const_iterator &  aEnd_iter 
) [static]

Definition at line 152 of file nsOSHelperAppService.cpp.

                                                        {
  nsAString::const_iterator iter(aStart_iter);
  
  // skip leading whitespace
  while (iter != aEnd_iter && nsCRT::IsAsciiSpace(*iter)) {
    ++iter;
  }

  if (iter == aEnd_iter) {
    return NS_ERROR_INVALID_ARG;
  }
  
  aMajorTypeStart = iter;

  // find major/minor separator ('/')
  while (iter != aEnd_iter && *iter != '/') {
    ++iter;
  }
  
  if (iter == aEnd_iter) {
    return NS_ERROR_INVALID_ARG;
  }

  aMajorTypeEnd = iter;
  
  // skip '/'
  ++iter;

  if (iter == aEnd_iter) {
    return NS_ERROR_INVALID_ARG;
  }

  aMinorTypeStart = iter;

  // find end of minor type, delimited by whitespace or ';'
  while (iter != aEnd_iter && !nsCRT::IsAsciiSpace(*iter) && *iter != ';') {
    ++iter;
  }

  aMinorTypeEnd = iter;

  return NS_OK;
}