3 @@ -698,7 +698,7 @@ NEOERR *cgi_parse (CGI *cgi)
7 - if (len-x > sizeof(buf))
8 + if (len-x > (int) sizeof(buf))
9 cgiwrap_read (buf, sizeof(buf), &r);
11 cgiwrap_read (buf, len - x, &r);
12 @@ -1363,6 +1363,8 @@ void cgi_neo_error (CGI *cgi, NEOERR *er
19 cgiwrap_writef("Status: 500\n");
20 cgiwrap_writef("Content-Type: text/html\n\n");
21 @@ -1377,6 +1379,8 @@ void cgi_error (CGI *cgi, const char *fm
27 cgiwrap_writef("Status: 500\n");
28 cgiwrap_writef("Content-Type: text/html\n\n");
29 cgiwrap_writef("<html><body>\nAn error occured:<pre>");
30 @@ -1536,6 +1540,8 @@ NEOERR *cgi_cookie_set (CGI *cgi, const
36 if (path == NULL) path = "/";
39 @@ -1584,6 +1590,8 @@ NEOERR *cgi_cookie_set (CGI *cgi, const
40 NEOERR *cgi_cookie_clear (CGI *cgi, const char *name, const char *domain,
45 if (path == NULL) path = "/";
62 @@ -94,7 +94,7 @@ NEOERR *export_date_tm (HDF *data, const
63 if (err) return nerr_pass(err);
64 err = hdf_set_int_value (obj, "wday", ttm->tm_wday);
65 if (err) return nerr_pass(err);
66 - // neo_tz_offset() returns offset from GMT in seconds
67 + /* neo_tz_offset() returns offset from GMT in seconds */
68 tzoffset_seconds = neo_tz_offset(ttm);
69 tzoffset = tzoffset_seconds / 60;
71 @@ -109,12 +109,12 @@ NEOERR *export_date_tm (HDF *data, const
75 -NEOERR *export_date_time_t (HDF *data, const char *prefix, const char *timezone,
76 +NEOERR *export_date_time_t (HDF *data, const char *prefix, const char *tz,
81 - neo_time_expand (tt, timezone, &ttm);
82 + neo_time_expand (tt, tz, &ttm);
83 return nerr_pass (export_date_tm (data, prefix, &ttm));
91 NEOERR *export_date_tm (HDF *obj, const char *prefix, struct tm *ttm);
92 -NEOERR *export_date_time_t (HDF *obj, const char *prefix, const char *timezone,
93 +NEOERR *export_date_time_t (HDF *obj, const char *prefix, const char *tz,
99 @@ -774,7 +774,7 @@ NEOERR *html_strip_alloc(const char *src
103 - if (ampl < sizeof(amp)-1)
104 + if (ampl < (int) sizeof(amp)-1)
105 amp[ampl++] = tolower(src[x]);
110 @@ -155,14 +155,14 @@ static NEOERR * _read_line (CGI *cgi, ch
111 ofs = cgi->readlen - cgi->nl;
112 memmove(cgi->buf, cgi->buf + cgi->nl, ofs);
114 - // Read either as much buffer space as we have left, or up to
115 - // the amount of data remaining according to Content-Length
116 - // If there is no Content-Length, just use the buffer space, but recognize
117 - // that it might not work on some servers or cgiwrap implementations.
118 - // Some servers will close their end of the stdin pipe, so cgiwrap_read
119 - // will return if we ask for too much. Techically, not including
120 - // Content-Length is against the HTTP spec, so we should consider failing
121 - // earlier if we don't have a length.
122 + /* Read either as much buffer space as we have left, or up to
123 + * the amount of data remaining according to Content-Length
124 + * If there is no Content-Length, just use the buffer space, but recognize
125 + * that it might not work on some servers or cgiwrap implementations.
126 + * Some servers will close their end of the stdin pipe, so cgiwrap_read
127 + * will return if we ask for too much. Techically, not including
128 + * Content-Length is against the HTTP spec, so we should consider failing
129 + * earlier if we don't have a length. */
130 to_read = cgi->buflen - ofs;
131 if (cgi->data_expected && (to_read > cgi->data_expected - cgi->data_read))
135 @@ -59,7 +59,7 @@ typedef enum
143 #define ST_ANYWHERE (ST_EACH | ST_WITH | ST_ELSE | ST_IF | ST_GLOBAL | ST_DEF | ST_LOOP | ST_ALT | ST_ESCAPE)
144 @@ -178,7 +178,8 @@ CS_CMDS Commands[] = {
145 escape_parse, escape_eval, 1},
146 {"/escape", sizeof("/escape")-1, ST_ESCAPE, ST_POP,
147 end_parse, skip_eval, 1},
153 /* Possible Config.VarEscapeMode values */
154 @@ -193,7 +194,7 @@ CS_ESCAPE_MODES EscapeModes[] = {
155 {"html", NEOS_ESCAPE_HTML},
156 {"js", NEOS_ESCAPE_SCRIPT},
157 {"url", NEOS_ESCAPE_URL},
163 @@ -1154,7 +1155,7 @@ static char *token_list (CSTOKEN *tokens
165 t = snprintf(p, buflen, "%s%d:%s", i ? " ":"", i, expand_token_type(tokens[i].type, 0));
167 - if (t == -1 || t >= buflen) return buf;
168 + if (t == -1 || t >= (int) buflen) return buf;
172 @@ -2567,6 +2568,9 @@ static NEOERR *else_parse (CSPARSE *pars
179 /* ne_warn ("else"); */
180 err = uListGet (parse->stack, -1, (void *)&entry);
181 if (err != STATUS_OK) return nerr_pass(err);
182 @@ -2600,6 +2604,9 @@ static NEOERR *endif_parse (CSPARSE *par
189 /* ne_warn ("endif"); */
190 err = uListGet (parse->stack, -1, (void *)&entry);
191 if (err != STATUS_OK) return nerr_pass(err);
192 @@ -2781,6 +2788,9 @@ static NEOERR *end_parse (CSPARSE *parse
199 err = uListGet (parse->stack, -1, (void *)&entry);
200 if (err != STATUS_OK) return nerr_pass(err);
202 @@ -2796,6 +2806,8 @@ static NEOERR *include_parse (CSPARSE *p
208 memset(&arg1, 0, sizeof(CSARG));
210 flags |= CSF_REQUIRED;
211 @@ -3511,6 +3523,8 @@ static NEOERR *loop_eval (CSPARSE *parse
213 static NEOERR *skip_eval (CSPARSE *parse, CSTREE *node, CSTREE **next)
220 @@ -3651,6 +3665,8 @@ static NEOERR * _builtin_subcount(CSPARS
226 memset(&val, 0, sizeof(val));
227 err = eval_expr(parse, args, &val);
228 if (err) return nerr_pass(err);
229 @@ -3683,6 +3699,8 @@ static NEOERR * _builtin_str_length(CSPA
235 memset(&val, 0, sizeof(val));
236 err = eval_expr(parse, args, &val);
237 if (err) return nerr_pass(err);
238 @@ -3706,6 +3724,8 @@ static NEOERR * _builtin_str_crc(CSPARSE
244 memset(&val, 0, sizeof(val));
245 err = eval_expr(parse, args, &val);
246 if (err) return nerr_pass(err);
247 @@ -3731,6 +3751,8 @@ static NEOERR * _builtin_str_find(CSPARS
253 result->op_type = CS_TYPE_NUM;
256 @@ -3758,6 +3780,8 @@ static NEOERR * _builtin_name(CSPARSE *p
262 memset(&val, 0, sizeof(val));
263 err = eval_expr(parse, args, &val);
264 if (err) return nerr_pass(err);
265 @@ -3790,6 +3814,8 @@ static NEOERR * _builtin_first(CSPARSE *
271 memset(&val, 0, sizeof(val));
272 err = eval_expr(parse, args, &val);
273 if (err) return nerr_pass(err);
274 @@ -3819,6 +3845,8 @@ static NEOERR * _builtin_last(CSPARSE *p
280 memset(&val, 0, sizeof(val));
281 err = eval_expr(parse, args, &val);
282 if (err) return nerr_pass(err);
283 @@ -3853,6 +3881,8 @@ static NEOERR * _builtin_abs (CSPARSE *p
289 memset(&val, 0, sizeof(val));
290 err = eval_expr(parse, args, &val);
291 if (err) return nerr_pass(err);
292 @@ -3873,6 +3903,8 @@ static NEOERR * _builtin_max (CSPARSE *p
298 result->op_type = CS_TYPE_NUM;
301 @@ -3891,6 +3923,8 @@ static NEOERR * _builtin_min (CSPARSE *p
307 result->op_type = CS_TYPE_NUM;
310 @@ -3910,6 +3944,8 @@ static NEOERR * _builtin_str_slice (CSPA
316 result->op_type = CS_TYPE_STRING;
319 @@ -3921,9 +3957,9 @@ static NEOERR * _builtin_str_slice (CSPA
320 if (b < 0 && e == 0) e = len;
323 - if (e > len) e = len;
324 + if (e > (int) len) e = len;
325 /* Its the whole string */
326 - if (b == 0 && e == len)
327 + if (b == 0 && e == (int) len)
331 @@ -4179,10 +4215,10 @@ static NEOERR *cs_init_internal (CSPARSE
332 my_parse->global_hdf = parent->global_hdf;
333 my_parse->fileload = parent->fileload;
334 my_parse->fileload_ctx = parent->fileload_ctx;
335 - // This should be safe since locals handling is done entirely local to the
336 - // eval functions, not globally by the parse handling. This should
337 - // pass the locals down to the new parse context to make locals work with
339 + /* This should be safe since locals handling is done entirely local to the
340 + * eval functions, not globally by the parse handling. This should
341 + * pass the locals down to the new parse context to make locals work with
343 my_parse->locals = parent->locals;
344 my_parse->parent = parent;
348 @@ -87,6 +87,8 @@ static NEOERR *dictNewItem(dictCtx dict,
357 --- a/util/neo_date.h
358 +++ b/util/neo_date.h
362 /* UTC time_t -> struct tm in local timezone */
363 -void neo_time_expand (const time_t tt, const char *timezone, struct tm *ttm);
364 +void neo_time_expand (const time_t tt, const char *tz, struct tm *ttm);
366 /* local timezone struct tm -> time_t UTC */
367 -time_t neo_time_compact (struct tm *ttm, const char *timezone);
368 +time_t neo_time_compact (struct tm *ttm, const char *tz);
370 /* To be portable... in seconds */
371 long neo_tz_offset(struct tm *ttm);
372 --- a/util/neo_files.c
373 +++ b/util/neo_files.c
374 @@ -35,7 +35,7 @@ NEOERR *ne_mkdirs (const char *path, mod
376 strncpy (mypath, path, sizeof(mypath));
378 - if ((x < sizeof(mypath)) && (mypath[x-1] != '/'))
379 + if ((x < (int) sizeof(mypath)) && (mypath[x-1] != '/'))
383 --- a/util/neo_hash.c
384 +++ b/util/neo_hash.c
385 @@ -57,7 +57,7 @@ void ne_hash_destroy (NE_HASH **hash)
389 - for (x = 0; x < my_hash->size; x++)
390 + for (x = 0; x < (int) my_hash->size; x++)
392 node = my_hash->nodes[x];
394 @@ -111,16 +111,16 @@ void *ne_hash_lookup(NE_HASH *hash, void
396 void *ne_hash_remove(NE_HASH *hash, void *key)
398 - NE_HASHNODE **node, *remove;
399 + NE_HASHNODE **node, *rem;
402 node = _hash_lookup_node(hash, key, NULL);
406 - *node = remove->next;
407 - value = remove->value;
411 + value = rem->value;
416 @@ -233,7 +233,7 @@ static NEOERR *_hash_resize(NE_HASH *has
417 hash->size = hash->size*2;
419 /* Initialize new parts */
420 - for (x = orig_size; x < hash->size; x++)
421 + for (x = orig_size; x < (int) hash->size; x++)
423 hash->nodes[x] = NULL;
425 @@ -248,7 +248,7 @@ static NEOERR *_hash_resize(NE_HASH *has
427 entry = prev ? prev->next : hash->nodes[x])
429 - if ((entry->hashv & hash_mask) != x)
430 + if ((int) (entry->hashv & hash_mask) != x)
436 @@ -54,7 +54,7 @@ static UINT32 hash_hdf_hash(const void *
439 static NEOERR *_alloc_hdf (HDF **hdf, const char *name, size_t nlen,
440 - const char *value, int dup, int wf, HDF *top)
441 + const char *value, int dupl, int wf, HDF *top)
443 *hdf = calloc (1, sizeof (HDF));
445 @@ -80,7 +80,7 @@ static NEOERR *_alloc_hdf (HDF **hdf, co
452 (*hdf)->alloc_value = 1;
453 (*hdf)->value = strdup(value);
454 @@ -233,7 +233,7 @@ static int _walk_hdf (HDF *hdf, const ch
458 - x = (s == NULL) ? strlen(n) : s - n;
459 + x = (s == NULL) ? (int) strlen(n) : s - n;
463 @@ -279,7 +279,7 @@ static int _walk_hdf (HDF *hdf, const ch
467 - x = (s == NULL) ? strlen(n) : s - n;
468 + x = (s == NULL) ? (int) strlen(n) : s - n;
472 @@ -570,7 +570,7 @@ NEOERR* _hdf_hash_level(HDF *hdf)
475 static NEOERR* _set_value (HDF *hdf, const char *name, const char *value,
476 - int dup, int wf, int link, HDF_ATTR *attr,
477 + int dupl, int wf, int lnk, HDF_ATTR *attr,
481 @@ -615,7 +615,7 @@ static NEOERR* _set_value (HDF *hdf, con
482 hdf->alloc_value = 0;
488 hdf->alloc_value = 1;
489 hdf->value = strdup(value);
490 @@ -650,7 +650,7 @@ static NEOERR* _set_value (HDF *hdf, con
491 strcpy(new_name, hdf->value);
492 strcat(new_name, ".");
493 strcat(new_name, name);
494 - err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node);
495 + err = _set_value (hdf->top, new_name, value, dupl, wf, lnk, attr, set_node);
497 return nerr_pass(err);
499 @@ -719,8 +719,8 @@ skip_search:
503 - err = _alloc_hdf (&hp, n, x, value, dup, wf, hdf->top);
504 - if (link) hp->link = 1;
505 + err = _alloc_hdf (&hp, n, x, value, dupl, wf, hdf->top);
506 + if (lnk) hp->link = 1;
510 @@ -770,7 +770,7 @@ skip_search:
518 hp->value = strdup(value);
519 @@ -784,7 +784,7 @@ skip_search:
520 hp->value = (char *)value;
523 - if (link) hp->link = 1;
524 + if (lnk) hp->link = 1;
528 @@ -796,7 +796,7 @@ skip_search:
530 strcpy(new_name, hp->value);
532 - err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node);
533 + err = _set_value (hdf->top, new_name, value, dupl, wf, lnk, attr, set_node);
535 return nerr_pass(err);
537 @@ -1267,6 +1267,8 @@ NEOERR* hdf_dump(HDF *hdf, const char *p
539 NEOERR* hdf_dump_format (HDF *hdf, int lvl, FILE *fp)
543 return nerr_pass(hdf_dump_cb(hdf, "", DUMP_TYPE_PRETTY, 0, fp, _fp_dump_cb));
546 @@ -1357,7 +1359,7 @@ static int _copy_line (const char **s, c
550 - while (*st && x < buf_len-1)
551 + while (*st && x < (int) buf_len-1)
554 if (*st++ == '\n') break;
555 @@ -1398,17 +1400,17 @@ static NEOERR *_copy_line_advance(const
557 char *_strndup(const char *s, int len) {
561 if (s == NULL) return NULL;
562 - dup = (char *) malloc(len+1);
563 - if (dup == NULL) return NULL;
564 + t = (char *) malloc(len+1);
565 + if (t == NULL) return NULL;
566 for (x = 0; x < len && s[x]; x++)
579 /* attributes are of the form [key1, key2, key3=value, key4="repr"] */
580 --- a/util/neo_misc.c
581 +++ b/util/neo_misc.c
582 @@ -34,7 +34,7 @@ void ne_vwarn (const char *fmt, va_list
584 localtime_r(&now, &my_tm);
586 - strftime(tbuf, sizeof(tbuf), "%m/%d %T", &my_tm);
587 + strftime(tbuf, sizeof(tbuf), "%m/%d %H:%M:%S", &my_tm);
589 vsnprintf (buf, sizeof(buf), fmt, ap);
591 --- a/util/neo_misc.h
592 +++ b/util/neo_misc.h
593 @@ -106,6 +106,10 @@ typedef char BOOL;
594 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
598 +#define UNUSED(x) ((void)(x))
606 @@ -489,7 +489,7 @@ static NEOERR *_ne_net_read_int(NSOCK *s
610 - while (x < sizeof(buf))
611 + while (x < (int) sizeof(buf))
613 while (sock->il - sock->ib > 0)
615 --- a/util/neo_server.c
616 +++ b/util/neo_server.c
617 @@ -104,6 +104,8 @@ static int ShutdownPending = 0;
619 static void sig_term(int sig)
628 @@ -592,11 +592,11 @@ char *repr_string_alloc (const char *s)
632 -// List of all characters that must be escaped
633 -// List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
634 +/* List of all characters that must be escaped
635 + * List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm */
636 static char EscapedChars[] = "$&+,/:;=?@ \"<>#%{}|\\^~[]`'";
638 -// Check if a single character needs to be escaped
639 +/* Check if a single character needs to be escaped */
640 static BOOL is_reserved_char(char c)
643 @@ -835,15 +835,15 @@ NEOERR *neos_url_validate (const char *i
644 colonpos = memchr(in, ':', i);
646 if (colonpos == NULL) {
647 - // no scheme in 'in': so this is a relative url
648 + /* no scheme in 'in': so this is a relative url */
652 - for (i = 0; i < num_protocols; i++)
653 + for (i = 0; (int) i < num_protocols; i++)
655 if ((inlen >= strlen(URL_PROTOCOLS[i])) &&
656 strncmp(in, URL_PROTOCOLS[i], strlen(URL_PROTOCOLS[i])) == 0) {
657 - // 'in' starts with one of the allowed protocols
658 + /* 'in' starts with one of the allowed protocols */
662 @@ -854,7 +854,7 @@ NEOERR *neos_url_validate (const char *i
664 return neos_html_escape(in, inlen, esc);
666 - // 'in' contains an unsupported scheme, replace with '#'
667 + /* 'in' contains an unsupported scheme, replace with '#' */
669 err = string_append (&out_s, "#");
670 if (err) return nerr_pass (err);
671 --- a/util/skiplist.c
672 +++ b/util/skiplist.c
673 @@ -409,7 +409,7 @@ NEOERR *skipNewList(skipList *skip, int
674 if (err != STATUS_OK) break;
676 for(i = 0; /* init header and tail */
677 - i <= list->maxLevel;
678 + i <= (UINT32) list->maxLevel;
680 list->tail->next[i] = NULL;
681 list->header->next[i] = list->tail;
682 @@ -444,7 +444,7 @@ static void skipFreeAllItems(skipList li
684 /* clear header pointers */
686 - i <= list->maxLevel;
687 + i <= (UINT32) list->maxLevel;
689 list->header->next[i] = list->tail;