From 38c2164f68514727140270821c569a106b705997 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 27 May 2005 14:07:29 +0000 Subject: r7023: reduced the number of warnings in building ejs and esp (This used to be commit ef998f9f8fb9759e5a4572acb3f9038efc019e5e) --- source4/web_server/calls.c | 2 ++ source4/web_server/ejs/ejs.c | 6 ++++-- source4/web_server/ejs/ejs.h | 2 +- source4/web_server/ejs/ejsInternal.h | 2 +- source4/web_server/ejs/ejsProcs.c | 4 ++-- source4/web_server/ejs/miniMpr.h | 6 +++--- source4/web_server/ejs/var.c | 2 +- source4/web_server/esp/esp.c | 4 ++-- source4/web_server/esp/esp.h | 8 ++++---- source4/web_server/esp/espProcs.c | 2 +- 10 files changed, 21 insertions(+), 17 deletions(-) (limited to 'source4') diff --git a/source4/web_server/calls.c b/source4/web_server/calls.c index 859ae17433..5168f93564 100644 --- a/source4/web_server/calls.c +++ b/source4/web_server/calls.c @@ -193,6 +193,8 @@ static int esp_lpGet(struct EspRequest *ep, int argc, char **argv) return 0; } + + /* setup the C functions that be called from ejs */ diff --git a/source4/web_server/ejs/ejs.c b/source4/web_server/ejs/ejs.c index 4f5eb6b129..11da79a0dd 100644 --- a/source4/web_server/ejs/ejs.c +++ b/source4/web_server/ejs/ejs.c @@ -275,7 +275,7 @@ int ejsEvalFile(EjsId eid, char *path, MprVar *result, char **emsg) if ((script = (char*) mprMalloc(sbuf.st_size + 1)) == NULL) { close(fd); - ejsError(ep, "Cant malloc %d", sbuf.st_size); + ejsError(ep, "Cant malloc %d", (int)sbuf.st_size); goto error; } @@ -468,7 +468,9 @@ int ejsEvalScript(EjsId eid, char *script, MprVar *vp, char **emsg) * Core error handling */ -void ejsErrorCore(Ejs* ep, const char *fmt, va_list args) +static void ejsErrorCore(Ejs* ep, const char *fmt, va_list args) PRINTF_ATTRIBUTE(2, 0); + +static void ejsErrorCore(Ejs* ep, const char *fmt, va_list args) { EjsInput *ip; char *errbuf, *msgbuf; diff --git a/source4/web_server/ejs/ejs.h b/source4/web_server/ejs/ejs.h index 60aa93a408..987810ad06 100644 --- a/source4/web_server/ejs/ejs.h +++ b/source4/web_server/ejs/ejs.h @@ -109,7 +109,7 @@ extern void *ejsGetThisPtr(EjsId eid); extern MprVar *ejsGetReturnValue(EjsId eid); extern int ejsGetLineNumber(EjsId eid); extern int ejsParseArgs(int argc, char **argv, char *fmt, ...); -extern void ejsSetErrorMsg(EjsId eid, const char* fmt, ...); +extern void ejsSetErrorMsg(EjsId eid, const char* fmt, ...) PRINTF_ATTRIBUTE(2,3); extern void ejsSetReturnValue(EjsId eid, MprVar value); extern void ejsSetReturnString(EjsId eid, const char *str); diff --git a/source4/web_server/ejs/ejsInternal.h b/source4/web_server/ejs/ejsInternal.h index fe79afb870..d5d5760812 100644 --- a/source4/web_server/ejs/ejsInternal.h +++ b/source4/web_server/ejs/ejsInternal.h @@ -274,7 +274,7 @@ extern int ejsDefineStandardProperties(MprVar *objVar); /* * Error handling */ -extern void ejsError(Ejs *ep, const char *fmt, ...); +extern void ejsError(Ejs *ep, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); #ifdef __cplusplus } diff --git a/source4/web_server/ejs/ejsProcs.c b/source4/web_server/ejs/ejsProcs.c index 3b5689b0bd..163835ed6e 100644 --- a/source4/web_server/ejs/ejsProcs.c +++ b/source4/web_server/ejs/ejsProcs.c @@ -544,10 +544,10 @@ static int printlnProc(EjsHandle eid, int argc, MprVar **argv) static int traceProc(EjsHandle eid, int argc, char **argv) { if (argc == 1) { - mprLog(0, argv[0]); + mprLog(0, "%s", argv[0]); } else if (argc == 2) { - mprLog(atoi(argv[0]), argv[1]); + mprLog(atoi(argv[0]), "%s", argv[1]); } else { ejsSetErrorMsg(eid, "Usage: trace([level], message)"); diff --git a/source4/web_server/ejs/miniMpr.h b/source4/web_server/ejs/miniMpr.h index 6fc9c02a16..b34fb2e293 100644 --- a/source4/web_server/ejs/miniMpr.h +++ b/source4/web_server/ejs/miniMpr.h @@ -250,10 +250,10 @@ extern void *mprRealloc(void *ptr, uint size); extern void mprFree(void *ptr); extern char *mprStrdup(const char *str); extern int mprAllocVsprintf(char **msgbuf, int maxSize, const char *fmt, - va_list args); -extern int mprAllocSprintf(char **msgbuf, int maxSize, const char *fmt, ...); + va_list args) PRINTF_ATTRIBUTE(3,0); +extern int mprAllocSprintf(char **msgbuf, int maxSize, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); extern char *mprItoa(int num, char *buf, int width); -extern void mprLog(int level, const char *fmt, ...); +extern void mprLog(int level, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); extern void mprBreakpoint(const char *file, int line, const char *msg); #endif /* BLD_GOAHEAD_WEBSERVER */ diff --git a/source4/web_server/ejs/var.c b/source4/web_server/ejs/var.c index 53b66d8b1b..ca8eb0fb2a 100644 --- a/source4/web_server/ejs/var.c +++ b/source4/web_server/ejs/var.c @@ -1319,7 +1319,7 @@ MprVar mprCreateObjVar(const char *name, int hashSize) } v.allocatedData = 1; v.name = mprStrdup(name); - mprLog(7, "mprCreateObjVar %s, 0x%x\n", name, v.properties); + mprLog(7, "mprCreateObjVar %s, 0x%p\n", name, v.properties); return v; } diff --git a/source4/web_server/esp/esp.c b/source4/web_server/esp/esp.c index c90e4afe42..4041823093 100644 --- a/source4/web_server/esp/esp.c +++ b/source4/web_server/esp/esp.c @@ -46,7 +46,7 @@ * Master ESP control interface with the web server */ -static Esp *esp; +static const Esp *esp; /***************************** Forward Declarations ***************************/ @@ -58,7 +58,7 @@ static int buildScript(EspRequest *ep, char **jsBuf, char *input, char * Called at server initialization */ -int espOpen(Esp *control) +int espOpen(const Esp *control) { mprAssert(control); diff --git a/source4/web_server/esp/esp.h b/source4/web_server/esp/esp.h index a6cac1e852..ff4210befa 100644 --- a/source4/web_server/esp/esp.h +++ b/source4/web_server/esp/esp.h @@ -81,7 +81,7 @@ typedef void* EspHandle; /* Opaque Web server handle type */ typedef struct EspRequest { MprStr docPath; /* Physical path for ESP page */ EjsId eid; /* EJS instance handle */ - struct Esp *esp; /* Pointer to ESP control block */ + const struct Esp *esp; /* Pointer to ESP control block */ EspHandle requestHandle; /* Per request web server handle */ MprStr uri; /* Request URI */ MprVar *variables; /* Pointer to variables */ @@ -148,7 +148,7 @@ typedef int (*EspStringCFunction)(EspRequest *ep, int argc, /* * APIs for those hosting the ESP module */ -extern int espOpen(Esp *control); +extern int espOpen(const Esp *control); extern void espClose(void); extern EspRequest *espCreateRequest(EspHandle webServerRequestHandle, char *uri, MprVar *envObj); @@ -175,7 +175,7 @@ extern void *espGetThisPtr(EspRequest *ep); /* * Utility routines to use in C methods */ -extern void espError(EspRequest *ep, const char *fmt, ...); +extern void espError(EspRequest *ep, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); extern int espEvalFile(EspRequest *ep, char *path, MprVar *result, char **emsg); extern int espEvalScript(EspRequest *ep, char *script, MprVar *result, @@ -191,7 +191,7 @@ extern void espSetHeader(EspRequest *ep, char *header, extern void espSetReturnString(EspRequest *ep, const char *str); extern int espWrite(EspRequest *ep, char *buf, int size); extern int espWriteString(EspRequest *ep, char *buf); -extern int espWriteFmt(EspRequest *ep, char *fmt, ...); +extern int espWriteFmt(EspRequest *ep, char *fmt, ...) PRINTF_ATTRIBUTE(2,3); /* * ESP array[] variable access (set will update/create) diff --git a/source4/web_server/esp/espProcs.c b/source4/web_server/esp/espProcs.c index 5c99e092c9..ff1751a7ef 100644 --- a/source4/web_server/esp/espProcs.c +++ b/source4/web_server/esp/espProcs.c @@ -69,7 +69,7 @@ static int destroySessionProc(EspRequest *ep, int argc, char **argv) static int includeProc(EspRequest *ep, int argc, char **argv) { - Esp *esp; + const Esp *esp; char path[MPR_MAX_FNAME], dir[MPR_MAX_FNAME]; char *emsg, *buf; int size, i; -- cgit