mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Patches for OpenVMS and conversions to nsQuickSort(). Thanks to Colin Blake and James Lewis Nance (resp)
This commit is contained in:
parent
d2a54b2441
commit
4b0ff2c414
@ -39,10 +39,6 @@
|
||||
#include <stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for SEEK_SET and SEEK_END on some platforms */
|
||||
#endif
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prio.h"
|
||||
#include "prdtoa.h"
|
||||
@ -55,7 +51,7 @@
|
||||
#include "nsZip.h"
|
||||
#include "zlib.h"
|
||||
#include "xp.h" /* for XP_STRDUP */
|
||||
#include "xp_qsort.h"
|
||||
#include "nsQuickSort.h"
|
||||
#include "prmem.h"
|
||||
#include "prerror.h"
|
||||
|
||||
@ -183,7 +179,7 @@ static void
|
||||
ns_zip_errmsg(const char *msg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PRFileDesc* prfd = PR_GetSpecialFD(2);
|
||||
PRFileDesc* prfd = PR_GetSpecialFD(PR_StandardError);
|
||||
PR_Write(prfd, msg, strlen(msg));
|
||||
#endif
|
||||
}
|
||||
@ -317,7 +313,7 @@ nsZipFindEnd(ns_zip_t *zip, char *endbuf)
|
||||
PRUint32 len, off, mark;
|
||||
|
||||
/* Need to search backwards from end of file */
|
||||
if ((len = PR_Seek(zip->fd, 0, SEEK_END)) == -1) {
|
||||
if ((len = PR_Seek(zip->fd, 0, PR_SEEK_END)) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -342,7 +338,7 @@ nsZipFindEnd(ns_zip_t *zip, char *endbuf)
|
||||
for (off = len; off > mark; ) {
|
||||
long n = min(off - mark, INBUFSIZ);
|
||||
memcpy(buf + n, buf, SIGSIZ);
|
||||
if (PR_Seek(zip->fd, off -= n, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, off -= n, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -364,7 +360,7 @@ nsZipFindEnd(ns_zip_t *zip, char *endbuf)
|
||||
if ((buf+n-bp) >= ENDHDRSIZ) {
|
||||
memcpy(endbuf, bp, ENDHDRSIZ);
|
||||
} else {
|
||||
if (PR_Seek(zip->fd, endoff, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, endoff, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -380,7 +376,7 @@ nsZipFindEnd(ns_zip_t *zip, char *endbuf)
|
||||
if (endoff + ENDHDRSIZ + ENDCOM(endbuf) != len) {
|
||||
continue;
|
||||
}
|
||||
if (PR_Seek(zip->fd, endoff, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, endoff, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -420,6 +416,12 @@ ns_zip_direlcmp(const void *d1, const void *d2)
|
||||
return strcmp(((direl_t *)d1)->fn, ((direl_t *)d2)->fn);
|
||||
}
|
||||
|
||||
static int
|
||||
ns_zip_direlcmp2(const void *d1, const void *d2, void *unused)
|
||||
{
|
||||
return strcmp(((direl_t *)d1)->fn, ((direl_t *)d2)->fn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize zip file reader, read in central directory and construct the
|
||||
* lookup table for locating zip file members.
|
||||
@ -476,7 +478,7 @@ ns_zip_initReader(ns_zip_t *zip)
|
||||
return PR_FALSE;
|
||||
}
|
||||
/* Seek to first CEN header */
|
||||
if (PR_Seek(zip->fd, zip->cenoff, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, zip->cenoff, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -550,7 +552,7 @@ ns_zip_initReader(ns_zip_t *zip)
|
||||
/* Free temporary buffer */
|
||||
PR_Free(cenbuf);
|
||||
/* Sort directory elements by name */
|
||||
XP_QSORT(zip->dir, (size_t) zip->nel, sizeof(direl_t), ns_zip_direlcmp);
|
||||
NS_QuickSort(zip->dir, (size_t) zip->nel, sizeof(direl_t), ns_zip_direlcmp2, NULL);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@ -828,7 +830,7 @@ ns_zip_get(ns_zip_t *zip, const char *fn, void HUGEP *buf, PRInt32 len)
|
||||
return PR_FALSE;
|
||||
}
|
||||
/* Seek to beginning of LOC header */
|
||||
if (PR_Seek(zip->fd, dp->off, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, dp->off, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
@ -864,7 +866,7 @@ ns_zip_get(ns_zip_t *zip, const char *fn, void HUGEP *buf, PRInt32 len)
|
||||
return PR_FALSE;
|
||||
}
|
||||
/* Seek to file data */
|
||||
if (PR_Seek(zip->fd, off, SEEK_SET) == -1) {
|
||||
if (PR_Seek(zip->fd, off, PR_SEEK_SET) == -1) {
|
||||
#if !defined(XP_PC) || defined(_WIN32)
|
||||
/*
|
||||
* perror is not defined for win16
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <fstream.h>
|
||||
#include <time.h>
|
||||
#include "prmem.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#define CONTEXT_VECTOR_MAP "/vector.map"
|
||||
#define CONTEXT_VECTOR_STAT "/vector.stat"
|
||||
@ -47,7 +48,7 @@
|
||||
// structure to store the vector statistic information
|
||||
|
||||
typedef struct vector_info {
|
||||
PRInt32 references; // number of occurances counted
|
||||
PRInt32 references; // number of occurrences counted
|
||||
PRInt32 count; // number of tags in the vector
|
||||
PRBool good_vector; // is this a valid vector?
|
||||
eHTMLTags* vector; // and the vector
|
||||
@ -221,7 +222,7 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
|
||||
|
||||
// get the file size, read in the file and parse it line at
|
||||
// a time to check to see if we have already recorded this
|
||||
// occurance
|
||||
// occurrence
|
||||
|
||||
PRInt32 iSize = PR_Seek(recordFile,0,PR_SEEK_END);
|
||||
if (iSize) {
|
||||
@ -289,10 +290,10 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
|
||||
|
||||
/**
|
||||
* compare function for quick sort. Compares references and
|
||||
* sorts in decending order
|
||||
* sorts in descending order
|
||||
*/
|
||||
|
||||
static int compare( const void *arg1, const void *arg2 )
|
||||
static int compare( const void *arg1, const void *arg2 , void *unused)
|
||||
{
|
||||
VectorInfo ** p1 = (VectorInfo**)arg1;
|
||||
VectorInfo ** p2 = (VectorInfo**)arg2;
|
||||
@ -359,7 +360,7 @@ void CDTDDebug::NoteVector(eHTMLTags aTags[],PRInt32 count, PRBool good_vector)
|
||||
mVectorInfoArray,
|
||||
(sizeof(VectorInfo*)*((mVectorCount/TABLE_SIZE)+1)*TABLE_SIZE));
|
||||
if (mVectorCount) {
|
||||
qsort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare);
|
||||
NS_QuickSort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -379,7 +380,7 @@ void CDTDDebug::MakeVectorString(char * vector_string, VectorInfo * pInfo)
|
||||
* This debug routine dumps out the vector statistics to a text
|
||||
* file in the verification directory and defaults to the name
|
||||
* "vector.stat". It contains all parsed context vectors and there
|
||||
* occurance count sorted in decending order.
|
||||
* occurrence count sorted in descending order.
|
||||
*
|
||||
* @update jevering 6/11/98
|
||||
* @param
|
||||
@ -413,11 +414,11 @@ void CDTDDebug::DumpVectorRecord(void)
|
||||
|
||||
// oh what the heck, sort it again
|
||||
if (mVectorCount) {
|
||||
qsort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare);
|
||||
NS_QuickSort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare, NULL);
|
||||
}
|
||||
|
||||
// cute little header
|
||||
sprintf(vector_string,"Context vector occurance results. Processed %d unique vectors.\r\n\r\n", mVectorCount);
|
||||
sprintf(vector_string,"Context vector occurrence results. Processed %d unique vectors.\r\n\r\n", mVectorCount);
|
||||
ps << vector_string;
|
||||
|
||||
ps << "Invalid context vector summary (see " CONTEXT_VECTOR_STAT ") for mapping.\r\n";
|
||||
|
@ -21,17 +21,12 @@
|
||||
Includes dithering for B&W displays, but not dithering
|
||||
for PseudoColor displays which can be found in dither.c.
|
||||
|
||||
$Id: color.cpp,v 3.9 1999/05/27 22:30:53 pnunn%netscape.com Exp $
|
||||
$Id: color.cpp,v 3.10 1999/06/03 18:11:47 mcmullen%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include "if.h"
|
||||
#ifdef XP_MAC
|
||||
#include "xpcompat.h"
|
||||
#else
|
||||
#include "xp_qsort.h"
|
||||
#endif
|
||||
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#ifdef PROFILE
|
||||
#pragma profile on
|
||||
@ -584,9 +579,8 @@ ConvertRGBToRGB32(il_container *ic,
|
||||
}
|
||||
}
|
||||
|
||||
/* Sorting predicate for qsort() */
|
||||
static int
|
||||
compare_uint32(const void *a, const void *b)
|
||||
/* Sorting predicate for NS_QuickSort() */
|
||||
int compare_uint32(const void *a, const void *b, void *unused)
|
||||
{
|
||||
uint32 a1 = *(uint32*)a;
|
||||
uint32 b1 = *(uint32*)b;
|
||||
@ -621,7 +615,7 @@ unique_map_colors(NI_ColorMap *cmap)
|
||||
}
|
||||
|
||||
/* Sort by color, so identical colors will be grouped together. */
|
||||
XP_QSORT(ind, max_colors, sizeof(*ind), compare_uint32);
|
||||
NS_QuickSort(ind, max_colors, sizeof(*ind), compare_uint32, NULL);
|
||||
|
||||
/* Look for adjacent colors with different values */
|
||||
for (i = 0; i < max_colors-1; i++)
|
||||
|
@ -31,18 +31,18 @@
|
||||
|
||||
|
||||
#ifndef STANDALONE
|
||||
#include "nscore.h"
|
||||
#include "prmem.h"
|
||||
#include "prio.h"
|
||||
#include "plstr.h"
|
||||
#include "xp_regexp.h"
|
||||
#define ZFILE_CREATE PR_WRONLY | PR_CREATE_FILE
|
||||
#define READTYPE PRInt32
|
||||
#include "nscore.h"
|
||||
#include "prmem.h"
|
||||
#include "prio.h"
|
||||
#include "plstr.h"
|
||||
#include "xp_regexp.h"
|
||||
#define ZFILE_CREATE PR_WRONLY | PR_CREATE_FILE
|
||||
#define READTYPE PRInt32
|
||||
#else
|
||||
#include "zipstub.h"
|
||||
#undef NETSCAPE // undoes prtypes damage in zlib.h
|
||||
#define ZFILE_CREATE "wb"
|
||||
#define READTYPE PRUint32
|
||||
#include "zipstub.h"
|
||||
#undef NETSCAPE // undoes prtypes damage in zlib.h
|
||||
#define ZFILE_CREATE "wb"
|
||||
#define READTYPE PRUint32
|
||||
#endif /* STANDALONE */
|
||||
|
||||
#include "zlib.h"
|
||||
|
@ -33,6 +33,15 @@
|
||||
|
||||
#define NEW_PREF_ARCH
|
||||
|
||||
#if defined(VMS)
|
||||
/* Deal with case naming conflicts */
|
||||
#define pref_CopyCharPref prefl_CopyCharPref
|
||||
#define pref_GetBoolPref prefl_GetBoolPref
|
||||
#define pref_GetCharPref prefl_GetCharPref
|
||||
#define pref_GetIntPref prefl_GetIntPref
|
||||
#define pref_LockPref prefl_LockPref
|
||||
#endif /* VMS */
|
||||
|
||||
NSPR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsFileLocations.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#include "plhash.h"
|
||||
#include "prmem.h"
|
||||
@ -45,8 +46,6 @@
|
||||
#include "windows.h"
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define XP_QSORT qsort
|
||||
|
||||
#define PREFS_HEADER_LINE_1 "// Mozilla User Preferences"
|
||||
#define PREFS_HEADER_LINE_2 "// This is a generated file!"
|
||||
|
||||
@ -1180,7 +1179,7 @@ PR_IMPLEMENT(PrefResult) PREF_SavePrefFileSpecWith(
|
||||
PR_HashTableEnumerateEntries(gHashTable, heSaveProc, valueArray);
|
||||
|
||||
/* Sort the preferences to make a readable file on disk */
|
||||
XP_QSORT(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings);
|
||||
NS_QuickSort(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings, NULL);
|
||||
char** walker = valueArray;
|
||||
for (PRUint32 valueIdx = 0; valueIdx < gHashTable->nentries; valueIdx++,walker++)
|
||||
{
|
||||
|
@ -60,13 +60,7 @@
|
||||
#include "prprf.h"
|
||||
#include "xpassert.h"
|
||||
#include "xp_str.h"
|
||||
|
||||
#define XP_QSORT qsort
|
||||
|
||||
#if defined(XP_MAC) && defined (__MWERKS__)
|
||||
/* Can't get the xp people to fix warnings... */
|
||||
#pragma require_prototypes off
|
||||
#endif
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
typedef union
|
||||
{
|
||||
@ -79,34 +73,29 @@ typedef struct
|
||||
{
|
||||
PrefValue defaultPref;
|
||||
PrefValue userPref;
|
||||
uint8 flags;
|
||||
PRUint8 flags;
|
||||
} PrefNode;
|
||||
|
||||
/*-----------------------
|
||||
** Hash table allocation
|
||||
**----------------------*/
|
||||
|
||||
PR_IMPLEMENT(void *) pref_AllocTable(void *pool, size_t size)
|
||||
PR_STATIC_CALLBACK(void*) pref_AllocTable(void *pool, size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) pref_FreeTable(void *pool, void *item)
|
||||
PR_STATIC_CALLBACK(void) pref_FreeTable(void *pool, void *item)
|
||||
{
|
||||
free(item); /* free items? */
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLHashEntry *) pref_AllocEntry(void *pool, const void *key)
|
||||
PR_STATIC_CALLBACK(PLHashEntry*) pref_AllocEntry(void *pool, const void *key)
|
||||
{
|
||||
return malloc(sizeof(PLHashEntry));
|
||||
}
|
||||
|
||||
/* if we're using gcc's -pedantic-errors, uint isn't defined */
|
||||
#if defined(__STRICT_ANSI__) || !defined(HAVE_UINT)
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
PR_IMPLEMENT(void) pref_FreeEntry(void *pool, PLHashEntry *he, uint flag)
|
||||
PR_STATIC_CALLBACK(void) pref_FreeEntry(void *pool, PLHashEntry *he, PRUint32 flag)
|
||||
{
|
||||
PrefNode *pref = (PrefNode *) he->value;
|
||||
if (pref)
|
||||
@ -126,18 +115,18 @@ PR_IMPLEMENT(void) pref_FreeEntry(void *pool, PLHashEntry *he, uint flag)
|
||||
}
|
||||
}
|
||||
|
||||
JSBool PR_CALLBACK pref_NativeDefaultPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeLockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeUnlockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeSetConfig(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeGetPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeGetLDAPAttr(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeDefaultPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeUnlockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeSetConfig(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeGetPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeGetLDAPAttr(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
/* LI_STUFF add nativelilocalpref */
|
||||
JSBool PR_CALLBACK pref_NativeLILocalPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLILocalPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
/* LI_STUFF add NativeLIUserPref - does both lilocal and user at once */
|
||||
JSBool PR_CALLBACK pref_NativeLIUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeLIDefPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLIUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLIDefPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
|
||||
/*----------------------------------------------------------------------------------------*/
|
||||
#include "prefapi_private_data.h"
|
||||
@ -749,7 +738,7 @@ PREF_SetBinaryPref(const char *pref_name, void * value, long size)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
PREF_SetColorPref(const char *pref_name, PRUint8 red, PRUint8 green, PRUint8 blue)
|
||||
{
|
||||
char colstr[63];
|
||||
PrefValue pref;
|
||||
@ -759,9 +748,9 @@ PREF_SetColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
return pref_HashPref(pref_name, pref, PREF_STRING, PREF_SETUSER);
|
||||
}
|
||||
|
||||
#define MYGetboolVal(rgb) ((uint8) ((rgb) >> 16))
|
||||
#define MYGetGValue(rgb) ((uint8) (((uint16) (rgb)) >> 8))
|
||||
#define MYGetRValue(rgb) ((uint8) (rgb))
|
||||
#define MYGetboolVal(rgb) ((PRUint8) ((rgb) >> 16))
|
||||
#define MYGetGValue(rgb) ((PRUint8) (((PRUint16) (rgb)) >> 8))
|
||||
#define MYGetRValue(rgb) ((PRUint8) (rgb))
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetColorPrefDWord(const char *pref_name, PRUint32 colorref)
|
||||
@ -780,7 +769,7 @@ PREF_SetColorPrefDWord(const char *pref_name, PRUint32 colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetRectPref(const char *pref_name, int16 left, int16 top, int16 right, int16 bottom)
|
||||
PREF_SetRectPref(const char *pref_name, PRInt16 left, PRInt16 top, PRInt16 right, PRInt16 bottom)
|
||||
{
|
||||
char rectstr[63];
|
||||
PrefValue pref;
|
||||
@ -835,7 +824,7 @@ PREF_SetDefaultBinaryPref(const char *pref_name,void * value,long size)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetDefaultColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
PREF_SetDefaultColorPref(const char *pref_name, PRUint8 red, PRUint8 green, PRUint8 blue)
|
||||
{
|
||||
char colstr[63];
|
||||
PR_snprintf( colstr, 63, "#%02X%02X%02X", red, green, blue);
|
||||
@ -844,7 +833,7 @@ PREF_SetDefaultColorPref(const char *pref_name, uint8 red, uint8 green, uint8 bl
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetDefaultRectPref(const char *pref_name, int16 left, int16 top, int16 right, int16 bottom)
|
||||
PREF_SetDefaultRectPref(const char *pref_name, PRInt16 left, PRInt16 top, PRInt16 right, PRInt16 bottom)
|
||||
{
|
||||
char rectstr[63];
|
||||
PR_snprintf( rectstr, 63, "%d,%d,%d,%d", left, top, right, bottom);
|
||||
@ -991,7 +980,7 @@ pref_savePref(PLHashEntry *he, int i, void *arg)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(int)
|
||||
pref_CompareStrings(const void *v1, const void *v2)
|
||||
pref_CompareStrings(const void *v1, const void *v2, void *unused)
|
||||
{
|
||||
char *s1 = *(char**) v1;
|
||||
char *s2 = *(char**) v2;
|
||||
@ -1074,7 +1063,7 @@ PREF_SavePrefFileWith(const char *filename, PLHashEnumerator heSaveProc)
|
||||
PR_HashTableEnumerateEntries(gHashTable, heSaveProc, valueArray);
|
||||
|
||||
/* Sort the preferences to make a readable file on disk */
|
||||
XP_QSORT(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings);
|
||||
NS_QuickSort(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings, NULL);
|
||||
for (valueIdx = 0; valueIdx < gHashTable->nentries; valueIdx++)
|
||||
{
|
||||
if (valueArray[valueIdx])
|
||||
@ -1337,7 +1326,7 @@ PREF_GetBoolPref(const char *pref_name, PRBool * return_value)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
PREF_GetColorPref(const char *pref_name, PRUint8 *red, PRUint8 *green, PRUint8 *blue)
|
||||
{
|
||||
char colstr[8];
|
||||
int iSize = 8;
|
||||
@ -1347,7 +1336,7 @@ PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
if (result == PREF_NOERROR)
|
||||
{
|
||||
int r, g, b;
|
||||
sscanf(colstr, "#%02X%02X%02X", &r, &g, &b);
|
||||
sscanf(colstr, "#%02x%02x%02x", &r, &g, &b);
|
||||
*red = r;
|
||||
*green = g;
|
||||
*blue = b;
|
||||
@ -1355,12 +1344,12 @@ PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define MYRGB(r, g ,b) ((PRUint32) (((uint8) (r) | ((uint16) (g) << 8)) | (((PRUint32) (uint8) (b)) << 16)))
|
||||
#define MYRGB(r, g ,b) ((PRUint32) (((PRUint8) (r) | ((PRUint16) (g) << 8)) | (((PRUint32) (PRUint8) (b)) << 16)))
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetColorPrefDWord(const char *pref_name, PRUint32 *colorref)
|
||||
{
|
||||
uint8 red, green, blue;
|
||||
PRUint8 red, green, blue;
|
||||
PrefResult result;
|
||||
PR_ASSERT(colorref);
|
||||
result = PREF_GetColorPref(pref_name, &red, &green, &blue);
|
||||
@ -1370,7 +1359,7 @@ PREF_GetColorPrefDWord(const char *pref_name, PRUint32 *colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetRectPref(const char *pref_name, int16 *left, int16 *top, int16 *right, int16 *bottom)
|
||||
PREF_GetRectPref(const char *pref_name, PRInt16 *left, PRInt16 *top, PRInt16 *right, PRInt16 *bottom)
|
||||
{
|
||||
char rectstr[64];
|
||||
int iSize=64;
|
||||
@ -1504,7 +1493,7 @@ PREF_GetDefaultBinaryPref(const char *pref_name, void * return_value, int * leng
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
PREF_GetDefaultColorPref(const char *pref_name, PRUint8 *red, PRUint8 *green, PRUint8 *blue)
|
||||
{
|
||||
char colstr[8];
|
||||
int iSize = 8;
|
||||
@ -1514,7 +1503,7 @@ PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8
|
||||
if (result == PREF_NOERROR)
|
||||
{
|
||||
int r, g, b;
|
||||
sscanf(colstr, "#%02X%02X%02X", &r, &g, &b);
|
||||
sscanf(colstr, "#%02x%02x%02x", &r, &g, &b);
|
||||
*red = r;
|
||||
*green = g;
|
||||
*blue = b;
|
||||
@ -1526,7 +1515,7 @@ PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultColorPrefDWord(const char *pref_name, PRUint32 * colorref)
|
||||
{
|
||||
uint8 red, green, blue;
|
||||
PRUint8 red, green, blue;
|
||||
PrefResult result;
|
||||
PR_ASSERT(colorref);
|
||||
result = PREF_GetDefaultColorPref(pref_name, &red, &green, &blue);
|
||||
@ -1536,7 +1525,7 @@ PREF_GetDefaultColorPrefDWord(const char *pref_name, PRUint32 * colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultRectPref(const char *pref_name, int16 *left, int16 *top, int16 *right, int16 *bottom)
|
||||
PREF_GetDefaultRectPref(const char *pref_name, PRInt16 *left, PRInt16 *top, PRInt16 *right, PRInt16 *bottom)
|
||||
{
|
||||
char rectstr[256];
|
||||
int iLen = 256;
|
||||
|
@ -60,13 +60,7 @@
|
||||
#include "prprf.h"
|
||||
#include "xpassert.h"
|
||||
#include "xp_str.h"
|
||||
|
||||
#define XP_QSORT qsort
|
||||
|
||||
#if defined(XP_MAC) && defined (__MWERKS__)
|
||||
/* Can't get the xp people to fix warnings... */
|
||||
#pragma require_prototypes off
|
||||
#endif
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
typedef union
|
||||
{
|
||||
@ -79,34 +73,29 @@ typedef struct
|
||||
{
|
||||
PrefValue defaultPref;
|
||||
PrefValue userPref;
|
||||
uint8 flags;
|
||||
PRUint8 flags;
|
||||
} PrefNode;
|
||||
|
||||
/*-----------------------
|
||||
** Hash table allocation
|
||||
**----------------------*/
|
||||
|
||||
PR_IMPLEMENT(void *) pref_AllocTable(void *pool, size_t size)
|
||||
PR_STATIC_CALLBACK(void*) pref_AllocTable(void *pool, size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) pref_FreeTable(void *pool, void *item)
|
||||
PR_STATIC_CALLBACK(void) pref_FreeTable(void *pool, void *item)
|
||||
{
|
||||
free(item); /* free items? */
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLHashEntry *) pref_AllocEntry(void *pool, const void *key)
|
||||
PR_STATIC_CALLBACK(PLHashEntry*) pref_AllocEntry(void *pool, const void *key)
|
||||
{
|
||||
return malloc(sizeof(PLHashEntry));
|
||||
}
|
||||
|
||||
/* if we're using gcc's -pedantic-errors, uint isn't defined */
|
||||
#if defined(__STRICT_ANSI__) || !defined(HAVE_UINT)
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
PR_IMPLEMENT(void) pref_FreeEntry(void *pool, PLHashEntry *he, uint flag)
|
||||
PR_STATIC_CALLBACK(void) pref_FreeEntry(void *pool, PLHashEntry *he, PRUint32 flag)
|
||||
{
|
||||
PrefNode *pref = (PrefNode *) he->value;
|
||||
if (pref)
|
||||
@ -126,18 +115,18 @@ PR_IMPLEMENT(void) pref_FreeEntry(void *pool, PLHashEntry *he, uint flag)
|
||||
}
|
||||
}
|
||||
|
||||
JSBool PR_CALLBACK pref_NativeDefaultPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeLockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeUnlockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeSetConfig(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeGetPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeGetLDAPAttr(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeDefaultPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeUnlockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeSetConfig(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeGetPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeGetLDAPAttr(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
/* LI_STUFF add nativelilocalpref */
|
||||
JSBool PR_CALLBACK pref_NativeLILocalPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLILocalPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
/* LI_STUFF add NativeLIUserPref - does both lilocal and user at once */
|
||||
JSBool PR_CALLBACK pref_NativeLIUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
JSBool PR_CALLBACK pref_NativeLIDefPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLIUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
PR_STATIC_CALLBACK(JSBool) pref_NativeLIDefPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
|
||||
|
||||
/*----------------------------------------------------------------------------------------*/
|
||||
#include "prefapi_private_data.h"
|
||||
@ -749,7 +738,7 @@ PREF_SetBinaryPref(const char *pref_name, void * value, long size)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
PREF_SetColorPref(const char *pref_name, PRUint8 red, PRUint8 green, PRUint8 blue)
|
||||
{
|
||||
char colstr[63];
|
||||
PrefValue pref;
|
||||
@ -759,9 +748,9 @@ PREF_SetColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
return pref_HashPref(pref_name, pref, PREF_STRING, PREF_SETUSER);
|
||||
}
|
||||
|
||||
#define MYGetboolVal(rgb) ((uint8) ((rgb) >> 16))
|
||||
#define MYGetGValue(rgb) ((uint8) (((uint16) (rgb)) >> 8))
|
||||
#define MYGetRValue(rgb) ((uint8) (rgb))
|
||||
#define MYGetboolVal(rgb) ((PRUint8) ((rgb) >> 16))
|
||||
#define MYGetGValue(rgb) ((PRUint8) (((PRUint16) (rgb)) >> 8))
|
||||
#define MYGetRValue(rgb) ((PRUint8) (rgb))
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetColorPrefDWord(const char *pref_name, PRUint32 colorref)
|
||||
@ -780,7 +769,7 @@ PREF_SetColorPrefDWord(const char *pref_name, PRUint32 colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetRectPref(const char *pref_name, int16 left, int16 top, int16 right, int16 bottom)
|
||||
PREF_SetRectPref(const char *pref_name, PRInt16 left, PRInt16 top, PRInt16 right, PRInt16 bottom)
|
||||
{
|
||||
char rectstr[63];
|
||||
PrefValue pref;
|
||||
@ -835,7 +824,7 @@ PREF_SetDefaultBinaryPref(const char *pref_name,void * value,long size)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetDefaultColorPref(const char *pref_name, uint8 red, uint8 green, uint8 blue)
|
||||
PREF_SetDefaultColorPref(const char *pref_name, PRUint8 red, PRUint8 green, PRUint8 blue)
|
||||
{
|
||||
char colstr[63];
|
||||
PR_snprintf( colstr, 63, "#%02X%02X%02X", red, green, blue);
|
||||
@ -844,7 +833,7 @@ PREF_SetDefaultColorPref(const char *pref_name, uint8 red, uint8 green, uint8 bl
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_SetDefaultRectPref(const char *pref_name, int16 left, int16 top, int16 right, int16 bottom)
|
||||
PREF_SetDefaultRectPref(const char *pref_name, PRInt16 left, PRInt16 top, PRInt16 right, PRInt16 bottom)
|
||||
{
|
||||
char rectstr[63];
|
||||
PR_snprintf( rectstr, 63, "%d,%d,%d,%d", left, top, right, bottom);
|
||||
@ -991,7 +980,7 @@ pref_savePref(PLHashEntry *he, int i, void *arg)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(int)
|
||||
pref_CompareStrings(const void *v1, const void *v2)
|
||||
pref_CompareStrings(const void *v1, const void *v2, void *unused)
|
||||
{
|
||||
char *s1 = *(char**) v1;
|
||||
char *s2 = *(char**) v2;
|
||||
@ -1074,7 +1063,7 @@ PREF_SavePrefFileWith(const char *filename, PLHashEnumerator heSaveProc)
|
||||
PR_HashTableEnumerateEntries(gHashTable, heSaveProc, valueArray);
|
||||
|
||||
/* Sort the preferences to make a readable file on disk */
|
||||
XP_QSORT(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings);
|
||||
NS_QuickSort(valueArray, gHashTable->nentries, sizeof(char*), pref_CompareStrings, NULL);
|
||||
for (valueIdx = 0; valueIdx < gHashTable->nentries; valueIdx++)
|
||||
{
|
||||
if (valueArray[valueIdx])
|
||||
@ -1337,7 +1326,7 @@ PREF_GetBoolPref(const char *pref_name, PRBool * return_value)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
PREF_GetColorPref(const char *pref_name, PRUint8 *red, PRUint8 *green, PRUint8 *blue)
|
||||
{
|
||||
char colstr[8];
|
||||
int iSize = 8;
|
||||
@ -1347,7 +1336,7 @@ PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
if (result == PREF_NOERROR)
|
||||
{
|
||||
int r, g, b;
|
||||
sscanf(colstr, "#%02X%02X%02X", &r, &g, &b);
|
||||
sscanf(colstr, "#%02x%02x%02x", &r, &g, &b);
|
||||
*red = r;
|
||||
*green = g;
|
||||
*blue = b;
|
||||
@ -1355,12 +1344,12 @@ PREF_GetColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define MYRGB(r, g ,b) ((PRUint32) (((uint8) (r) | ((uint16) (g) << 8)) | (((PRUint32) (uint8) (b)) << 16)))
|
||||
#define MYRGB(r, g ,b) ((PRUint32) (((PRUint8) (r) | ((PRUint16) (g) << 8)) | (((PRUint32) (PRUint8) (b)) << 16)))
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetColorPrefDWord(const char *pref_name, PRUint32 *colorref)
|
||||
{
|
||||
uint8 red, green, blue;
|
||||
PRUint8 red, green, blue;
|
||||
PrefResult result;
|
||||
PR_ASSERT(colorref);
|
||||
result = PREF_GetColorPref(pref_name, &red, &green, &blue);
|
||||
@ -1370,7 +1359,7 @@ PREF_GetColorPrefDWord(const char *pref_name, PRUint32 *colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetRectPref(const char *pref_name, int16 *left, int16 *top, int16 *right, int16 *bottom)
|
||||
PREF_GetRectPref(const char *pref_name, PRInt16 *left, PRInt16 *top, PRInt16 *right, PRInt16 *bottom)
|
||||
{
|
||||
char rectstr[64];
|
||||
int iSize=64;
|
||||
@ -1504,7 +1493,7 @@ PREF_GetDefaultBinaryPref(const char *pref_name, void * return_value, int * leng
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8 *blue)
|
||||
PREF_GetDefaultColorPref(const char *pref_name, PRUint8 *red, PRUint8 *green, PRUint8 *blue)
|
||||
{
|
||||
char colstr[8];
|
||||
int iSize = 8;
|
||||
@ -1514,7 +1503,7 @@ PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8
|
||||
if (result == PREF_NOERROR)
|
||||
{
|
||||
int r, g, b;
|
||||
sscanf(colstr, "#%02X%02X%02X", &r, &g, &b);
|
||||
sscanf(colstr, "#%02x%02x%02x", &r, &g, &b);
|
||||
*red = r;
|
||||
*green = g;
|
||||
*blue = b;
|
||||
@ -1526,7 +1515,7 @@ PREF_GetDefaultColorPref(const char *pref_name, uint8 *red, uint8 *green, uint8
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultColorPrefDWord(const char *pref_name, PRUint32 * colorref)
|
||||
{
|
||||
uint8 red, green, blue;
|
||||
PRUint8 red, green, blue;
|
||||
PrefResult result;
|
||||
PR_ASSERT(colorref);
|
||||
result = PREF_GetDefaultColorPref(pref_name, &red, &green, &blue);
|
||||
@ -1536,7 +1525,7 @@ PREF_GetDefaultColorPrefDWord(const char *pref_name, PRUint32 * colorref)
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PrefResult)
|
||||
PREF_GetDefaultRectPref(const char *pref_name, int16 *left, int16 *top, int16 *right, int16 *bottom)
|
||||
PREF_GetDefaultRectPref(const char *pref_name, PRInt16 *left, PRInt16 *top, PRInt16 *right, PRInt16 *bottom)
|
||||
{
|
||||
char rectstr[256];
|
||||
int iLen = 256;
|
||||
|
@ -46,7 +46,7 @@ PR_EXTERN(PrefResult) pref_savePref(PLHashEntry *he, int i, void *arg);
|
||||
PR_EXTERN(PrefResult) pref_saveLIPref(PLHashEntry *he, int i, void *arg);
|
||||
PR_EXTERN(PRBool) pref_VerifyLockFile(char* buf, long buflen);
|
||||
PR_EXTERN(PrefResult) PREF_SetSpecialPrefsLocal(void);
|
||||
PR_EXTERN(int) pref_CompareStrings(const void *v1, const void *v2);
|
||||
PR_EXTERN(int) pref_CompareStrings(const void *v1, const void *v2, void* unused);
|
||||
extern JSBool pref_InitInitialObjects(void);
|
||||
|
||||
NSPR_END_EXTERN_C
|
||||
|
@ -92,7 +92,7 @@ MODULE_PRIVATE NET_FileEntryInfo * NET_CreateFileEntryInfoStruct (void)
|
||||
*
|
||||
*/
|
||||
PRIVATE int
|
||||
NET_CompareFileEntryInfoStructs (const void *ent2, const void *ent1)
|
||||
NET_CompareFileEntryInfoStructs (const void *ent2, const void *ent1, void *unused)
|
||||
{
|
||||
int status;
|
||||
const NET_FileEntryInfo *entry1 = *(NET_FileEntryInfo **) ent1;
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
#include "mkutils.h"
|
||||
#include "mksort.h"
|
||||
#include "xp_qsort.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#define CHUNK_SIZE 400
|
||||
|
||||
@ -122,9 +122,9 @@ NET_SortInsert(SortStruct * sort_struct, void * insert_before, void * new_object
|
||||
}
|
||||
|
||||
MODULE_PRIVATE void
|
||||
NET_DoSort(SortStruct * sort_struct, int (*compar) (const void *, const void *))
|
||||
NET_DoSort(SortStruct * sort_struct, int (*compar) (const void *, const void *, void *))
|
||||
{
|
||||
XP_QSORT(sort_struct->list, sort_struct->num_entries, sizeof(void *), compar);
|
||||
NS_QuickSort(sort_struct->list, sort_struct->num_entries, sizeof(void *), compar, NULL);
|
||||
}
|
||||
|
||||
/* unloads backwards :(
|
||||
|
@ -27,7 +27,7 @@ typedef struct _SortStruct {
|
||||
|
||||
extern SortStruct * NET_SortInit (void);
|
||||
extern Bool NET_SortAdd (SortStruct * sort_struct, void * add_object);
|
||||
extern void NET_DoSort(SortStruct * sort_struct, int (*compar) (const void *, const void *));
|
||||
extern void NET_DoSort(SortStruct * sort_struct, int (*compar) (const void *, const void *, void *));
|
||||
extern void * NET_SortUnloadNext(SortStruct * sort_struct);
|
||||
extern void * NET_SortRetrieveNumber(SortStruct * sort_struct, int number);
|
||||
extern int NET_SortCount(SortStruct * sort_struct);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <fstream.h>
|
||||
#include <time.h>
|
||||
#include "prmem.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
#define CONTEXT_VECTOR_MAP "/vector.map"
|
||||
#define CONTEXT_VECTOR_STAT "/vector.stat"
|
||||
@ -47,7 +48,7 @@
|
||||
// structure to store the vector statistic information
|
||||
|
||||
typedef struct vector_info {
|
||||
PRInt32 references; // number of occurances counted
|
||||
PRInt32 references; // number of occurrences counted
|
||||
PRInt32 count; // number of tags in the vector
|
||||
PRBool good_vector; // is this a valid vector?
|
||||
eHTMLTags* vector; // and the vector
|
||||
@ -221,7 +222,7 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
|
||||
|
||||
// get the file size, read in the file and parse it line at
|
||||
// a time to check to see if we have already recorded this
|
||||
// occurance
|
||||
// occurrence
|
||||
|
||||
PRInt32 iSize = PR_Seek(recordFile,0,PR_SEEK_END);
|
||||
if (iSize) {
|
||||
@ -289,10 +290,10 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
|
||||
|
||||
/**
|
||||
* compare function for quick sort. Compares references and
|
||||
* sorts in decending order
|
||||
* sorts in descending order
|
||||
*/
|
||||
|
||||
static int compare( const void *arg1, const void *arg2 )
|
||||
static int compare( const void *arg1, const void *arg2 , void *unused)
|
||||
{
|
||||
VectorInfo ** p1 = (VectorInfo**)arg1;
|
||||
VectorInfo ** p2 = (VectorInfo**)arg2;
|
||||
@ -359,7 +360,7 @@ void CDTDDebug::NoteVector(eHTMLTags aTags[],PRInt32 count, PRBool good_vector)
|
||||
mVectorInfoArray,
|
||||
(sizeof(VectorInfo*)*((mVectorCount/TABLE_SIZE)+1)*TABLE_SIZE));
|
||||
if (mVectorCount) {
|
||||
qsort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare);
|
||||
NS_QuickSort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -379,7 +380,7 @@ void CDTDDebug::MakeVectorString(char * vector_string, VectorInfo * pInfo)
|
||||
* This debug routine dumps out the vector statistics to a text
|
||||
* file in the verification directory and defaults to the name
|
||||
* "vector.stat". It contains all parsed context vectors and there
|
||||
* occurance count sorted in decending order.
|
||||
* occurrence count sorted in descending order.
|
||||
*
|
||||
* @update jevering 6/11/98
|
||||
* @param
|
||||
@ -413,11 +414,11 @@ void CDTDDebug::DumpVectorRecord(void)
|
||||
|
||||
// oh what the heck, sort it again
|
||||
if (mVectorCount) {
|
||||
qsort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare);
|
||||
NS_QuickSort((void*)mVectorInfoArray,(size_t)mVectorCount,sizeof(VectorInfo*),compare, NULL);
|
||||
}
|
||||
|
||||
// cute little header
|
||||
sprintf(vector_string,"Context vector occurance results. Processed %d unique vectors.\r\n\r\n", mVectorCount);
|
||||
sprintf(vector_string,"Context vector occurrence results. Processed %d unique vectors.\r\n\r\n", mVectorCount);
|
||||
ps << vector_string;
|
||||
|
||||
ps << "Invalid context vector summary (see " CONTEXT_VECTOR_STAT ") for mapping.\r\n";
|
||||
|
@ -121,7 +121,6 @@ nsPrefsCore::~nsPrefsCore()
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(!firstTime, "There can be only one");
|
||||
firstTime = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user