Skip to content

Commit

Permalink
o. removed unused variables
Browse files Browse the repository at this point in the history
o. fixed warnings about non-initialized vars
o. CONST-ified according to Tcl 8.4+ rules

bin/init.tcl: _ns_getscript forces import of
namespaced commands

tcl/init.tcl: sets auto_path to start with
our private library first

include/Makefile.global.in: allows for building
with Solaris 2.6 and later
  • Loading branch information
vasiljevic committed Mar 7, 2003
1 parent b2ab157 commit 86c9846
Show file tree
Hide file tree
Showing 54 changed files with 387 additions and 299 deletions.
67 changes: 66 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
2003-03-07 Zoran Vasiljevic <[email protected]>

* include/ns.h:
* nscgi/nscgi.c:
* nscp/nscp.c:
* nsd/adpeval.c:
* nsd/adpparse.c:
* nsd/binder.c:
* nsd/config.c:
* nsd/conn.c:
* nsd/connio.c:
* nsd/dns.c:
* nsd/driver.c:
* nsd/dstring.c:
* nsd/encoding.c:
* nsd/fastpath.c:
* nsd/index.c:
* nsd/info.c:
* nsd/lisp.c:
* nsd/listen.c:
* nsd/log.c:
* nsd/modload.c:
* nsd/nsmain.c:
* nsd/pidfile.c:
* nsd/queue.c:
* nsd/request.c:
* nsd/rollfile.c:
* nsd/sched.c:
* nsd/sockcallback.c:
* nsd/tclatclose.c:
* nsd/tclfile.c:
* nsd/tclhttp.c:
* nsd/tclimg.c:
* nsd/tclinit.c:
* nsd/tcljob.c:
* nsd/tclmisc.c:
* nsd/tclshare.c:
* nsd/tclsock.c:
* nsd/tclvar.c:
* nsd/tclxkeylist.c:
* nsd/urlencode.c:
* nsd/urlspace.c:
* nsdb/dbinit.c:
* nsdb/dbtcl.c:
* nsext/nsext.c:
* nslog/nslog.c:
* nspd/log.c:
* nspd/main.c:
* nsperm/nsperm.c:
* nsthread/mutex.c:
* nsthread/nsthreadtest.c:
* nsthread/pthread.c:
o. removed unused variables
o. fixed warnings about non-initialized vars
o. CONST-ified according to Tcl 8.4+ rules

* bin/init.tcl: _ns_getscript forces import of
namespaced commands

* tcl/init.tcl: sets auto_path to start with
our private library first

* include/Makefile.global.in: allows for building
with Solaris 2.6 and later

2003-03-06 Mark Page <[email protected]>

* nsd/adpeval.c: Change defn of objs field of InterpPage to size
Expand All @@ -19,7 +84,7 @@
2003-03-05 Zoran Vasiljevic <[email protected]>

* nsd/init.tcl: added handling of commands imported from
other namespaces in _ns_getscript procedure.
other namespaces in _ns_getscript procedure.

2003-03-05 Mark Page <[email protected]>

Expand Down
10 changes: 7 additions & 3 deletions include/Makefile.global.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# version of this file under either the License or the GPL.
#
#
# $Header: /Users/dossy/Desktop/cvs/aolserver/include/Attic/Makefile.global.in,v 1.12 2003/01/24 18:29:15 elizthom Exp $
# $Header: /Users/dossy/Desktop/cvs/aolserver/include/Attic/Makefile.global.in,v 1.13 2003/03/07 18:08:06 vasiljevic Exp $
#

#
Expand Down Expand Up @@ -99,9 +99,13 @@ INSTSRVPAG = $(INSTSRV)/pages
# Platform-specific options.
uname = $(shell uname -a)

# Solaris 2.7+
# Solaris 2.6+
ifneq (,$(findstring SunOS,$(uname)))
LIBS+=-lrt
ifneq (,$(findstring 5.6,$(uname)))
LIBS+=-lthread -lposix4
else
LIBS+=-lrt
endif
endif

# Add dynamic library entry point flags.
Expand Down
8 changes: 7 additions & 1 deletion include/ns.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* All the public types and function declarations for the core
* AOLserver.
*
* $Header: /Users/dossy/Desktop/cvs/aolserver/include/ns.h,v 1.47 2003/03/06 19:40:15 mpagenva Exp $
* $Header: /Users/dossy/Desktop/cvs/aolserver/include/ns.h,v 1.48 2003/03/07 18:08:08 vasiljevic Exp $
*/

#ifndef NS_H
Expand Down Expand Up @@ -568,6 +568,7 @@ NS_EXTERN char *Ns_ConnDriverName(Ns_Conn *conn);
NS_EXTERN void *Ns_ConnDriverContext(Ns_Conn *conn);
NS_EXTERN int Ns_ConnGetWriteEncodedFlag(Ns_Conn *conn);
NS_EXTERN void Ns_ConnSetWriteEncodedFlag(Ns_Conn *conn, int flag);
NS_EXTERN void Ns_ConnSetUrlEncoding(Ns_Conn *conn, Tcl_Encoding encoding);

/*
* crypt.c:
Expand Down Expand Up @@ -1173,6 +1174,11 @@ NS_EXTERN int Ns_GetGid(char *group);
NS_EXTERN int Ns_GetUserGid(char *user);
NS_EXTERN int Ns_GetUid(char *user);

/*
* form.c:
*/

NS_EXTERN void Ns_ConnClearQuery(Ns_Conn *conn);

/*
* Compatibility macros.
Expand Down
6 changes: 3 additions & 3 deletions nscgi/nscgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/


static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscgi/nscgi.c,v 1.21 2003/03/03 14:42:08 shmooved Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscgi/nscgi.c,v 1.22 2003/03/07 18:08:11 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "ns.h"
#include <sys/stat.h>
Expand Down Expand Up @@ -422,7 +422,7 @@ CgiInit(Cgi *cgiPtr, Map *mapPtr, Ns_Conn *conn)

ulen = strlen(url);
plen = strlen(mapPtr->url);
if ((strncmp(mapPtr->url, url, plen) == 0) &&
if ((strncmp(mapPtr->url, url, (size_t)plen) == 0) &&
(ulen == plen || url[plen] == '/')) {

if (mapPtr->path == NULL) {
Expand Down Expand Up @@ -588,7 +588,7 @@ CgiSpool(Cgi *cgiPtr, Ns_Conn *conn)
fd = Ns_GetTemp();
if (fd < 0) {
Ns_Log(Error, "nscgi: could not allocate temp file.");
} else if (write(fd, content, len) != len) {
} else if (write(fd, content, (size_t)len) != len) {
err = "write";
} else if (lseek(fd, 0, SEEK_SET) != 0) {
err = "lseek";
Expand Down
8 changes: 4 additions & 4 deletions nscp/nscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Tcl commands.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.21 2003/02/04 23:15:17 jrasmuss23 Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.22 2003/03/07 18:08:12 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "ns.h"

Expand Down Expand Up @@ -545,7 +545,7 @@ Login(Sess *sessPtr, Tcl_DString *unameDSPtr)
Ns_Log(Warning, "nscp: login failed: '%s'", user ? user : "?");
sprintf(msg, "Access denied!\n");
}
(void) send(sessPtr->sock, msg, strlen(msg), 0);
(void) send(sessPtr->sock, msg, (int)strlen(msg), 0);
Tcl_DStringFree(&uds);
Tcl_DStringFree(&pds);
return ok;
Expand All @@ -569,13 +569,13 @@ Login(Sess *sessPtr, Tcl_DString *unameDSPtr)
*/

static int
ExitCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
ExitCmd(ClientData arg, Tcl_Interp *interp, int argc, CONST char **argv)
{
int *stopPtr;

if (argc != 1) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], "\"", NULL);
(char*)argv[0], "\"", NULL);
return TCL_ERROR;
}

Expand Down
19 changes: 10 additions & 9 deletions nsd/adpeval.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* ADP string and file eval.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/adpeval.c,v 1.23 2003/03/06 22:31:16 mpagenva Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/adpeval.c,v 1.24 2003/03/07 18:08:13 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"

Expand Down Expand Up @@ -412,7 +412,7 @@ AdpRun(NsInterp *itPtr, char *file, int objc, Tcl_Obj *objv[],
if (!new) {
Ns_CacheUnsetValue(ePtr);
}
Ns_CacheSetValueSz(ePtr, ipagePtr, ipagePtr->pagePtr->size);
Ns_CacheSetValueSz(ePtr, ipagePtr, (size_t)ipagePtr->pagePtr->size);
}
}
}
Expand Down Expand Up @@ -533,9 +533,9 @@ NsTclAdpStatsCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
pagePtr = Tcl_GetHashValue(hPtr);
keyPtr = (FileKey *) Tcl_GetHashKey(&servPtr->adp.pages, hPtr);
Tcl_AppendElement(interp, pagePtr->file);
sprintf(buf, "dev %d ino %d mtime %d refcnt %d evals %d size %d blocks %d scripts %d",
keyPtr->dev, keyPtr->ino, (int) pagePtr->mtime, pagePtr->refcnt,
pagePtr->evals, (int) pagePtr->size, pagePtr->code.nblocks,
sprintf(buf, "dev %ld ino %ld mtime %ld refcnt %d evals %d size %ld blocks %d scripts %d",
keyPtr->dev, keyPtr->ino, pagePtr->mtime, pagePtr->refcnt,
pagePtr->evals, pagePtr->size, pagePtr->code.nblocks,
pagePtr->code.nscripts);
Tcl_AppendElement(interp, buf);
hPtr = Tcl_NextHashEntry(&search);
Expand Down Expand Up @@ -656,7 +656,8 @@ ParseFile(NsInterp *itPtr, char *file, struct stat *stPtr)
Tcl_Encoding encoding;
Tcl_DString utf;
char *page, *buf;
int fd, n, size, trys;
int fd, n, trys;
size_t size;
Page *pagePtr;
AdpParse parse;

Expand Down Expand Up @@ -734,8 +735,8 @@ ParseFile(NsInterp *itPtr, char *file, struct stat *stPtr)
pagePtr->code.len = (int *) (pagePtr + 1);
pagePtr->code.base = (char *) (pagePtr->code.len + parse.code.nblocks);
pagePtr->file = pagePtr->code.base + parse.text.length;
memcpy(pagePtr->code.len, parse.hdr.string, parse.hdr.length);
memcpy(pagePtr->code.base, parse.text.string, parse.text.length);
memcpy(pagePtr->code.len, parse.hdr.string, (size_t)parse.hdr.length);
memcpy(pagePtr->code.base, parse.text.string, (size_t)parse.text.length);
strcpy(pagePtr->file, file);
ParseFree(&parse);
}
Expand Down Expand Up @@ -911,7 +912,7 @@ AdpDebug(NsInterp *itPtr, char *ptr, int len, int nscript)
Tcl_AppendResult(interp, "could not create adp debug file \"",
debugfile, "\": ", Tcl_PosixError(interp), NULL);
} else {
if (write(fd, ds.string, ds.length) < 0) {
if (write(fd, ds.string, (size_t)ds.length) < 0) {
Tcl_AppendResult(interp, "write to \"", debugfile,
"\" failed: ", Tcl_PosixError(interp), NULL);
} else {
Expand Down
18 changes: 10 additions & 8 deletions nsd/adpparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* ADP parser.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/adpparse.c,v 1.12 2002/11/06 15:18:13 jcollins Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/adpparse.c,v 1.13 2003/03/07 18:08:14 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"

Expand Down Expand Up @@ -159,12 +159,12 @@ RegisterCmd(ClientData arg, Tcl_Interp *interp, int argc,
tagPtr = ns_malloc(sizeof(Tag) + slen + elen);
tagPtr->type = type;
tagPtr->string = (char *) tagPtr + sizeof(Tag);
memcpy(tagPtr->string, string, slen);
memcpy(tagPtr->string, string, (size_t)slen);
if (argc == 3) {
tagPtr->endtag = NULL;
} else {
tagPtr->endtag = tagPtr->string + slen;
memcpy(tagPtr->endtag, argv[2], elen);
memcpy(tagPtr->endtag, argv[2], (size_t)elen);
}
Ns_RWLockWrLock(&servPtr->adp.taglock);
hPtr = Tcl_CreateHashEntry(&servPtr->adp.tags, argv[1], &new);
Expand Down Expand Up @@ -345,7 +345,8 @@ GetTag(Tcl_DString *dsPtr, char *s, char *e, char **aPtr)
static void
ParseAtts(char *s, char *e, int *servPtr, Tcl_DString *attsPtr, int atts)
{
char *vs, *ve, *as, *ae, end, vsave, asave;
char *vs = NULL, *ve = NULL, *as = NULL, *ae = NULL;
char end = 0, vsave = 0, asave = 0;

if (servPtr != NULL) {
*servPtr = 0;
Expand Down Expand Up @@ -554,11 +555,12 @@ AppendTag(AdpParse *parsePtr, Tag *tagPtr, char *as, char *ae, char *se)
static void
Parse(AdpParse *parsePtr, NsServer *servPtr, char *utf)
{
Tag *tagPtr;
char *ss, *se, *s, *e, *a, *as, *ae, *t;
int level, state, stream, streamdone;
Tag *tagPtr = NULL;
char *ss = NULL, *se = NULL, *s = NULL, *e = NULL;
char *a = NULL, *as = NULL, *ae = NULL , *t = NULL;
int level = 0, state, stream, streamdone;
Tcl_DString tag;
Tcl_HashEntry *hPtr;
Tcl_HashEntry *hPtr = NULL;

Tcl_DStringInit(&tag);
t = utf;
Expand Down
4 changes: 2 additions & 2 deletions nsd/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*Support for pre-bound privileged ports.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/binder.c,v 1.14 2002/07/14 23:14:25 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/binder.c,v 1.15 2003/03/07 18:08:14 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"

Expand Down Expand Up @@ -67,7 +67,7 @@ static Ns_Mutex lock;
int
Ns_SockListenEx(char *address, int port, int backlog)
{
int err, sock;
int err, sock = -1;
struct sockaddr_in sa;
Tcl_HashEntry *hPtr;

Expand Down
14 changes: 7 additions & 7 deletions nsd/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Support for the configuration file
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/config.c,v 1.15 2002/08/25 22:06:40 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/config.c,v 1.16 2003/03/07 18:08:15 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"
#define ISSLASH(c) ((c) == '/' || (c) == '\\')
Expand Down Expand Up @@ -339,7 +339,7 @@ NsConfigRead(char *file)
struct stat st;
int fd;
char *buf;
off_t n;
size_t n;

if (stat(file, &st) != 0) {
Ns_Fatal("config: stat(%s) failed: %s", file, strerror(errno));
Expand Down Expand Up @@ -472,7 +472,7 @@ ConfigGet(char *section, char *key, int exact)
*/

static int
ParamCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
ParamCmd(ClientData arg, Tcl_Interp *interp, int argc, CONST char **argv)
{
Ns_Set *set;

Expand All @@ -487,7 +487,7 @@ ParamCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
" not preceded by an ns_section command.", NULL);
return TCL_ERROR;
}
Ns_SetPut(set, argv[1], argv[2]);
Ns_SetPut(set, (char*)argv[1], (char*)argv[2]);
return TCL_OK;
}

Expand All @@ -511,17 +511,17 @@ ParamCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
*/

static int
SectionCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv)
SectionCmd(ClientData arg, Tcl_Interp *interp, int argc, CONST char **argv)
{
Ns_Set **set;

if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " sectionname", NULL);
(char*)argv[0], " sectionname", NULL);
return TCL_ERROR;
}
set = (Ns_Set **) arg;
*set = GetSection(argv[1], 1);
*set = GetSection((char*)argv[1], 1);
return TCL_OK;
}

Expand Down
5 changes: 3 additions & 2 deletions nsd/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Manage the Ns_Conn structure
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/conn.c,v 1.36 2003/03/06 19:39:11 mpagenva Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/conn.c,v 1.37 2003/03/07 18:08:16 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"

Expand Down Expand Up @@ -1148,7 +1148,8 @@ NsTclWriteContentObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **
return TCL_ERROR;
}
Tcl_Flush(chan);
if (Ns_ConnCopyToChannel(itPtr->conn, itPtr->conn->contentLength, chan) != NS_OK) {
if (Ns_ConnCopyToChannel(itPtr->conn, (size_t)itPtr->conn->contentLength,
chan) != NS_OK) {
Tcl_SetResult(interp, "could not copy content (likely client disconnect)",
TCL_STATIC);
return TCL_ERROR;
Expand Down
Loading

0 comments on commit 86c9846

Please sign in to comment.