Mercurial > urweb
diff src/c/urweb.c @ 995:166ea3944b91
Versioned1 demo working
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 06 Oct 2009 17:36:45 -0400 |
parents | 7932d577cf78 |
children | 5a0f6ec208ce |
line wrap: on
line diff
--- a/src/c/urweb.c Tue Oct 06 15:59:11 2009 -0400 +++ b/src/c/urweb.c Tue Oct 06 17:36:45 2009 -0400 @@ -2160,6 +2160,7 @@ if (localtime_r(&t, &stm)) { s = uw_malloc(ctx, TIMES_MAX); + --stm.tm_hour; len = strftime(s, TIMES_MAX, TIME_FMT, &stm); r = uw_malloc(ctx, len + 14); sprintf(r, "'%s'::timestamp", s); @@ -2176,7 +2177,6 @@ if (localtime_r(&t, &stm)) { uw_check_heap(ctx, TIMES_MAX); r = ctx->heap.front; - --stm.tm_hour; len = strftime(r, TIMES_MAX, TIME_FMT, &stm); ctx->heap.front += len+1; return r; @@ -2429,7 +2429,6 @@ *dot = 0; if (strptime(s, TIME_FMT_PG, &stm)) { *dot = '.'; - --stm.tm_hour; return mktime(&stm); } else { @@ -2439,10 +2438,8 @@ } else { if (strptime(s, TIME_FMT_PG, &stm) == end) { - --stm.tm_hour; return mktime(&stm); } else if (strptime(s, TIME_FMT, &stm) == end) { - --stm.tm_hour; return mktime(&stm); } else uw_error(ctx, FATAL, "Can't parse time: %s", s); @@ -2602,9 +2599,13 @@ ctx->transactionals[i].free(ctx->transactionals[i].data); // Splice script data into appropriate part of page - if (ctx->returning_blob || ctx->script_header[0] == 0) - ; - else if (buf_used(&ctx->script) == 0) { + if (ctx->returning_blob || ctx->script_header[0] == 0) { + char *start = strstr(ctx->page.start, "<sc>"); + if (start) { + memmove(start, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 4); + ctx->page.front -= 4; + } + } else if (buf_used(&ctx->script) == 0) { size_t len = strlen(ctx->script_header); char *start = strstr(ctx->page.start, "<sc>"); if (start) {