landing pics
git-svn-id: svn://10.0.0.236/trunk@30674 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
284fe20f2b
commit
e7d2323646
@ -90,7 +90,7 @@ struct CSLabel_s {
|
||||
|
||||
ServiceInfo_t * pCurrentServiceInfo;
|
||||
Label_t * pCurrentLabel;
|
||||
int currentLabelNumber;
|
||||
PRInt32 currentLabelNumber;
|
||||
HTList * pCurrentLabelTree;
|
||||
SingleLabel_t * pCurrentSingleLabel;
|
||||
LabelRating_t * pCurrentLabelRating;
|
||||
@ -242,7 +242,7 @@ PRIVATE StateToken_t SingleLabel_stateTokens[] = {
|
||||
{"label extension", SubState_A, Punct_LPAREN, 0, "extension", 0, 0, &Extension_targetObject, SubState_N, Command_NONE, 0},
|
||||
{ "label option", SubState_A, Punct_WHITE, &getOption, 0, 0, 0, &SingleLabel_targetObject, SubState_B, Command_NONE, 0},
|
||||
{ "ratingword", SubState_A, Punct_LPAREN, 0, "r", "ratings", 0, &LabelRating_targetObject, SubState_N, Command_NONE, 0},
|
||||
{ "option value", SubState_B, Punct_WHITE, &getOptionValue, 0, 0, 0, &SingleLabel_targetObject, SubState_A, Command_CLOSE, 0}
|
||||
{ "option value", SubState_B, Punct_WHITE, &getOptionValue, 0, 0, 0, &SingleLabel_targetObject, SubState_A, Command_CLOSE, 0}
|
||||
};
|
||||
|
||||
PRIVATE StateToken_t LabelRating_stateTokens[] = {
|
||||
@ -346,7 +346,7 @@ PRIVATE StateToken_t ExtensionData_stateTokens[] = {
|
||||
};
|
||||
|
||||
|
||||
PRIVATE void init_target_obj(TargetObject_t *obj, char *note, Open_t *pOpen, Close_t *pClose, Destroy_t *pDestroy, StateToken_t *stateToken, int stateTokenCount, CSParseTC_t targetChange)
|
||||
PRIVATE void init_target_obj(TargetObject_t *obj, char *note, Open_t *pOpen, Close_t *pClose, Destroy_t *pDestroy, StateToken_t *stateToken, PRInt32 stateTokenCount, CSParseTC_t targetChange)
|
||||
{
|
||||
obj->note = note;
|
||||
obj->pOpen = pOpen;
|
||||
@ -359,11 +359,11 @@ PRIVATE void init_target_obj(TargetObject_t *obj, char *note, Open_t *pOpen, Clo
|
||||
|
||||
PRIVATE void CSinitialize_global_data(void)
|
||||
{
|
||||
static PRBool first_time=TRUE;
|
||||
static PRBool first_time=PR_TRUE;
|
||||
|
||||
if(first_time)
|
||||
{
|
||||
first_time = FALSE;
|
||||
first_time = PR_FALSE;
|
||||
|
||||
init_target_obj(&LabelList_targetObject, "LabelList", &LabelList_open, &LabelList_close, &LabelList_destroy, LabelList_stateTokens, raysize(LabelList_stateTokens), CSLLTC_LIST);
|
||||
init_target_obj(&ServiceInfo_targetObject, "ServiceInfo", ServiceInfo_open, &ServiceInfo_close, &ServiceInfo_destroy, ServiceInfo_stateTokens, raysize(ServiceInfo_stateTokens), CSLLTC_SERVICE);
|
||||
@ -657,7 +657,7 @@ PUBLIC char * CSLabel_getServiceName(CSLabel_t * pCSLabel)
|
||||
SVal_value(&pCSLabel->pCurrentServiceInfo->rating_service): 0;}
|
||||
PUBLIC Label_t * CSLabel_getLabel(CSLabel_t * pCSLabel)
|
||||
{return pCSLabel->pCurrentLabel;}
|
||||
PUBLIC int CSLabel_getLabelNumber(CSLabel_t * pCSLabel)
|
||||
PUBLIC PRInt32 CSLabel_getLabelNumber(CSLabel_t * pCSLabel)
|
||||
{return pCSLabel->currentLabelNumber;}
|
||||
PUBLIC SingleLabel_t * CSLabel_getSingleLabel(CSLabel_t * pCSLabel)
|
||||
{return pCSLabel->pCurrentSingleLabel;}
|
||||
@ -674,7 +674,7 @@ PUBLIC char * CSLabel_getRatingStr(CSLabel_t * pCSLabel)
|
||||
HTList * ranges;
|
||||
Range_t * curRange;
|
||||
FVal_t fVal;
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
fVal = CSLabel_getLabelRating(pCSLabel)->value;
|
||||
if (FVal_initialized(&fVal))
|
||||
return FVal_toStr(&fVal);
|
||||
@ -746,7 +746,7 @@ PRIVATE StateRet_t parseErrorHandler(CSParse_t * pCSParse, const char * token, c
|
||||
PRIVATE PRBool charSetOK(CSParse_t * pCSParse, char * checkMe, CharSet_t set)
|
||||
{
|
||||
if(!checkMe)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
for (;*checkMe;checkMe++) {
|
||||
if (set & CharSet_ALPHAS &&
|
||||
@ -790,9 +790,9 @@ PRIVATE PRBool charSetOK(CSParse_t * pCSParse, char * checkMe, CharSet_t set)
|
||||
*checkMe == '/' || *checkMe == '-'))
|
||||
continue;
|
||||
pCSParse->pParseContext->pTokenError = checkMe;
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif /* !NO_CHAR_TEST */
|
||||
|
||||
@ -1454,7 +1454,7 @@ PUBLIC CSError_t CSLabel_iterateServices(CSLabel_t * pCSLabel, CSLabel_callback_
|
||||
{
|
||||
HTList * serviceInfos;
|
||||
CSError_t ret = CSError_OK;
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
if (!pIteratorCB ||
|
||||
!pCSLabel ||
|
||||
!pCSLabel->pCSLLData->serviceInfos)
|
||||
@ -1480,7 +1480,7 @@ PUBLIC CSError_t CSLabel_iterateLabels(CSLabel_t * pCSLabel, CSLabel_callback_t
|
||||
{
|
||||
HTList * labels;
|
||||
CSError_t ret= CSError_OK;
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
if (!pIteratorCB ||
|
||||
!pCSLabel ||
|
||||
!pCSLabel->pCurrentServiceInfo ||
|
||||
@ -1501,7 +1501,7 @@ PUBLIC CSError_t CSLabel_iterateLabels(CSLabel_t * pCSLabel, CSLabel_callback_t
|
||||
PUBLIC CSError_t CSLabel_iterateSingleLabels(CSLabel_t * pCSLabel, CSLabel_callback_t * pIteratorCB, State_Parms_t * pParms, const char * identifier, void * pVoid)
|
||||
{
|
||||
CSError_t ret= CSError_OK;
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
if (!pIteratorCB ||
|
||||
!pCSLabel ||
|
||||
!pCSLabel->pCurrentServiceInfo ||
|
||||
@ -1532,7 +1532,7 @@ PUBLIC CSError_t CSLabel_iterateLabelRatings(CSLabel_t * pCSLabel, CSLabel_callb
|
||||
{
|
||||
HTList * labelRatings;
|
||||
CSError_t ret = CSError_OK;
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
if (!pIteratorCB ||
|
||||
!pCSLabel ||
|
||||
!pCSLabel->pCurrentServiceInfo ||
|
||||
@ -1554,7 +1554,7 @@ PUBLIC CSError_t CSLabel_iterateLabelRatings(CSLabel_t * pCSLabel, CSLabel_callb
|
||||
|
||||
/* R A N G E T E S T I N G - check that label values fall within acceptable user ranges */
|
||||
/* CSLabel_ratingsIncludeFVal - find out if current rating in pCSLabel encompases userValue
|
||||
* return: int stating how far it is from fitting.
|
||||
* return: PRInt32 stating how far it is from fitting.
|
||||
*/
|
||||
PUBLIC FVal_t CSLabel_ratingsIncludeFVal(CSLabel_t * pCSLabel, FVal_t * userValue)
|
||||
{
|
||||
|
||||
@ -122,7 +122,7 @@ extern CSLabel_t * CSLabel_copy(CSLabel_t * old);
|
||||
extern void CSLabel_free(CSLabel_t * me);
|
||||
|
||||
extern char * CSLabel_getServiceName(CSLabel_t * pCSLabel);
|
||||
extern int CSLabel_getLabelNumber(CSLabel_t * pCSLabel);
|
||||
extern PRInt32 CSLabel_getLabelNumber(CSLabel_t * pCSLabel);
|
||||
extern char * CSLabel_getRatingName(CSLabel_t * pCSLabel);
|
||||
extern char * CSLabel_getRatingStr(CSLabel_t * pCSLabel);
|
||||
extern Range_t * CSLabel_getLabelRatingRange(CSLabel_t * pCSLabel);
|
||||
|
||||
@ -184,7 +184,7 @@ struct CSLLData_s {
|
||||
/* some usefull flags */
|
||||
PRBool complete;
|
||||
PRBool hasTree; /* so it can't make a list of labels */
|
||||
int mandatoryExtensions;
|
||||
PRInt32 mandatoryExtensions;
|
||||
};
|
||||
/*
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ extern void FVal_clear(FVal_t * pFVal);
|
||||
|
||||
PRBool isZero - see if value is zero
|
||||
|
||||
int isInfinite - -1 or 1 for negative or positive infinity
|
||||
PRInt32 isInfinite - -1 or 1 for negative or positive infinity
|
||||
|
||||
PRBool nearerZero - see if check is nearer zero than check
|
||||
|
||||
@ -141,7 +141,7 @@ extern void FVal_clear(FVal_t * pFVal);
|
||||
extern void FVal_set(FVal_t * pFVal, float value);
|
||||
extern void FVal_setInfinite(FVal_t * pFVal, PRBool negative);
|
||||
extern PRBool FVal_isZero(const FVal_t * pFVal);
|
||||
extern int FVal_isInfinite(const FVal_t * pFVal);
|
||||
extern PRInt32 FVal_isInfinite(const FVal_t * pFVal);
|
||||
extern PRBool FVal_nearerZero(const FVal_t * pRef, const FVal_t * pCheck);
|
||||
extern FVal_t FVal_minus(const FVal_t * pBig, const FVal_t * pSmall);
|
||||
extern char * FVal_toStr(FVal_t * pFVal);
|
||||
@ -188,13 +188,13 @@ DVAL
|
||||
typedef struct {
|
||||
char * value; /* keep the string around for debugging and output */
|
||||
PRBool initialized;
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int minute;
|
||||
int timeZoneHours;
|
||||
int timeZoneMinutes;
|
||||
PRInt32 year;
|
||||
PRInt32 month;
|
||||
PRInt32 day;
|
||||
PRInt32 hour;
|
||||
PRInt32 minute;
|
||||
PRInt32 timeZoneHours;
|
||||
PRInt32 timeZoneMinutes;
|
||||
} DVal_t;
|
||||
|
||||
extern PRBool DVal_readVal(DVal_t * pDVal, const char * valueStr);
|
||||
@ -205,10 +205,10 @@ extern void DVal_clear(DVal_t * pDVal);
|
||||
|
||||
additional methods
|
||||
|
||||
int compare - -1 or 1 for a before or after b, 0 for equivilence
|
||||
PRInt32 compare - -1 or 1 for a before or after b, 0 for equivilence
|
||||
|
||||
*/
|
||||
extern int DVal_compare(const DVal_t * a, const DVal_t * b);
|
||||
extern PRInt32 DVal_compare(const DVal_t * a, const DVal_t * b);
|
||||
/*
|
||||
|
||||
RANGE
|
||||
@ -254,7 +254,7 @@ CSPARSE_PARSECHUNK
|
||||
typedef struct CSParse_s CSParse_t;
|
||||
typedef enum {CSDoMore_more, CSDoMore_done, CSDoMore_error} CSDoMore_t;
|
||||
extern CSDoMore_t CSParse_parseChunk (CSParse_t * pCSParse, const char * ptr,
|
||||
int len, void * pVoid);
|
||||
PRInt32 len, void * pVoid);
|
||||
/*
|
||||
|
||||
PARSE CALLBACKS
|
||||
@ -268,7 +268,7 @@ CSPARSETC
|
||||
object. It is used in the TargetChangeCallback
|
||||
|
||||
*/
|
||||
typedef unsigned int CSParseTC_t;
|
||||
typedef PRUint32 CSParseTC_t;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -52,7 +52,7 @@ with copyright holders.
|
||||
#include "cslutils.h"
|
||||
#include "csparse.h"
|
||||
|
||||
PUBLIC int ParseDebug = 0; /* For use with LablPars and RatPars */
|
||||
PUBLIC PRInt32 ParseDebug = 0; /* For use with LablPars and RatPars */
|
||||
|
||||
PUBLIC PRBool BVal_readVal(BVal_t * pBVal, const char * valueStr)
|
||||
{
|
||||
@ -120,14 +120,14 @@ PUBLIC float FVal_value(const FVal_t * pFVal)
|
||||
PRIVATE PRBool FVal_lessThan(const FVal_t * pSmall, const FVal_t * pBig)
|
||||
{
|
||||
if (pBig->stat == FVal_UNINITIALIZED || pSmall->stat == FVal_UNINITIALIZED)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
if (pBig->stat == FVal_POSITIVE_INF || pSmall->stat == FVal_NEGATIVE_INF) {
|
||||
if (pSmall->stat == FVal_POSITIVE_INF)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (pBig->stat == FVal_NEGATIVE_INF || pSmall->stat == FVal_POSITIVE_INF) {
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
return pSmall->value < pBig->value;
|
||||
}
|
||||
@ -188,7 +188,7 @@ PUBLIC void FVal_setInfinite(FVal_t * pFVal, PRBool negative)
|
||||
pFVal->stat = negative ? FVal_NEGATIVE_INF : FVal_POSITIVE_INF;
|
||||
}
|
||||
|
||||
PUBLIC int FVal_isInfinite(const FVal_t * pFVal)
|
||||
PUBLIC PRInt32 FVal_isInfinite(const FVal_t * pFVal)
|
||||
{
|
||||
return (pFVal->stat == FVal_POSITIVE_INF ? 1 : pFVal->stat == FVal_NEGATIVE_INF ? -1 : 0);
|
||||
}
|
||||
@ -236,13 +236,13 @@ PUBLIC void SVal_clear(SVal_t * pSVal)
|
||||
}
|
||||
|
||||
#if 0
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int minute;
|
||||
int timeZoneHours;
|
||||
int timeZoneMinutes;
|
||||
PRInt32 year;
|
||||
PRInt32 month;
|
||||
PRInt32 day;
|
||||
PRInt32 hour;
|
||||
PRInt32 minute;
|
||||
PRInt32 timeZoneHours;
|
||||
PRInt32 timeZoneMinutes;
|
||||
#endif
|
||||
PUBLIC PRBool DVal_readVal(DVal_t * pDVal, const char * valueStr)
|
||||
{
|
||||
@ -277,7 +277,7 @@ PUBLIC PRBool DVal_initialized(const DVal_t * pDVal)
|
||||
return (pDVal->initialized != NO);
|
||||
}
|
||||
|
||||
PUBLIC int DVal_compare(const DVal_t * a, const DVal_t * b)
|
||||
PUBLIC PRInt32 DVal_compare(const DVal_t * a, const DVal_t * b)
|
||||
{
|
||||
if (a->year > b->year) return 1;
|
||||
if (a->year < b->year) return -1;
|
||||
@ -416,9 +416,9 @@ PRIVATE StateRet_t callErrorHandler(CSParse_t * pCSParse,
|
||||
* NowIn_END - expect no more text or parens
|
||||
* NowIn_ERROR -
|
||||
*/
|
||||
PUBLIC CSDoMore_t CSParse_parseChunk (CSParse_t * pCSParse, const char * ptr, int len, void * pVoid)
|
||||
PUBLIC CSDoMore_t CSParse_parseChunk (CSParse_t * pCSParse, const char * ptr, PRInt32 len, void * pVoid)
|
||||
{
|
||||
int i;
|
||||
PRInt32 i;
|
||||
if (!len || !ptr)
|
||||
return CSDoMore_error;
|
||||
for (i = 0; i < len; i++) {
|
||||
@ -557,7 +557,7 @@ PRIVATE char * CSParse_subState2str(SubState_t subState)
|
||||
else if (subState == SubState_X)
|
||||
PL_strcpy(space, "X");
|
||||
else {
|
||||
int i;
|
||||
PRInt32 i;
|
||||
SubState_t comp;
|
||||
char ch[] = "A";
|
||||
for (i = 1, comp = SubState_A; i < (sizeof(SubState_t)*8 - 1); i++, (*ch)++, comp<<=1)
|
||||
@ -567,7 +567,7 @@ PRIVATE char * CSParse_subState2str(SubState_t subState)
|
||||
return space;
|
||||
}
|
||||
|
||||
PRIVATE int ParseTrace(const char * fmt, ...)
|
||||
PRIVATE PRInt32 ParseTrace(const char * fmt, ...)
|
||||
{
|
||||
va_list pArgs;
|
||||
|
||||
@ -585,7 +585,7 @@ PUBLIC NowIn_t CSParse_targetParser(CSParse_t * pCSParse, char demark, void * pV
|
||||
PRBool failedOnPunct = NO;
|
||||
char * token = 0;
|
||||
StateRet_t ret = StateRet_OK;
|
||||
int i;
|
||||
PRInt32 i;
|
||||
static NowIn_t lastRet = NowIn_END;
|
||||
|
||||
/* changed by montulli@netscape.com 11/29/97
|
||||
@ -651,7 +651,7 @@ static NowIn_t lastRet = NowIn_END;
|
||||
return NowIn_ERROR;
|
||||
|
||||
if (pStateToken->command & (Command_OPEN|Command_CLOSE) && pCSParse->pParseContext->pTargetChangeCallback) {
|
||||
ParseTrace("%3d", pStateToken->command & Command_CLOSE ? -(int)pTargetObject->targetChange : pTargetObject->targetChange);
|
||||
ParseTrace("%3d", pStateToken->command & Command_CLOSE ? -(PRInt32)pTargetObject->targetChange : pTargetObject->targetChange);
|
||||
if ((*pCSParse->pParseContext->pTargetChangeCallback)(pCSParse, pTargetObject, pTargetObject->targetChange,
|
||||
(PRBool)(pStateToken->command & Command_CLOSE), pVoid) == StateRet_ERROR)
|
||||
return NowIn_ERROR;
|
||||
|
||||
@ -259,7 +259,7 @@ struct TargetObject_s {
|
||||
Close_t * pClose; /* call this function to close structure */
|
||||
Destroy_t * pDestroy;
|
||||
StateToken_t * stateTokens; /* array of sub states */
|
||||
int stateTokenCount; /* number of sub states */
|
||||
PRInt32 stateTokenCount; /* number of sub states */
|
||||
CSParseTC_t targetChange; /* target change signal for opening this parse state */
|
||||
};
|
||||
/*
|
||||
@ -305,7 +305,7 @@ typedef struct {
|
||||
PRBool observeQuotes;
|
||||
PRBool observedQuotes;
|
||||
char * legalChars;
|
||||
int legalCharCount;
|
||||
PRInt32 legalCharCount;
|
||||
} ParseContext_t;
|
||||
/*
|
||||
|
||||
@ -319,8 +319,8 @@ struct CSParse_s {
|
||||
NowIn_t nowIn;
|
||||
HTChunk * token;
|
||||
char demark;
|
||||
int offset;
|
||||
int depth;
|
||||
PRInt32 offset;
|
||||
PRInt32 depth;
|
||||
ParseContext_t * pParseContext;
|
||||
union { /* all the types this parse engine fills */
|
||||
CSMachRead_t * pCSMachRead; /* defined in CSMacRed.c */
|
||||
|
||||
@ -33,7 +33,7 @@ with copyright holders.
|
||||
**
|
||||
** (c) COPYRIGHT MIT 1995.
|
||||
** Please first read the full copyright statement in the file COPYRIGH.
|
||||
** @(#) $Id: htchunk.c,v 1.1 1999-03-18 22:32:48 neeti%netscape.com Exp $
|
||||
** @(#) $Id: htchunk.c,v 1.2 1999-05-07 05:26:11 neeti%netscape.com Exp $
|
||||
**
|
||||
** history: AL, HF 28 Apr 94, Now chunk->data is filled by '\0' so
|
||||
** that the string is terminated at any time. That makes
|
||||
@ -52,7 +52,7 @@ with copyright holders.
|
||||
/* Create a chunk with a certain allocation unit
|
||||
** --------------
|
||||
*/
|
||||
PUBLIC HTChunk * HTChunk_new (int grow)
|
||||
PUBLIC HTChunk * HTChunk_new (PRInt32 grow)
|
||||
{
|
||||
HTChunk * ch;
|
||||
if ((ch = (HTChunk *) HT_CALLOC(1, sizeof(HTChunk))) == NULL)
|
||||
@ -90,7 +90,7 @@ PUBLIC void HTChunk_delete (HTChunk * ch)
|
||||
/* Create a chunk from an allocated string
|
||||
** ---------------------------------------
|
||||
*/
|
||||
PUBLIC HTChunk * HTChunk_fromCString (char * str, int grow)
|
||||
PUBLIC HTChunk * HTChunk_fromCString (char * str, PRInt32 grow)
|
||||
{
|
||||
HTChunk * ch;
|
||||
ch = HTChunk_new(grow);
|
||||
@ -140,17 +140,17 @@ PUBLIC void HTChunk_putc (HTChunk * ch, char c)
|
||||
*/
|
||||
PUBLIC void HTChunk_puts (HTChunk * ch, const char * s)
|
||||
{
|
||||
HTChunk_putb(ch, s, (int) PL_strlen(s));
|
||||
HTChunk_putb(ch, s, (PRInt32) PL_strlen(s));
|
||||
}
|
||||
|
||||
/* Append a block
|
||||
** ---------------
|
||||
** The string is always zero terminated
|
||||
*/
|
||||
PUBLIC void HTChunk_putb (HTChunk * ch, const char * block, int len)
|
||||
PUBLIC void HTChunk_putb (HTChunk * ch, const char * block, PRInt32 len)
|
||||
{
|
||||
if (ch && block && len) {
|
||||
int needed = ch->size+len;
|
||||
PRInt32 needed = ch->size+len;
|
||||
if (needed >= ch->allocated) {
|
||||
ch->allocated = needed - needed%ch->growby + ch->growby;
|
||||
if (ch->data) {
|
||||
@ -171,10 +171,10 @@ PUBLIC void HTChunk_putb (HTChunk * ch, const char * block, int len)
|
||||
/* Ensure a certain size
|
||||
** ---------------------
|
||||
*/
|
||||
PUBLIC void HTChunk_ensure (HTChunk * ch, int len)
|
||||
PUBLIC void HTChunk_ensure (HTChunk * ch, PRInt32 len)
|
||||
{
|
||||
if (ch && len) {
|
||||
int needed = ch->size+len;
|
||||
PRInt32 needed = ch->size+len;
|
||||
if (needed >= ch->allocated) {
|
||||
ch->allocated = needed - needed%ch->growby + ch->growby;
|
||||
if (ch->data) {
|
||||
|
||||
@ -64,9 +64,9 @@ THE CHUNK CLASS
|
||||
|
||||
*/
|
||||
typedef struct {
|
||||
int size; /* In bytes */
|
||||
int growby; /* Allocation unit in bytes */
|
||||
int allocated; /* Current size of *data */
|
||||
PRInt32 size; /* In bytes */
|
||||
PRInt32 growby; /* Allocation unit in bytes */
|
||||
PRInt32 allocated; /* Current size of *data */
|
||||
char * data; /* Pointer to malloced area or 0 */
|
||||
} HTChunk;
|
||||
/*
|
||||
@ -78,7 +78,7 @@ CREATE NEW CHUNK
|
||||
|
||||
*/
|
||||
#define HTChunkCreate(growby) HTChunk_new(growby)
|
||||
extern HTChunk * HTChunk_new (int growby);
|
||||
extern HTChunk * HTChunk_new (PRInt32 growby);
|
||||
/*
|
||||
|
||||
FREE A CHUNK
|
||||
@ -107,7 +107,7 @@ ENSURE A CHUNK HAS A CERTAIN AMOUNT OF FREE SPACE
|
||||
|
||||
*/
|
||||
#define HTChunkEnsure(ch, s) HTChunk_ensure(ch, s)
|
||||
extern void HTChunk_ensure (HTChunk * ch, int s);
|
||||
extern void HTChunk_ensure (HTChunk * ch, PRInt32 s);
|
||||
/*
|
||||
|
||||
APPEND A CHARACTER TO A CHUNK
|
||||
@ -134,7 +134,7 @@ APPEND A BLOCK TO A CHUNK
|
||||
Add the block and increment the size of the chunk by the len
|
||||
|
||||
*/
|
||||
extern void HTChunk_putb (HTChunk * ch, const char *block, int len);
|
||||
extern void HTChunk_putb (HTChunk * ch, const char *block, PRInt32 len);
|
||||
|
||||
/*
|
||||
|
||||
@ -167,7 +167,7 @@ CSTRING CONVERSIONS
|
||||
Once a string is built, the chunk may be destroyed and the string kept around.
|
||||
|
||||
*/
|
||||
extern HTChunk * HTChunk_fromCString (char * str, int grow);
|
||||
extern HTChunk * HTChunk_fromCString (char * str, PRInt32 grow);
|
||||
extern char * HTChunk_toCString (HTChunk * ch);
|
||||
/*
|
||||
|
||||
@ -187,6 +187,6 @@ RETURN CURRENT SIZE
|
||||
|
||||
___________________________________
|
||||
|
||||
@(#) $Id: htchunk.h,v 1.1 1999-03-18 22:32:48 neeti%netscape.com Exp $
|
||||
@(#) $Id: htchunk.h,v 1.2 1999-05-07 05:26:11 neeti%netscape.com Exp $
|
||||
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ with copyright holders.
|
||||
**
|
||||
** (c) COPYRIGHT MIT 1995.
|
||||
** Please first read the full copyright statement in the file COPYRIGH.
|
||||
** @(#) $Id: htlist.c,v 1.1 1999-03-18 22:32:48 neeti%netscape.com Exp $
|
||||
** @(#) $Id: htlist.c,v 1.2 1999-05-07 05:26:11 neeti%netscape.com Exp $
|
||||
**
|
||||
** A list is represented as a sequence of linked nodes of type HTList.
|
||||
** The first node is a header which contains no object.
|
||||
@ -155,19 +155,19 @@ PUBLIC void * HTList_firstObject (HTList * me)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PUBLIC int HTList_count (HTList * me)
|
||||
PUBLIC PRInt32 HTList_count (HTList * me)
|
||||
{
|
||||
int count = 0;
|
||||
PRInt32 count = 0;
|
||||
if (me)
|
||||
while ((me = me->next) != NULL)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
PUBLIC int HTList_indexOf (HTList * me, void * object)
|
||||
PUBLIC PRInt32 HTList_indexOf (HTList * me, void * object)
|
||||
{
|
||||
if (me) {
|
||||
int position = 0;
|
||||
PRInt32 position = 0;
|
||||
while ((me = me->next) != NULL) {
|
||||
if (me->object == object)
|
||||
return position;
|
||||
@ -177,7 +177,7 @@ PUBLIC int HTList_indexOf (HTList * me, void * object)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PUBLIC void * HTList_objectAt (HTList * me, int position)
|
||||
PUBLIC void * HTList_objectAt (HTList * me, PRInt32 position)
|
||||
{
|
||||
if (position < 0)
|
||||
return NULL;
|
||||
@ -191,7 +191,7 @@ PUBLIC void * HTList_objectAt (HTList * me, int position)
|
||||
return NULL; /* Reached the end of the list */
|
||||
}
|
||||
|
||||
PRIVATE void * HTList_removeObjectAt (HTList * me, int position)
|
||||
PRIVATE void * HTList_removeObjectAt (HTList * me, PRInt32 position)
|
||||
{
|
||||
if (position < 0)
|
||||
return NULL;
|
||||
|
||||
@ -106,7 +106,7 @@ SIZE OF A LIST
|
||||
|
||||
*/
|
||||
#define HTList_isEmpty(me) (me ? me->next == NULL : YES)
|
||||
extern int HTList_count (HTList *me);
|
||||
extern PRInt32 HTList_count (HTList *me);
|
||||
/*
|
||||
|
||||
REFERENCE LIST ELEMENTS BY INDEX
|
||||
@ -115,8 +115,8 @@ REFERENCE LIST ELEMENTS BY INDEX
|
||||
This is for example the case if an element can be registered multiple times.
|
||||
|
||||
*/
|
||||
extern int HTList_indexOf (HTList *me, void *object);
|
||||
extern void * HTList_objectAt (HTList *me, int position);
|
||||
extern PRInt32 HTList_indexOf (HTList *me, void *object);
|
||||
extern void * HTList_objectAt (HTList *me, PRInt32 position);
|
||||
/*
|
||||
|
||||
FIND LIST ELEMENTS
|
||||
@ -158,6 +158,6 @@ PR_END_EXTERN_C
|
||||
|
||||
___________________________________
|
||||
|
||||
@(#) $Id: htlist.h,v 1.1 1999-03-18 22:32:49 neeti%netscape.com Exp $
|
||||
@(#) $Id: htlist.h,v 1.2 1999-05-07 05:26:11 neeti%netscape.com Exp $
|
||||
|
||||
*/
|
||||
|
||||
@ -61,6 +61,9 @@ with copyright holders.
|
||||
*/
|
||||
#ifndef HTMEMORY_H
|
||||
#define HTMEMORY_H
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
|
||||
ALLOCATION, REALLOCATION AND DE-ALLOCATION
|
||||
@ -169,12 +172,15 @@ extern void HTMemory_outofmem(char * name, char * file, unsigned long line);
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* HTMEMORY_H */
|
||||
/*
|
||||
|
||||
|
||||
___________________________________
|
||||
|
||||
@(#) $Id: htmemory.h,v 1.1 1999-03-18 22:32:49 neeti%netscape.com Exp $
|
||||
@(#) $Id: htmemory.h,v 1.2 1999-05-07 05:26:11 neeti%netscape.com Exp $
|
||||
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ with copyright holders.
|
||||
**
|
||||
** (c) COPYRIGHT MIT 1995.
|
||||
** Please first read the full copyright statement in the file COPYRIGH.
|
||||
** @(#) $Id: htstring.c,v 1.1 1999-03-18 22:32:50 neeti%netscape.com Exp $
|
||||
** @(#) $Id: htstring.c,v 1.2 1999-05-07 05:26:12 neeti%netscape.com Exp $
|
||||
**
|
||||
** Original version came with listserv implementation.
|
||||
** Version TBL Oct 91 replaces one which modified the strings.
|
||||
@ -55,7 +55,7 @@ PUBLIC FILE *WWWTrace = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef WWW_WIN_DLL
|
||||
PUBLIC int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */
|
||||
PUBLIC PRInt32 WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */
|
||||
#endif
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ PUBLIC char * HTSACat (char ** dest, const char * src)
|
||||
{
|
||||
if (src && *src) {
|
||||
if (*dest) {
|
||||
int length = PL_strlen (*dest);
|
||||
PRInt32 length = PL_strlen (*dest);
|
||||
if ((*dest = (char *) HT_REALLOC(*dest, length + PL_strlen(src) + 1)) == NULL)
|
||||
HT_OUTOFMEM("HTSACat");
|
||||
PL_strcpy (*dest + length, src);
|
||||
@ -153,7 +153,7 @@ PUBLIC HTTraceCallback * HTTrace_getCallback(void)
|
||||
return PHTTraceCallback;
|
||||
}
|
||||
|
||||
PUBLIC int HTTrace(const char * fmt, ...)
|
||||
PUBLIC PRInt32 HTTrace(const char * fmt, ...)
|
||||
{
|
||||
va_list pArgs;
|
||||
va_start(pArgs, fmt);
|
||||
|
||||
@ -76,8 +76,8 @@ CASE-INSENSITIVE STRING COMPARISON
|
||||
The usual routines (comp instead of cmp) had some problem.
|
||||
|
||||
*/
|
||||
/* extern int strcasecomp (const char *a, const char *b); */
|
||||
/* extern int strncasecomp (const char *a, const char *b, int n); */
|
||||
/* extern PRInt32 strcasecomp (const char *a, const char *b); */
|
||||
/* extern PRInt32 strncasecomp (const char *a, const char *b, PRInt32 n); */
|
||||
/*
|
||||
|
||||
STRING COMPARISON WITH WILD CARD MATCH
|
||||
@ -126,6 +126,6 @@ PR_END_EXTERN_C
|
||||
|
||||
___________________________________
|
||||
|
||||
@(#) $Id: htstring.h,v 1.1 1999-03-18 22:32:50 neeti%netscape.com Exp $
|
||||
@(#) $Id: htstring.h,v 1.2 1999-05-07 05:26:12 neeti%netscape.com Exp $
|
||||
|
||||
*/
|
||||
|
||||
@ -67,10 +67,10 @@ DEBUG MESSAGE CONTROL
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
#ifdef WWW_WIN_DLL
|
||||
extern int * WWW_TraceFlag; /* In DLLs, we need the indirection */
|
||||
extern PRInt32 * WWW_TraceFlag; /* In DLLs, we need the indirection */
|
||||
#define WWWTRACE (*WWW_TraceFlag)
|
||||
#else
|
||||
extern int WWW_TraceFlag; /* Global flag for all W3 trace */
|
||||
extern PRInt32 WWW_TraceFlag; /* Global flag for all W3 trace */
|
||||
#define WWWTRACE (WWW_TraceFlag)
|
||||
#endif /* WWW_WIN_DLL */
|
||||
#else
|
||||
@ -132,13 +132,13 @@ typedef enum _HTTraceFlags {
|
||||
MyAppSpecificTrace
|
||||
|
||||
*/
|
||||
typedef int (*HTTraceCallback)(); /* jhines--7/9/97 */
|
||||
/* typedef int HTTraceCallback(const char * fmt, va_list pArgs); */
|
||||
typedef PRInt32 (*HTTraceCallback)(); /* jhines--7/9/97 */
|
||||
/* typedef PRInt32 HTTraceCallback(const char * fmt, va_list pArgs); */
|
||||
|
||||
extern void HTTrace_setCallback(HTTraceCallback * pCall);
|
||||
extern HTTraceCallback * HTTrace_getCallback(void);
|
||||
|
||||
extern int HTTrace(const char * fmt, ...);
|
||||
extern PRInt32 HTTrace(const char * fmt, ...);
|
||||
/*
|
||||
|
||||
MACROS FOR FUNCTION DECLARATIONS
|
||||
@ -210,7 +210,7 @@ UPPER- AND LOWERCASE MACROS
|
||||
/* #ifndef TOLOWER */
|
||||
/* #define TOLOWER(c) tolower(c) */
|
||||
/* #define TOUPPER(c) toupper(c) */
|
||||
#define TOUPPER(x) ((((unsigned int) (x)) > 0x7f) ? x : toupper(x))
|
||||
#define TOUPPER(x) ((((PRUint32) (x)) > 0x7f) ? x : toupper(x))
|
||||
/* #endif */
|
||||
/*
|
||||
|
||||
@ -260,6 +260,6 @@ LIBRARY DYNAMIC MEMORY MAGEMENT
|
||||
|
||||
___________________________________
|
||||
|
||||
@(#) $Id: htutils.h,v 1.1 1999-03-18 22:32:50 neeti%netscape.com Exp $
|
||||
@(#) $Id: htutils.h,v 1.2 1999-05-07 05:26:12 neeti%netscape.com Exp $
|
||||
|
||||
*/
|
||||
|
||||
@ -35,11 +35,11 @@ with copyright holders.
|
||||
#include "csll.h" /* to define states in stateChange */
|
||||
#include "csparse.h"
|
||||
|
||||
int Total;
|
||||
PRInt32 Total;
|
||||
|
||||
extern int ParseDebug;
|
||||
extern PRInt32 ParseDebug;
|
||||
|
||||
extern int SEC_ERROR_NO_MEMORY;
|
||||
extern PRInt32 SEC_ERROR_NO_MEMORY;
|
||||
|
||||
|
||||
PRIVATE
|
||||
@ -52,7 +52,7 @@ CSError_t spit(char* text, CSLabel_t * pCSMR, PRBool closed)
|
||||
LabelTargetCallback_t targetCallback;
|
||||
StateRet_t targetCallback(CSLabel_t * pCSMR, CSParse_t * pCSParse, CSLLTC_t target, PRBool closed, void * pVoid)
|
||||
{
|
||||
int change = closed ? -target : target;
|
||||
PRInt32 change = closed ? -target : target;
|
||||
|
||||
Total += change;
|
||||
if (!ParseDebug)
|
||||
@ -113,7 +113,7 @@ StateRet_t parseErrorHandler(CSLabel_t * pCSLabel, CSParse_t * pCSParse,
|
||||
/* #if 1 */
|
||||
#if 0
|
||||
/* use this main to test input with a series of labels, each on a line. */
|
||||
int main(int argc, char** argv)
|
||||
PRInt32 main(PRInt32 argc, char** argv)
|
||||
{
|
||||
char lineBuf[512];
|
||||
CSParse_t * pCSParse = 0;
|
||||
@ -132,7 +132,7 @@ int main(int argc, char** argv)
|
||||
ParseDebug = 1;
|
||||
pCSParse = CSParse_newLabel(&targetCallback, &parseErrorHandler);
|
||||
while (fgets(lineBuf, sizeof(lineBuf), input)){
|
||||
int len;
|
||||
PRInt32 len;
|
||||
char * ptr;
|
||||
for (ptr = lineBuf; *ptr; ptr++)
|
||||
if (*ptr == ';') {
|
||||
@ -156,7 +156,7 @@ int main(int argc, char** argv)
|
||||
last = CSDoMore_done;
|
||||
} else {
|
||||
printf("%s ", lineBuf); if (ParseDebug) printf("\n");
|
||||
switch (last = CSParse_parseChunk(pCSParse, lineBuf, (int) PL_strlen(lineBuf), 0)) {
|
||||
switch (last = CSParse_parseChunk(pCSParse, lineBuf, (PRInt32) PL_strlen(lineBuf), 0)) {
|
||||
case CSDoMore_done:
|
||||
printf("= %d - parsing end\n", Total);
|
||||
break;
|
||||
@ -181,7 +181,7 @@ int main(int argc, char** argv)
|
||||
#if 0
|
||||
|
||||
/* use this main to test input of a label list spread out over multiple lines*/
|
||||
int main(int argc, char** argv)
|
||||
PRInt32 main(PRInt32 argc, char** argv)
|
||||
{
|
||||
char lineBuf[512];
|
||||
while (gets(lineBuf)){
|
||||
@ -192,7 +192,7 @@ int main(int argc, char** argv)
|
||||
printf("%s", lineBuf);
|
||||
pCSParse = CSParse_newLabel(&targetCallback, &parseErrorHandler);
|
||||
if (CSParse_parseChunk(pCSParse, lineBuf,
|
||||
(int)PL_strlen(lineBuf), 0) != CSDoMore_done) {
|
||||
(PRInt32)PL_strlen(lineBuf), 0) != CSDoMore_done) {
|
||||
printf("parsing end error\n");
|
||||
break;
|
||||
}
|
||||
@ -204,7 +204,7 @@ int main(int argc, char** argv)
|
||||
#endif
|
||||
|
||||
#if 0 /* a not-needed but often useful sample implementation of HTTrace */
|
||||
int HTTrace(const char * fmt, ...)
|
||||
PRInt32 HTTrace(const char * fmt, ...)
|
||||
{
|
||||
va_list pArgs;
|
||||
va_start(pArgs, fmt);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
DEPTH=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEFINES=-D_IMPL_NS_WEB -DWIN32_LEAN_AND_MEAN
|
||||
DEFINES=-D_IMPL_NS_PICS -DWIN32_LEAN_AND_MEAN
|
||||
MODULE=pics
|
||||
|
||||
CSRCS= \
|
||||
@ -32,6 +32,7 @@ CSRCS= \
|
||||
|
||||
CPPSRCS= \
|
||||
nsPICS.cpp \
|
||||
nsPICSElementObserver.cpp \
|
||||
$(NULL)
|
||||
|
||||
C_OBJS= \
|
||||
@ -46,6 +47,7 @@ C_OBJS= \
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nspics.obj \
|
||||
.\$(OBJDIR)\nsPICSElementObserver.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = -I$(PUBLIC)/js \
|
||||
@ -75,6 +77,7 @@ LLIBS = \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\raptorhtmlpars.lib \
|
||||
$(HASHLIBS)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
227
mozilla/extensions/pics/src/nsPICSElementObserver.cpp
Normal file
227
mozilla/extensions/pics/src/nsPICSElementObserver.cpp
Normal file
@ -0,0 +1,227 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define NS_IMPL_IDS
|
||||
#include "pratom.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsRepository.h"
|
||||
//#include "nsIObserver.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsPICSElementObserver.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPICS.h"
|
||||
#include "nspics.h"
|
||||
#include "nsIWebShellServices.h"
|
||||
#include "prenv.h"
|
||||
|
||||
//static NS_DEFINE_IID(kIObserverIID, NS_IOBSERVER_IID);
|
||||
//static NS_DEFINE_IID(kObserverCID, NS_OBSERVER_CID);
|
||||
static NS_DEFINE_IID(kIPICSElementObserverIID, NS_IPICSELEMENTOBSERVER_IID);
|
||||
static NS_DEFINE_IID(kIElementObserverIID, NS_IELEMENTOBSERVER_IID);
|
||||
static NS_DEFINE_IID(kIObserverIID, NS_IOBSERVER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIPICSIID, NS_IPICS_IID);
|
||||
static NS_DEFINE_IID(kPICSCID, NS_PICS_CID);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsPICSElementObserver Implementation
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsPICSElementObserver) \
|
||||
NS_IMPL_RELEASE(nsPICSElementObserver)
|
||||
|
||||
NS_PICS nsresult NS_NewPICSElementObserver(nsIObserver** anObserver)
|
||||
{
|
||||
if (anObserver == NULL)
|
||||
{
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsPICSElementObserver* it = new nsPICSElementObserver();
|
||||
|
||||
if (it == 0) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(kIPICSElementObserverIID, (void **) anObserver);
|
||||
}
|
||||
|
||||
nsPICSElementObserver::nsPICSElementObserver()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPICSElementObserver::~nsPICSElementObserver(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPICSElementObserver::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if( NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
if( aIID.Equals ( kIPICSElementObserverIID )) {
|
||||
*aInstancePtr = (void*) ((nsIElementObserver*) this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if( aIID.Equals ( kIElementObserverIID )) {
|
||||
*aInstancePtr = (void*) ((nsIElementObserver*) this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if( aIID.Equals ( kIObserverIID )) {
|
||||
*aInstancePtr = (void*) ((nsIObserver*) this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if( aIID.Equals ( kISupportsIID )) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
const char* nsPICSElementObserver::GetTagName()
|
||||
{
|
||||
return "META";
|
||||
// return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPICSElementObserver::Notify(PRUint32 aDocumentID, eHTMLTags aTag,
|
||||
PRUint32 numOfAttributes, const PRUnichar* nameArray[],
|
||||
const PRUnichar* valueArray[])
|
||||
{
|
||||
nsresult rv;
|
||||
int status;
|
||||
nsIWebShellServices* ws;
|
||||
// nsString theURL(aSpec);
|
||||
// char* url = aSpec.ToNewCString();
|
||||
nsIURL* uaURL = nsnull;
|
||||
// rv = NS_NewURL(&uaURL, nsString(aSpec));
|
||||
|
||||
if(numOfAttributes >= 2) {
|
||||
const nsString& theValue1=valueArray[0];
|
||||
char *val1 = theValue1.ToNewCString();
|
||||
if(theValue1.EqualsIgnoreCase("\"PICS-LABEL\"")) {
|
||||
printf("\nReceived notification for a PICS-LABEl\n");
|
||||
const nsString& theValue2=valueArray[1];
|
||||
char *label = theValue2.ToNewCString();
|
||||
if (valueArray[numOfAttributes]) {
|
||||
const nsString& theURLValue=valueArray[numOfAttributes];
|
||||
rv = NS_NewURL(&uaURL, theURLValue);
|
||||
}
|
||||
nsIPICS *pics = NULL;
|
||||
rv = nsRepository::CreateInstance(kPICSCID,
|
||||
NULL,
|
||||
kIPICSIID,
|
||||
(void **) &pics);
|
||||
if(rv == NS_OK) {
|
||||
pics->GetWebShell(aDocumentID, ws);
|
||||
if(ws) {
|
||||
status = pics->ProcessPICSLabel(label);
|
||||
if(uaURL)
|
||||
pics->SetNotified(ws, uaURL, PR_TRUE);
|
||||
|
||||
if(status) {
|
||||
if(ws) {
|
||||
char * text = PR_GetEnv("NGLAYOUT_HOME");
|
||||
nsString mtemplateURL = text ? text : "resource:/res/samples/picstest1.html";
|
||||
// ws->LoadURL(mtemplateURL, nsnull, nsnull);
|
||||
nsCharsetSource s;
|
||||
ws->StopDocumentLoad();
|
||||
ws->LoadDocument("resource:/res/samples/picstest1.html", nsnull, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPICSElementObserver::Notify(nsISupports** result)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsPICSElementObserverFactory Implementation
|
||||
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsPICSElementObserverFactory, kIFactoryIID);
|
||||
|
||||
nsPICSElementObserverFactory::nsPICSElementObserverFactory(void)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPICSElementObserverFactory::~nsPICSElementObserverFactory(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPICSElementObserverFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
nsIObserver* inst = nsnull;
|
||||
|
||||
if (NS_FAILED(rv = NS_NewPICSElementObserver(&inst)))
|
||||
return rv;
|
||||
|
||||
if (!inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*aResult = NULL;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPICSElementObserverFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Loading…
x
Reference in New Issue
Block a user