comparison src/c/urweb.c @ 1023:e46227efcbba

Bidding interface
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 10:20:20 -0500
parents 16f7cb0891b6
children 7facf72aaf0a
comparison
equal deleted inserted replaced
1022:4de35df3d545 1023:e46227efcbba
1666 1666
1667 uw_Basis_time uw_Basis_unurlifyTime(uw_context ctx, char **s) { 1667 uw_Basis_time uw_Basis_unurlifyTime(uw_context ctx, char **s) {
1668 return uw_Basis_unurlifyInt(ctx, s); 1668 return uw_Basis_unurlifyInt(ctx, s);
1669 } 1669 }
1670 1670
1671 static uw_Basis_string uw_unurlifyString_to(uw_context ctx, char *r, char *s) { 1671 static uw_Basis_string uw_unurlifyString_to(int fromClient, uw_context ctx, char *r, char *s) {
1672 char *s1, *s2 = s; 1672 char *s1, *s2 = s;
1673 int n; 1673 int n;
1674 1674
1675 if (*s2 == '_') 1675 if (!fromClient) {
1676 ++s2; 1676 if (*s2 == '_')
1677 else if (s2[0] == '%' && s2[1] == '5' && (s2[2] == 'f' || s2[2] == 'F')) 1677 ++s2;
1678 s2 += 3; 1678 else if (s2[0] == '%' && s2[1] == '5' && (s2[2] == 'f' || s2[2] == 'F'))
1679 s2 += 3;
1680 }
1679 1681
1680 for (s1 = r; *s2; ++s1, ++s2) { 1682 for (s1 = r; *s2; ++s1, ++s2) {
1681 char c = *s2; 1683 char c = *s2;
1682 1684
1683 switch (c) { 1685 switch (c) {
1722 1724
1723 len = strlen(*s); 1725 len = strlen(*s);
1724 uw_check_heap(ctx, len + 1); 1726 uw_check_heap(ctx, len + 1);
1725 1727
1726 r = ctx->heap.front; 1728 r = ctx->heap.front;
1727 ctx->heap.front = uw_unurlifyString_to(ctx, ctx->heap.front, *s); 1729 ctx->heap.front = uw_unurlifyString_to(0, ctx, ctx->heap.front, *s);
1730 *s = new_s;
1731 return r;
1732 }
1733
1734 uw_Basis_string uw_Basis_unurlifyString_fromClient(uw_context ctx, char **s) {
1735 char *new_s = uw_unurlify_advance(*s);
1736 char *r, *s1, *s2;
1737 int len, n;
1738
1739 len = strlen(*s);
1740 uw_check_heap(ctx, len + 1);
1741
1742 r = ctx->heap.front;
1743 ctx->heap.front = uw_unurlifyString_to(1, ctx, ctx->heap.front, *s);
1728 *s = new_s; 1744 *s = new_s;
1729 return r; 1745 return r;
1730 } 1746 }
1731 1747
1732 1748
1959 memcpy(r, s+start, len); 1975 memcpy(r, s+start, len);
1960 r[len] = 0; 1976 r[len] = 0;
1961 return r; 1977 return r;
1962 } 1978 }
1963 1979
1980 }
1981
1982 uw_Basis_string uw_Basis_str1(uw_context ctx, uw_Basis_char ch) {
1983 char *r;
1984
1985 uw_check_heap(ctx, 2);
1986 r = ctx->heap.front;
1987 r[0] = ch;
1988 r[1] = 0;
1989
1990 ctx->heap.front += 2;
1991
1992 return r;
1964 } 1993 }
1965 1994
1966 uw_Basis_string uw_strdup(uw_context ctx, uw_Basis_string s1) { 1995 uw_Basis_string uw_strdup(uw_context ctx, uw_Basis_string s1) {
1967 int len = uw_Basis_strlen(ctx, s1) + 1; 1996 int len = uw_Basis_strlen(ctx, s1) + 1;
1968 char *s; 1997 char *s;