r7023: reduced the number of warnings in building ejs and esp
authorAndrew Tridgell <tridge@samba.org>
Fri, 27 May 2005 14:07:29 +0000 (14:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:07 +0000 (13:17 -0500)
(This used to be commit ef998f9f8fb9759e5a4572acb3f9038efc019e5e)

source4/web_server/calls.c
source4/web_server/ejs/ejs.c
source4/web_server/ejs/ejs.h
source4/web_server/ejs/ejsInternal.h
source4/web_server/ejs/ejsProcs.c
source4/web_server/ejs/miniMpr.h
source4/web_server/ejs/var.c
source4/web_server/esp/esp.c
source4/web_server/esp/esp.h
source4/web_server/esp/espProcs.c

index 859ae17433cc9c1b06d06819ed052514b07b4597..5168f93564064f286bb14c84c8bec0fb315e4172 100644 (file)
@@ -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
 */
index 4f5eb6b1292302d4963c91f0208512eefded6ce2..11da79a0ddcab3bb48cfd440aa5371c3e3d8b307 100644 (file)
@@ -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;
index 60aa93a4089175374d92d52c397888e74300f98a..987810ad064d4b4adcc4132d271d80be13ac860e 100644 (file)
@@ -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);
 
index fe79afb87020b39f3ff8eaf8e7a0827823089292..d5d57608120a9eef08f03f2902e68ea8fe4dbddf 100644 (file)
@@ -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
 }
index 3b5689b0bdd03c6c7ff1c3ce0e7fc344984df1ff..163835ed6eb1b3767a1b6ac1e1ff36a96e730851 100644 (file)
@@ -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)");
index 6fc9c02a16a0d54d240f2e40c889285e93c833d1..b34fb2e2930ec012a81db483e2225410c35ba0e5 100644 (file)
@@ -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 */
 
index 53b66d8b1b322aaa83e0efad8366ed304f915720..ca8eb0fb2aca1885e42fce4e99f71faab0b028c5 100644 (file)
@@ -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;
 }
 
index c90e4afe4292ae9e9ef703a465f48ef222ff1839..4041823093e53ac54d1b5bc5fcb47202ce70e615 100644 (file)
@@ -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);
 
index a6cac1e85266136c0581cacfbd3aae80a93a30de..ff4210befa6fa3c48cbe3a2a850b80da073124b9 100644 (file)
@@ -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)
index 5c99e092c94cb832fcff0f02af6bc65f17a5cd18..ff1751a7ef0fa1cc9490d094512a4289571483d4 100644 (file)
@@ -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;