Thu, 23 Feb 2012 13:10:04 +0100
removed some NSPR dependencies
--- a/src/server/daemon/httprequest.c Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/daemon/httprequest.c Thu Feb 23 13:10:04 2012 +0100 @@ -28,7 +28,7 @@ #include <stdio.h> #include <stdlib.h> - +#include <arpa/inet.h> #include "../public/nsapi.h" #include "../util/pool.h" @@ -492,7 +492,7 @@ } } - return ret; + return REQ_PROCEED; } int nsapi_objecttype(NSAPISession *sn, NSAPIRequest *rq) {
--- a/src/server/daemon/netsite.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/daemon/netsite.h Thu Feb 23 13:10:04 2012 +0100 @@ -42,8 +42,7 @@ * Standard defs for NetSite servers. */ -#include <mps/nspr.h> - +//include <mps/nspr.h> #ifndef BASE_SYSTEMS_H #include "../util/systems.h" #endif /* !BASE_SYSTEMS_H */ @@ -58,7 +57,9 @@ #include "../public/nsapi.h" #endif /* PUBLIC_NETSITE_H */ -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif /* * Only the mainline needs to set the malloc key. @@ -142,7 +143,9 @@ /* --- End public functions --- */ -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #ifdef INTNSAPI
--- a/src/server/util/ereport.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/ereport.h Thu Feb 23 13:10:04 2012 +0100 @@ -44,6 +44,8 @@ * Rob McCool */ +//TODO: include netsite.h or systems.h + #ifndef BASE_SESSION_H #include "../daemon/session.h" #endif /* !BASE_SESSION_H */ @@ -59,7 +61,9 @@ #ifdef INTNSAPI -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif /* * INTereport logs an error of the given degree and formats the arguments with @@ -84,7 +88,9 @@ /* For restarts */ NSAPI_PUBLIC SYS_FILE INTereport_getfd(void); -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #ifdef __cplusplus class EreportableException;
--- a/src/server/util/netbuf.c Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/netbuf.c Thu Feb 23 13:10:04 2012 +0100 @@ -41,7 +41,7 @@ #include <stdlib.h> #include <unistd.h> -#include "nspr.h" +//include "nspr.h" #include "../public/nsapi.h" #include "io.h" @@ -171,7 +171,7 @@ buf->maxsize = sz; } - PR_ASSERT(buf->pos == buf->cursize); + //PR_ASSERT(buf->pos == buf->cursize); // TODO buf->pos = 0; buf->cursize = 0;
--- a/src/server/util/objs.mk Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/objs.mk Thu Feb 23 13:10:04 2012 +0100 @@ -33,7 +33,6 @@ UTILOBJ = io.o UTILOBJ += netbuf.o UTILOBJ += object.o -# UTILOBJ += pblock.o UTILOBJ += plist.o UTILOBJ += pool.o UTILOBJ += shexp.o @@ -41,7 +40,6 @@ UTILOBJ += system.o UTILOBJ += systhr.o UTILOBJ += thrpool.o -#UTILOBJ += uri.o UTILOBJ += util.o UTILOBJS = $(UTILOBJ:%=$(UTIL_OBJPRE)%)
--- a/src/server/util/pblock.cpp Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/pblock.cpp Thu Feb 23 13:10:04 2012 +0100 @@ -552,7 +552,7 @@ PListStruct_t *pl = PBTOPL(pb); PLValueStruct_t *pv = PATOPV(pp); - PR_ASSERT(pv->pv_mempool == pl->pl_mempool); + //PR_ASSERT(pv->pv_mempool == pl->pl_mempool); // TODO /* Check to see if the name corresponds to a pb_key */ unsigned int hashval; @@ -588,7 +588,7 @@ pt->pt_hash[i] = pv; pt->pt_nsyms++; - PR_ASSERT(param_key(pp) == key); + //PR_ASSERT(param_key(pp) == key); // TODO } @@ -648,7 +648,7 @@ /* --------------------------- pblock_kllinsert --------------------------- */ -NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb) +NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, int64_t value, pblock *pb) { pb_param *pp = pblock_key_param_create(pb, key, NULL, UTIL_I64TOA_SIZE); if (pp) {
--- a/src/server/util/pblock.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/pblock.h Thu Feb 23 13:10:04 2012 +0100 @@ -71,7 +71,9 @@ /* --- Begin function prototypes --- */ -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); @@ -332,7 +334,7 @@ NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb); -NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb); +NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, int64_t value, pblock *pb); #ifdef __cplusplus inline const pb_key *param_key(pb_param *pp) @@ -343,7 +345,9 @@ #define PARAM_KEY(pp) *(const pb_key **)(pp + 1) /* new */ -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #define param_create INTparam_create #define param_free INTparam_free
--- a/src/server/util/plist.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/plist.h Thu Feb 23 13:10:04 2012 +0100 @@ -47,7 +47,7 @@ */ #include "pool.h" -#include "mps/nspr.h" +//include "mps/nspr.h" #include "../public/nsapi.h" #include "plist_pvt.h" @@ -58,7 +58,9 @@ #ifdef INTNSACL /* Functions in plist.c */ -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC extern int PListAssignValue(PList_t plist, const char *pname, const void *pvalue, PList_t ptype); @@ -87,7 +89,9 @@ NSAPI_PUBLIC extern int PListDefKey(PList_t plist, pb_key *key, const char *pname, const int flags); NSAPI_PUBLIC extern int PListInitKey(PList_t plist, pb_key *key, const void *pvalue, PList_t ptype); -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #endif /* INTNSACL */
--- a/src/server/util/pool.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/pool.h Thu Feb 23 13:10:04 2012 +0100 @@ -55,7 +55,7 @@ #ifndef NETSITE_H //include "netsite.h" #include "../public/nsapi.h" -#include "nspr.h" +//include "nspr.h" #endif /* !NETSITE_H */ #ifndef BASE_PBLOCK_H @@ -74,7 +74,9 @@ #ifdef INTNSAPI -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC int INTpool_init(pblock *pb, Session *sn, Request *rq); @@ -109,7 +111,9 @@ NSAPI_PUBLIC void INTpool_assert(pool_handle_t *pool_handle, const void *ptr); #endif -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #define pool_init INTpool_init
--- a/src/server/util/shexp.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/shexp.h Thu Feb 23 13:10:04 2012 +0100 @@ -104,7 +104,9 @@ #ifdef INTNSAPI -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC int INTshexp_valid(const char *exp); @@ -116,7 +118,9 @@ NSAPI_PUBLIC int INTshexp_casecmp(const char *str, const char *exp); -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif /* --- End function prototypes --- */
--- a/src/server/util/system.c Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/system.c Thu Feb 23 13:10:04 2012 +0100 @@ -92,7 +92,7 @@ NSAPI_PUBLIC char *system_version() { //return PRODUCT_ID"/"PRODUCT_VERSION_ID; - return "Solaris 11 Express"; + return "Solaris 11"; } NSAPI_PUBLIC pool_handle_t *system_pool(void) @@ -106,7 +106,7 @@ ret = pool_malloc(MALLOC_KEY, size); if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); // TODO } return ret; } @@ -120,7 +120,7 @@ ZERO(ret, size); } else { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); // TODO } return ret; } @@ -132,7 +132,7 @@ ret = pool_realloc(MALLOC_KEY, ptr, size); if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); } return ret; } @@ -150,7 +150,7 @@ ret = pool_strdup(MALLOC_KEY, ptr); if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); } return ret; } @@ -184,7 +184,7 @@ #endif if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); } return ret; } @@ -234,7 +234,7 @@ if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); } return ret; @@ -298,7 +298,7 @@ if (!ret) { //ereport_outofmemory(); - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + //PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); } return ret; @@ -336,8 +336,9 @@ NSAPI_PUBLIC void InitThreadMallocKey(void) { - PR_NewThreadPrivateIndex((unsigned int *)&thread_malloc_key, NULL); - PR_ASSERT(thread_malloc_key); + // TODO + //PR_NewThreadPrivateIndex((unsigned int *)&thread_malloc_key, NULL); + //PR_ASSERT(thread_malloc_key); } #ifdef XP_WIN32
--- a/src/server/util/systems.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/systems.h Thu Feb 23 13:10:04 2012 +0100 @@ -34,7 +34,8 @@ #ifndef BASE_SYSTEMS_H #define BASE_SYSTEMS_H -#include <nspr.h> +//include <nspr.h> +#include <inttypes.h> #ifndef NOINTNSAPI #define INTNSAPI @@ -53,6 +54,12 @@ #define DAEMON_ANY #define DAEMON_STATS +/* new types */ +typedef int PRBool; +#define PR_TRUE 1 +#define PR_FALSE 0 +/* end new types */ + /* --- End common definitions for all supported platforms --- */ /* --- Begin platform-specific definitions --- */ @@ -493,15 +500,16 @@ * as (void *) in the public API. */ -#ifndef SYS_FILE_T -typedef PRFileDesc *SYS_FILE; -#define SYS_FILE_T PRFileDesc * -#endif /* !SYS_FILE_T */ +/* TODO: remove */ +//ifndef SYS_FILE_T +//typedef PRFileDesc *SYS_FILE; +//define SYS_FILE_T PRFileDesc * +//endif /* !SYS_FILE_T */ -#ifndef SYS_NETFD_T -typedef PRFileDesc *SYS_NETFD; -#define SYS_NETFD_T PRFileDesc * -#endif /* !SYS_NETFD_T */ +//ifndef SYS_NETFD_T +//typedef PRFileDesc *SYS_NETFD; +//define SYS_NETFD_T PRFileDesc * +//endif /* !SYS_NETFD_T */ #ifdef SEM_WIN32 @@ -524,9 +532,10 @@ #else /* ! SEM_WIN32 */ -typedef int SEMAPHORE; -#define SEMAPHORE_T int -#define SEM_ERROR -1 +// TODO +//typedef int SEMAPHORE; +//define SEMAPHORE_T int +//define SEM_ERROR -1 #endif /* SEM_WIN32 */
--- a/src/server/util/systhr.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/systhr.h Thu Feb 23 13:10:04 2012 +0100 @@ -58,7 +58,9 @@ #define INTNSAPI #ifdef INTNSAPI -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC SYS_THREAD INTsysthread_start(int prio, int stksz, thrstartfunc fn, void *arg); @@ -88,7 +90,9 @@ NSAPI_PUBLIC void INTsysthread_set_default_stacksize(unsigned long size); -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif /* --- End function prototypes --- */
--- a/src/server/util/uri.cpp Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/uri.cpp Thu Feb 23 13:10:04 2012 +0100 @@ -358,7 +358,7 @@ int in = 0; int in_len = len; - PR_ASSERT(uri != NULL); + //PR_ASSERT(uri != NULL); // TODO char* canonPath = (char *)pool_malloc(pool, in_len+1); char* out_ptr = canonPath; @@ -487,7 +487,7 @@ NSAPI_PUBLIC char* util_canonicalize_redirect(pool_handle_t *pool, const char *baseUri, const char *newUri) { - PR_ASSERT(baseUri != NULL); + //PR_ASSERT(baseUri != NULL); // TODO if (*newUri == '/') return util_canonicalize_uri(pool, newUri, strlen(newUri), NULL);
--- a/src/server/util/util.c Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/util.c Thu Feb 23 13:10:04 2012 +0100 @@ -48,7 +48,8 @@ #endif /* XP_UNIX */ -#include "nspr.h" +//include "nspr.h" +#include "../daemon/netsite.h" #include "../public/nsapi.h" #include "util.h" @@ -99,7 +100,7 @@ * than doing a log10 or some nasty trick to find the # of digits. */ -NSAPI_PUBLIC int INTutil_i64toa(PRInt64 i, char *a) +NSAPI_PUBLIC int INTutil_i64toa(int64_t i, char *a) { register int x, y, p; register char c;
--- a/src/server/util/util.h Wed Feb 22 23:20:39 2012 +0100 +++ b/src/server/util/util.h Thu Feb 23 13:10:04 2012 +0100 @@ -70,7 +70,9 @@ #ifdef INTNSAPI -NSPR_BEGIN_EXTERN_C +#ifdef __cplusplus +extern "C" { +#endif NSAPI_PUBLIC int INTutil_init_PRNetAddr(PRNetAddr * naddr, char * ipstr, int iplen, int type); @@ -146,7 +148,7 @@ NSAPI_PUBLIC int INTutil_itoa(int i, char *a); -NSAPI_PUBLIC int INTutil_i64toa(PRInt64 i, char *a); +NSAPI_PUBLIC int INTutil_i64toa(int64_t i, char *a); NSAPI_PUBLIC @@ -186,7 +188,9 @@ NSAPI_PUBLIC PRBool INTutil_format_http_version(const char *v, int *protv_num, char *buffer, int size); NSAPI_PUBLIC int INTutil_getboolean(const char *v, int def); -NSAPI_PUBLIC PRIntervalTime INTutil_getinterval(const char *v, PRIntervalTime def); + +// TODO +//NSAPI_PUBLIC PRIntervalTime INTutil_getinterval(const char *v, PRIntervalTime def); #ifdef NEED_STRCASECMP NSAPI_PUBLIC int INTutil_strcasecmp(const char *one, const char *two); @@ -210,7 +214,7 @@ NSAPI_PUBLIC char *util_decrement_string(char *s); -NSAPI_PUBLIC PRInt64 util_atoi64(const char *a); +NSAPI_PUBLIC int64_t util_atoi64(const char *a); NSAPI_PUBLIC char *util_html_escape(const char *s); @@ -249,7 +253,9 @@ /* --- End Windows-only function prototypes --- */ -NSPR_END_EXTERN_C +#ifdef __cplusplus +} +#endif #ifdef __cplusplus