Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations | Functions
nsJAR.cpp File Reference
#include <string.h>
#include "nsJARInputStream.h"
#include "nsJAR.h"
#include "nsILocalFile.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "plbase64.h"
#include "nsIConsoleService.h"
#include "nscore.h"
#include "nsCRT.h"
#include "nsICryptoHash.h"

Go to the source code of this file.

Classes

class  nsJARManifestItem
struct  ZipFindData

Defines

#define NS_ERROR_FILE_UNRECOGNIZED_PATH   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 1)
#define NS_ERROR_FILE_UNRESOLVABLE_SYMLINK   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 2)
#define NS_ERROR_FILE_EXECUTION_FAILED   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 3)
#define NS_ERROR_FILE_UNKNOWN_TYPE   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 4)
#define NS_ERROR_FILE_DESTINATION_NOT_DIR   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 5)
#define NS_ERROR_FILE_TARGET_DOES_NOT_EXIST   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 6)
#define NS_ERROR_FILE_COPY_OR_MOVE_FAILED   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 7)
#define NS_ERROR_FILE_ALREADY_EXISTS   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 8)
#define NS_ERROR_FILE_INVALID_PATH   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 9)
#define NS_ERROR_FILE_DISK_FULL   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 10)
#define NS_ERROR_FILE_CORRUPTED   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 11)
#define JAR_NULLFREE(_ptr)
#define JAR_MF   1
#define JAR_SF   2
#define JAR_MF_SEARCH_STRING   "(M|/M)ETA-INF/(M|m)(ANIFEST|anifest).(MF|mf)$"
#define JAR_SF_SEARCH_STRING   "(M|/M)ETA-INF/*.(SF|sf)$"
#define JAR_MF_HEADER   (const char*)"Manifest-Version: 1.0"
#define JAR_SF_HEADER   (const char*)"Signature-Version: 1.0"

Enumerations

enum  JARManifestItemType { JAR_INVALID = 1, JAR_INTERNAL = 2, JAR_EXTERNAL = 3 }

Functions

static nsresult ziperr2nsresult (PRInt32 ziperr)
 DeleteManifestEntry (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK DropZipReaderCache (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK FindOldestZip (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK FindZip (nsHashKey *aKey, void *aData, void *closure)
static PRBool PR_CALLBACK FindFlushableZip (nsHashKey *aKey, void *aData, void *closure)

Class Documentation

struct ZipFindData

Definition at line 1268 of file nsJAR.cpp.

Collaboration diagram for ZipFindData:
Class Members
PRBool found
nsJAR * zip

Define Documentation

#define JAR_MF   1

Definition at line 528 of file nsJAR.cpp.

#define JAR_MF_HEADER   (const char*)"Manifest-Version: 1.0"

Definition at line 532 of file nsJAR.cpp.

#define JAR_MF_SEARCH_STRING   "(M|/M)ETA-INF/(M|m)(ANIFEST|anifest).(MF|mf)$"

Definition at line 530 of file nsJAR.cpp.

#define JAR_NULLFREE (   _ptr)
Value:
{                        \
    PR_FREEIF(_ptr);       \
    _ptr = nsnull;         \
  }

Definition at line 95 of file nsJAR.cpp.

#define JAR_SF   2

Definition at line 529 of file nsJAR.cpp.

#define JAR_SF_HEADER   (const char*)"Signature-Version: 1.0"

Definition at line 533 of file nsJAR.cpp.

#define JAR_SF_SEARCH_STRING   "(M|/M)ETA-INF/*.(SF|sf)$"

Definition at line 531 of file nsJAR.cpp.

Definition at line 72 of file nsJAR.cpp.

Definition at line 71 of file nsJAR.cpp.

Definition at line 75 of file nsJAR.cpp.

Definition at line 69 of file nsJAR.cpp.

Definition at line 74 of file nsJAR.cpp.

Definition at line 67 of file nsJAR.cpp.

Definition at line 73 of file nsJAR.cpp.

Definition at line 70 of file nsJAR.cpp.

Definition at line 68 of file nsJAR.cpp.

Definition at line 65 of file nsJAR.cpp.

Definition at line 66 of file nsJAR.cpp.


Enumeration Type Documentation

Enumerator:
JAR_INVALID 
JAR_INTERNAL 
JAR_EXTERNAL 

Definition at line 111 of file nsJAR.cpp.


Function Documentation

DeleteManifestEntry ( nsHashKey *  aKey,
void aData,
void closure 
)

Definition at line 160 of file nsJAR.cpp.

{
//-- deletes an entry in  mManifestData.
  delete (nsJARManifestItem*)aData;
  return PR_TRUE;
}
static PRBool PR_CALLBACK DropZipReaderCache ( nsHashKey *  aKey,
void aData,
void closure 
) [static]

Definition at line 1184 of file nsJAR.cpp.

{
  nsJAR* zip = (nsJAR*)aData;
  zip->SetZipReaderCache(nsnull);
  return PR_TRUE;
}
static PRBool PR_CALLBACK FindFlushableZip ( nsHashKey *  aKey,
void aData,
void closure 
) [static]

Definition at line 1351 of file nsJAR.cpp.

{
  nsHashKey** flushableKeyPtr = (nsHashKey**)closure;
  nsJAR* current = (nsJAR*)aData;
  
  if (current->GetReleaseTime() != PR_INTERVAL_NO_TIMEOUT) {
    *flushableKeyPtr = aKey;
    current->SetZipReaderCache(nsnull);
    return PR_FALSE;
  }
  return PR_TRUE;
}
static PRBool PR_CALLBACK FindOldestZip ( nsHashKey *  aKey,
void aData,
void closure 
) [static]

Definition at line 1253 of file nsJAR.cpp.

{
  nsJAR** oldestPtr = (nsJAR**)closure;
  nsJAR* oldest = *oldestPtr;
  nsJAR* current = (nsJAR*)aData;
  PRIntervalTime currentReleaseTime = current->GetReleaseTime();
  if (currentReleaseTime != PR_INTERVAL_NO_TIMEOUT) {
    if (oldest == nsnull ||
        currentReleaseTime < oldest->GetReleaseTime()) {
      *oldestPtr = current;
    }    
  }
  return PR_TRUE;
}
static PRBool PR_CALLBACK FindZip ( nsHashKey *  aKey,
void aData,
void closure 
) [static]

Definition at line 1271 of file nsJAR.cpp.

{
  ZipFindData* find_data = (ZipFindData*)closure;

  if (find_data->zip == (nsJAR*)aData) {
    find_data->found = PR_TRUE; 
    return PR_FALSE;
  }
  return PR_TRUE;
}
static nsresult ziperr2nsresult ( PRInt32  ziperr) [static]

Definition at line 79 of file nsJAR.cpp.