test/v2-regression/ctest.html

Fri, 26 Aug 2016 14:15:29 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 26 Aug 2016 14:15:29 +0200
changeset 53
5e47a26a16f0
parent 41
c06ab07fd29d
permissions
-rw-r--r--

adds appendfile() function to main module + adds TODOs for source files which do not terminate with a blank line

41
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 <!DOCTYPE html>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 <html>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 <head>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 <title>c2html</title>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 <style type="text/css">
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 span.c2html-lineno a {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 font-style: italic;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 text-decoration: none;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 color: grey;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 span.c2html-keyword {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 color: blue;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 span.c2html-macroconst {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 color: cornflowerblue;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 span.c2html-type {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 color: cornflowerblue;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 span.c2html-directive {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 color: green;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 span.c2html-string {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 color: darkorange;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 span.c2html-comment {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 color: grey;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 span.c2html-stdinclude {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 color: darkorange;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 span.c2html-userinclude {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 color: darkorange;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 a.c2html-userinclude {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 color: darkorange;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 text-decoration: underline;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 </style>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 </head>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 <body>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 <pre>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 <span class="c2html-lineno"><a name="l1" href="#l1"> 1 </a></span> <span class="c2html-comment">/*</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 <span class="c2html-lineno"><a name="l2" href="#l2"> 2 </a></span> <span class="c2html-comment"> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 <span class="c2html-lineno"><a name="l3" href="#l3"> 3 </a></span> <span class="c2html-comment"> *</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 <span class="c2html-lineno"><a name="l4" href="#l4"> 4 </a></span> <span class="c2html-comment"> * Copyright 2015 Olaf Wintermann. All rights reserved.</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 <span class="c2html-lineno"><a name="l5" href="#l5"> 5 </a></span> <span class="c2html-comment"> *</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 <span class="c2html-lineno"><a name="l6" href="#l6"> 6 </a></span> <span class="c2html-comment"> * Redistribution and use in source and binary forms, with or without</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 <span class="c2html-lineno"><a name="l7" href="#l7"> 7 </a></span> <span class="c2html-comment"> * modification, are permitted provided that the following conditions are met:</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 <span class="c2html-lineno"><a name="l8" href="#l8"> 8 </a></span> <span class="c2html-comment"> *</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 <span class="c2html-lineno"><a name="l9" href="#l9"> 9 </a></span> <span class="c2html-comment"> * 1. Redistributions of source code must retain the above copyright</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 <span class="c2html-lineno"><a name="l10" href="#l10"> 10 </a></span> <span class="c2html-comment"> * notice, this list of conditions and the following disclaimer.</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 <span class="c2html-lineno"><a name="l11" href="#l11"> 11 </a></span> <span class="c2html-comment"> *</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 <span class="c2html-lineno"><a name="l12" href="#l12"> 12 </a></span> <span class="c2html-comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 <span class="c2html-lineno"><a name="l13" href="#l13"> 13 </a></span> <span class="c2html-comment"> * notice, this list of conditions and the following disclaimer in the</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 <span class="c2html-lineno"><a name="l14" href="#l14"> 14 </a></span> <span class="c2html-comment"> * documentation and/or other materials provided with the distribution.</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 <span class="c2html-lineno"><a name="l15" href="#l15"> 15 </a></span> <span class="c2html-comment"> *</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 <span class="c2html-lineno"><a name="l16" href="#l16"> 16 </a></span> <span class="c2html-comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 <span class="c2html-lineno"><a name="l17" href="#l17"> 17 </a></span> <span class="c2html-comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 <span class="c2html-lineno"><a name="l18" href="#l18"> 18 </a></span> <span class="c2html-comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 <span class="c2html-lineno"><a name="l19" href="#l19"> 19 </a></span> <span class="c2html-comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 <span class="c2html-lineno"><a name="l20" href="#l20"> 20 </a></span> <span class="c2html-comment"> * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 <span class="c2html-lineno"><a name="l21" href="#l21"> 21 </a></span> <span class="c2html-comment"> * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 <span class="c2html-lineno"><a name="l22" href="#l22"> 22 </a></span> <span class="c2html-comment"> * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 <span class="c2html-lineno"><a name="l23" href="#l23"> 23 </a></span> <span class="c2html-comment"> * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 <span class="c2html-lineno"><a name="l24" href="#l24"> 24 </a></span> <span class="c2html-comment"> * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 <span class="c2html-lineno"><a name="l25" href="#l25"> 25 </a></span> <span class="c2html-comment"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69 <span class="c2html-lineno"><a name="l26" href="#l26"> 26 </a></span> <span class="c2html-comment"> * POSSIBILITY OF SUCH DAMAGE.</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 <span class="c2html-lineno"><a name="l27" href="#l27"> 27 </a></span> <span class="c2html-comment"> */</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 <span class="c2html-lineno"><a name="l28" href="#l28"> 28 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 <span class="c2html-lineno"><a name="l29" href="#l29"> 29 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;time.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 <span class="c2html-lineno"><a name="l30" href="#l30"> 30 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;stdio.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 <span class="c2html-lineno"><a name="l31" href="#l31"> 31 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;stdlib.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 <span class="c2html-lineno"><a name="l32" href="#l32"> 32 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;string.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 <span class="c2html-lineno"><a name="l33" href="#l33"> 33 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;ucx/string.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 <span class="c2html-lineno"><a name="l34" href="#l34"> 34 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;ucx/buffer.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 <span class="c2html-lineno"><a name="l35" href="#l35"> 35 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;ucx/utils.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 <span class="c2html-lineno"><a name="l36" href="#l36"> 36 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;libxml/tree.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 <span class="c2html-lineno"><a name="l37" href="#l37"> 37 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;curl/curl.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 <span class="c2html-lineno"><a name="l38" href="#l38"> 38 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 <span class="c2html-lineno"><a name="l39" href="#l39"> 39 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/sha.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 <span class="c2html-lineno"><a name="l40" href="#l40"> 40 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/hmac.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 <span class="c2html-lineno"><a name="l41" href="#l41"> 41 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/evp.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 <span class="c2html-lineno"><a name="l42" href="#l42"> 42 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/bio.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 <span class="c2html-lineno"><a name="l43" href="#l43"> 43 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/buffer.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 <span class="c2html-lineno"><a name="l44" href="#l44"> 44 </a></span> <span class="c2html-directive">#include</span> <span class="c2html-stdinclude">&lt;openssl/rand.h&gt;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88 <span class="c2html-lineno"><a name="l45" href="#l45"> 45 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
89 <span class="c2html-lineno"><a name="l46" href="#l46"> 46 </a></span> <span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="utils.h">"utils.h"</a>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 <span class="c2html-lineno"><a name="l47" href="#l47"> 47 </a></span> <span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="crypto.h">"crypto.h"</a>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91 <span class="c2html-lineno"><a name="l48" href="#l48"> 48 </a></span> <span class="c2html-directive">#include</span> <a class="c2html-userinclude" href="webdav.h">"webdav.h"</a>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
92 <span class="c2html-lineno"><a name="l49" href="#l49"> 49 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
93 <span class="c2html-lineno"><a name="l50" href="#l50"> 50 </a></span> <span class="c2html-directive">#define</span> <span class="c2html-macroconst">MACRO1337</span> <span class="c2html-macroconst">1337L</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
94 <span class="c2html-lineno"><a name="l51" href="#l51"> 51 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95 <span class="c2html-lineno"><a name="l52" href="#l52"> 52 </a></span> <span class="c2html-comment">/* -------------------- This is a testing file. -------------------------- */</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
96 <span class="c2html-lineno"><a name="l53" href="#l53"> 53 </a></span> <span class="c2html-comment">/*</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97 <span class="c2html-lineno"><a name="l54" href="#l54"> 54 </a></span> <span class="c2html-comment">time_t util_parse_creationdate(char *str) {</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
98 <span class="c2html-lineno"><a name="l55" href="#l55"> 55 </a></span> <span class="c2html-comment"> // example: 2012-11-29T21:35:35Z</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 <span class="c2html-lineno"><a name="l56" href="#l56"> 56 </a></span> <span class="c2html-comment"> if(!str) {</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100 <span class="c2html-lineno"><a name="l57" href="#l57"> 57 </a></span> <span class="c2html-comment"> return 0;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 <span class="c2html-lineno"><a name="l58" href="#l58"> 58 </a></span> <span class="c2html-comment"> }</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102 <span class="c2html-lineno"><a name="l59" href="#l59"> 59 </a></span> <span class="c2html-comment"> // TODO</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
103 <span class="c2html-lineno"><a name="l60" href="#l60"> 60 </a></span> <span class="c2html-comment"> return 0;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 <span class="c2html-lineno"><a name="l61" href="#l61"> 61 </a></span> <span class="c2html-comment">}</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
105 <span class="c2html-lineno"><a name="l62" href="#l62"> 62 </a></span> <span class="c2html-comment">*/</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106 <span class="c2html-lineno"><a name="l63" href="#l63"> 63 </a></span> <span class="c2html-type">time_t</span> util_parse_lastmodified(<span class="c2html-keyword">char</span> *str) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107 <span class="c2html-lineno"><a name="l64" href="#l64"> 64 </a></span> <span class="c2html-comment">// example: Thu, 29 Nov 2012 21:35:35 GMT</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 <span class="c2html-lineno"><a name="l65" href="#l65"> 65 </a></span> <span class="c2html-keyword">if</span>(!str) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
109 <span class="c2html-lineno"><a name="l66" href="#l66"> 66 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
110 <span class="c2html-lineno"><a name="l67" href="#l67"> 67 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111 <span class="c2html-lineno"><a name="l68" href="#l68"> 68 </a></span> <span class="c2html-keyword">return</span> curl_getdate(str, <span class="c2html-macroconst">NULL</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 <span class="c2html-lineno"><a name="l69" href="#l69"> 69 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
113 <span class="c2html-lineno"><a name="l70" href="#l70"> 70 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
114 <span class="c2html-lineno"><a name="l71" href="#l71"> 71 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
115 <span class="c2html-lineno"><a name="l72" href="#l72"> 72 </a></span> <span class="c2html-keyword">int</span> util_getboolean(<span class="c2html-keyword">char</span> *v) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 <span class="c2html-lineno"><a name="l73" href="#l73"> 73 </a></span> <span class="c2html-keyword">if</span>(v[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'T'</span> || v[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'t'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117 <span class="c2html-lineno"><a name="l74" href="#l74"> 74 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
118 <span class="c2html-lineno"><a name="l75" href="#l75"> 75 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 <span class="c2html-lineno"><a name="l76" href="#l76"> 76 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
120 <span class="c2html-lineno"><a name="l77" href="#l77"> 77 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 <span class="c2html-lineno"><a name="l78" href="#l78"> 78 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 <span class="c2html-lineno"><a name="l79" href="#l79"> 79 </a></span> <span class="c2html-keyword">int</span> util_strtoint(<span class="c2html-keyword">char</span> *str, <span class="c2html-type">int64_t</span> *value) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
123 <span class="c2html-lineno"><a name="l80" href="#l80"> 80 </a></span> <span class="c2html-keyword">char</span> *end;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124 <span class="c2html-lineno"><a name="l81" href="#l81"> 81 </a></span> <span class="c2html-type">int64_t</span> val = strtoll(str, &end, <span class="c2html-macroconst">0</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 <span class="c2html-lineno"><a name="l82" href="#l82"> 82 </a></span> <span class="c2html-keyword">if</span>(strlen(end) == <span class="c2html-macroconst">0</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 <span class="c2html-lineno"><a name="l83" href="#l83"> 83 </a></span> *value = val;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 <span class="c2html-lineno"><a name="l84" href="#l84"> 84 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
128 <span class="c2html-lineno"><a name="l85" href="#l85"> 85 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 <span class="c2html-lineno"><a name="l86" href="#l86"> 86 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
130 <span class="c2html-lineno"><a name="l87" href="#l87"> 87 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131 <span class="c2html-lineno"><a name="l88" href="#l88"> 88 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
132 <span class="c2html-lineno"><a name="l89" href="#l89"> 89 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 <span class="c2html-lineno"><a name="l90" href="#l90"> 90 </a></span> <span class="c2html-keyword">char</span>* util_url_path(<span class="c2html-keyword">char</span> *url) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134 <span class="c2html-lineno"><a name="l91" href="#l91"> 91 </a></span> <span class="c2html-keyword">char</span> *path = <span class="c2html-macroconst">NULL</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 <span class="c2html-lineno"><a name="l92" href="#l92"> 92 </a></span> <span class="c2html-type">size_t</span> len = strlen(url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136 <span class="c2html-lineno"><a name="l93" href="#l93"> 93 </a></span> <span class="c2html-keyword">int</span> slashcount = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
137 <span class="c2html-lineno"><a name="l94" href="#l94"> 94 </a></span> <span class="c2html-keyword">int</span> slmax;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 <span class="c2html-lineno"><a name="l95" href="#l95"> 95 </a></span> <span class="c2html-keyword">if</span>(len &gt; <span class="c2html-macroconst">7</span> && !strncasecmp(url, <span class="c2html-string">"http://"</span>, <span class="c2html-macroconst">7</span>)) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
139 <span class="c2html-lineno"><a name="l96" href="#l96"> 96 </a></span> slmax = <span class="c2html-macroconst">3</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140 <span class="c2html-lineno"><a name="l97" href="#l97"> 97 </a></span> } <span class="c2html-keyword">else</span> <span class="c2html-keyword">if</span>(len &gt; <span class="c2html-macroconst">8</span> && !strncasecmp(url, <span class="c2html-string">"https://"</span>, <span class="c2html-macroconst">8</span>)) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 <span class="c2html-lineno"><a name="l98" href="#l98"> 98 </a></span> slmax = <span class="c2html-macroconst">3</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
142 <span class="c2html-lineno"><a name="l99" href="#l99"> 99 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
143 <span class="c2html-lineno"><a name="l100" href="#l100">100 </a></span> slmax = <span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
144 <span class="c2html-lineno"><a name="l101" href="#l101">101 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
145 <span class="c2html-lineno"><a name="l102" href="#l102">102 </a></span> <span class="c2html-keyword">char</span> c;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
146 <span class="c2html-lineno"><a name="l103" href="#l103">103 </a></span> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i&lt;len;i++) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
147 <span class="c2html-lineno"><a name="l104" href="#l104">104 </a></span> c = url[i];
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148 <span class="c2html-lineno"><a name="l105" href="#l105">105 </a></span> <span class="c2html-keyword">if</span>(c == <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 <span class="c2html-lineno"><a name="l106" href="#l106">106 </a></span> slashcount++;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
150 <span class="c2html-lineno"><a name="l107" href="#l107">107 </a></span> <span class="c2html-keyword">if</span>(slashcount == slmax) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
151 <span class="c2html-lineno"><a name="l108" href="#l108">108 </a></span> path = url + i;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
152 <span class="c2html-lineno"><a name="l109" href="#l109">109 </a></span> <span class="c2html-keyword">break</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 <span class="c2html-lineno"><a name="l110" href="#l110">110 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
154 <span class="c2html-lineno"><a name="l111" href="#l111">111 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
155 <span class="c2html-lineno"><a name="l112" href="#l112">112 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
156 <span class="c2html-lineno"><a name="l113" href="#l113">113 </a></span> <span class="c2html-keyword">return</span> path;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
157 <span class="c2html-lineno"><a name="l114" href="#l114">114 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 <span class="c2html-lineno"><a name="l115" href="#l115">115 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
159 <span class="c2html-lineno"><a name="l116" href="#l116">116 </a></span> <span class="c2html-keyword">char</span>* util_url_decode(DavSession *sn, <span class="c2html-keyword">char</span> *url) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
160 <span class="c2html-lineno"><a name="l117" href="#l117">117 </a></span> <span class="c2html-keyword">char</span> *unesc = curl_easy_unescape(sn-&gt;handle, url, strlen(url), <span class="c2html-macroconst">NULL</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161 <span class="c2html-lineno"><a name="l118" href="#l118">118 </a></span> <span class="c2html-keyword">char</span> *ret = strdup(unesc);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162 <span class="c2html-lineno"><a name="l119" href="#l119">119 </a></span> curl_free(unesc);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
163 <span class="c2html-lineno"><a name="l120" href="#l120">120 </a></span> <span class="c2html-keyword">return</span> ret;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
164 <span class="c2html-lineno"><a name="l121" href="#l121">121 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
165 <span class="c2html-lineno"><a name="l122" href="#l122">122 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
166 <span class="c2html-lineno"><a name="l123" href="#l123">123 </a></span> <span class="c2html-keyword">char</span>* util_resource_name(<span class="c2html-keyword">char</span> *url) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
167 <span class="c2html-lineno"><a name="l124" href="#l124">124 </a></span> <span class="c2html-keyword">int</span> si = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
168 <span class="c2html-lineno"><a name="l125" href="#l125">125 </a></span> <span class="c2html-keyword">int</span> osi = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
169 <span class="c2html-lineno"><a name="l126" href="#l126">126 </a></span> <span class="c2html-keyword">int</span> i = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 <span class="c2html-lineno"><a name="l127" href="#l127">127 </a></span> <span class="c2html-keyword">int</span> p = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
171 <span class="c2html-lineno"><a name="l128" href="#l128">128 </a></span> <span class="c2html-keyword">char</span> c;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
172 <span class="c2html-lineno"><a name="l129" href="#l129">129 </a></span> <span class="c2html-keyword">while</span>((c = url[i]) != <span class="c2html-macroconst">0</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
173 <span class="c2html-lineno"><a name="l130" href="#l130">130 </a></span> <span class="c2html-keyword">if</span>(c == <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
174 <span class="c2html-lineno"><a name="l131" href="#l131">131 </a></span> osi = si;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 <span class="c2html-lineno"><a name="l132" href="#l132">132 </a></span> si = i;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 <span class="c2html-lineno"><a name="l133" href="#l133">133 </a></span> p = <span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
177 <span class="c2html-lineno"><a name="l134" href="#l134">134 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
178 <span class="c2html-lineno"><a name="l135" href="#l135">135 </a></span> i++;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
179 <span class="c2html-lineno"><a name="l136" href="#l136">136 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180 <span class="c2html-lineno"><a name="l137" href="#l137">137 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181 <span class="c2html-lineno"><a name="l138" href="#l138">138 </a></span> <span class="c2html-keyword">char</span> *name = url + si + p;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
182 <span class="c2html-lineno"><a name="l139" href="#l139">139 </a></span> <span class="c2html-keyword">if</span>(name[<span class="c2html-macroconst">0</span>] == <span class="c2html-macroconst">0</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
183 <span class="c2html-lineno"><a name="l140" href="#l140">140 </a></span> name = url + osi + p;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
184 <span class="c2html-lineno"><a name="l141" href="#l141">141 </a></span> <span class="c2html-keyword">if</span>(name[<span class="c2html-macroconst">0</span>] == <span class="c2html-macroconst">0</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185 <span class="c2html-lineno"><a name="l142" href="#l142">142 </a></span> <span class="c2html-keyword">return</span> url;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
186 <span class="c2html-lineno"><a name="l143" href="#l143">143 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
187 <span class="c2html-lineno"><a name="l144" href="#l144">144 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
188 <span class="c2html-lineno"><a name="l145" href="#l145">145 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
189 <span class="c2html-lineno"><a name="l146" href="#l146">146 </a></span> <span class="c2html-keyword">return</span> name;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
190 <span class="c2html-lineno"><a name="l147" href="#l147">147 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
191 <span class="c2html-lineno"><a name="l148" href="#l148">148 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
192 <span class="c2html-lineno"><a name="l149" href="#l149">149 </a></span> <span class="c2html-keyword">int</span> util_mkdir(<span class="c2html-keyword">char</span> *path, <span class="c2html-type">mode_t</span> mode) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
193 <span class="c2html-lineno"><a name="l150" href="#l150">150 </a></span> <span class="c2html-directive">#ifdef</span> <span class="c2html-macroconst">_WIN32</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
194 <span class="c2html-lineno"><a name="l151" href="#l151">151 </a></span> <span class="c2html-keyword">return</span> mkdir(path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
195 <span class="c2html-lineno"><a name="l152" href="#l152">152 </a></span> <span class="c2html-directive">#else</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
196 <span class="c2html-lineno"><a name="l153" href="#l153">153 </a></span> <span class="c2html-keyword">return</span> mkdir(path, mode);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
197 <span class="c2html-lineno"><a name="l154" href="#l154">154 </a></span> <span class="c2html-directive">#endif</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
198 <span class="c2html-lineno"><a name="l155" href="#l155">155 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
199 <span class="c2html-lineno"><a name="l156" href="#l156">156 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
200 <span class="c2html-lineno"><a name="l157" href="#l157">157 </a></span> <span class="c2html-keyword">char</span>* util_concat_path(<span class="c2html-keyword">char</span> *url_base, <span class="c2html-keyword">char</span> *p) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
201 <span class="c2html-lineno"><a name="l158" href="#l158">158 </a></span> <span class="c2html-type">sstr_t</span> base = sstr(url_base);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
202 <span class="c2html-lineno"><a name="l159" href="#l159">159 </a></span> <span class="c2html-type">sstr_t</span> path;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
203 <span class="c2html-lineno"><a name="l160" href="#l160">160 </a></span> <span class="c2html-keyword">if</span>(p) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
204 <span class="c2html-lineno"><a name="l161" href="#l161">161 </a></span> path = sstr(p);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
205 <span class="c2html-lineno"><a name="l162" href="#l162">162 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
206 <span class="c2html-lineno"><a name="l163" href="#l163">163 </a></span> path = sstrn(<span class="c2html-string">""</span>, <span class="c2html-macroconst">0</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
207 <span class="c2html-lineno"><a name="l164" href="#l164">164 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
208 <span class="c2html-lineno"><a name="l165" href="#l165">165 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
209 <span class="c2html-lineno"><a name="l166" href="#l166">166 </a></span> <span class="c2html-keyword">int</span> add_separator = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
210 <span class="c2html-lineno"><a name="l167" href="#l167">167 </a></span> <span class="c2html-keyword">if</span>(base.ptr[base.length-<span class="c2html-macroconst">1</span>] == <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
211 <span class="c2html-lineno"><a name="l168" href="#l168">168 </a></span> <span class="c2html-keyword">if</span>(path.ptr[<span class="c2html-macroconst">0</span>] == <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
212 <span class="c2html-lineno"><a name="l169" href="#l169">169 </a></span> base.length--;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
213 <span class="c2html-lineno"><a name="l170" href="#l170">170 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
214 <span class="c2html-lineno"><a name="l171" href="#l171">171 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
215 <span class="c2html-lineno"><a name="l172" href="#l172">172 </a></span> <span class="c2html-keyword">if</span>(path.length == <span class="c2html-macroconst">0</span> || path.ptr[<span class="c2html-macroconst">0</span>] != <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 <span class="c2html-lineno"><a name="l173" href="#l173">173 </a></span> add_separator = <span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
217 <span class="c2html-lineno"><a name="l174" href="#l174">174 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
218 <span class="c2html-lineno"><a name="l175" href="#l175">175 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
219 <span class="c2html-lineno"><a name="l176" href="#l176">176 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
220 <span class="c2html-lineno"><a name="l177" href="#l177">177 </a></span> <span class="c2html-type">sstr_t</span> url;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
221 <span class="c2html-lineno"><a name="l178" href="#l178">178 </a></span> <span class="c2html-keyword">if</span>(add_separator) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
222 <span class="c2html-lineno"><a name="l179" href="#l179">179 </a></span> url = sstrcat(<span class="c2html-macroconst">3</span>, base, sstr(<span class="c2html-string">"/"</span>), path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
223 <span class="c2html-lineno"><a name="l180" href="#l180">180 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
224 <span class="c2html-lineno"><a name="l181" href="#l181">181 </a></span> url = sstrcat(<span class="c2html-macroconst">2</span>, base, path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
225 <span class="c2html-lineno"><a name="l182" href="#l182">182 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
226 <span class="c2html-lineno"><a name="l183" href="#l183">183 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
227 <span class="c2html-lineno"><a name="l184" href="#l184">184 </a></span> <span class="c2html-keyword">return</span> url.ptr;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
228 <span class="c2html-lineno"><a name="l185" href="#l185">185 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
229 <span class="c2html-lineno"><a name="l186" href="#l186">186 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
230 <span class="c2html-lineno"><a name="l187" href="#l187">187 </a></span> <span class="c2html-keyword">void</span> util_set_url(DavSession *sn, <span class="c2html-keyword">char</span> *href) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
231 <span class="c2html-lineno"><a name="l188" href="#l188">188 </a></span> <span class="c2html-type">sstr_t</span> base = sstr(sn-&gt;base_url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
232 <span class="c2html-lineno"><a name="l189" href="#l189">189 </a></span> <span class="c2html-type">sstr_t</span> href_str = sstr(href);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
233 <span class="c2html-lineno"><a name="l190" href="#l190">190 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
234 <span class="c2html-lineno"><a name="l191" href="#l191">191 </a></span> <span class="c2html-keyword">char</span> *base_path = util_url_path(sn-&gt;base_url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
235 <span class="c2html-lineno"><a name="l192" href="#l192">192 </a></span> base.length -= strlen(base_path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
236 <span class="c2html-lineno"><a name="l193" href="#l193">193 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
237 <span class="c2html-lineno"><a name="l194" href="#l194">194 </a></span> <span class="c2html-type">sstr_t</span> url = sstrcat(<span class="c2html-macroconst">2</span>, base, href_str);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
238 <span class="c2html-lineno"><a name="l195" href="#l195">195 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
239 <span class="c2html-lineno"><a name="l196" href="#l196">196 </a></span> curl_easy_setopt(sn-&gt;handle, <span class="c2html-macroconst">CURLOPT_URL</span>, url.ptr);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
240 <span class="c2html-lineno"><a name="l197" href="#l197">197 </a></span> free(url.ptr);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
241 <span class="c2html-lineno"><a name="l198" href="#l198">198 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
242 <span class="c2html-lineno"><a name="l199" href="#l199">199 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
243 <span class="c2html-lineno"><a name="l200" href="#l200">200 </a></span> <span class="c2html-keyword">char</span>* util_path_to_url(DavSession *sn, <span class="c2html-keyword">char</span> *path) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
244 <span class="c2html-lineno"><a name="l201" href="#l201">201 </a></span> <span class="c2html-keyword">char</span> *space = malloc(<span class="c2html-macroconst">256</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
245 <span class="c2html-lineno"><a name="l202" href="#l202">202 </a></span> UcxBuffer *url = ucx_buffer_new(space, <span class="c2html-macroconst">256</span>, <span class="c2html-macroconst">UCX_BUFFER_AUTOEXTEND</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
246 <span class="c2html-lineno"><a name="l203" href="#l203">203 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
247 <span class="c2html-lineno"><a name="l204" href="#l204">204 </a></span> <span class="c2html-comment">// add base url</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
248 <span class="c2html-lineno"><a name="l205" href="#l205">205 </a></span> ucx_buffer_write(sn-&gt;base_url, <span class="c2html-macroconst">1</span>, strlen(sn-&gt;base_url), url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
249 <span class="c2html-lineno"><a name="l206" href="#l206">206 </a></span> <span class="c2html-comment">// remove trailing slash</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
250 <span class="c2html-lineno"><a name="l207" href="#l207">207 </a></span> ucx_buffer_seek(url, -<span class="c2html-macroconst">1</span>, <span class="c2html-macroconst">SEEK_CUR</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
251 <span class="c2html-lineno"><a name="l208" href="#l208">208 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
252 <span class="c2html-lineno"><a name="l209" href="#l209">209 </a></span> <span class="c2html-type">sstr_t</span> p = sstr(path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
253 <span class="c2html-lineno"><a name="l210" href="#l210">210 </a></span> <span class="c2html-type">ssize_t</span> ntk = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
254 <span class="c2html-lineno"><a name="l211" href="#l211">211 </a></span> <span class="c2html-type">sstr_t</span> *tks = sstrsplit(p, <span class="c2html-macroconst">S</span>(<span class="c2html-string">"/"</span>), &ntk);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
255 <span class="c2html-lineno"><a name="l212" href="#l212">212 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
256 <span class="c2html-lineno"><a name="l213" href="#l213">213 </a></span> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i&lt;ntk;i++) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
257 <span class="c2html-lineno"><a name="l214" href="#l214">214 </a></span> <span class="c2html-type">sstr_t</span> node = tks[i];
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
258 <span class="c2html-lineno"><a name="l215" href="#l215">215 </a></span> <span class="c2html-keyword">if</span>(node.length &gt; <span class="c2html-macroconst">0</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
259 <span class="c2html-lineno"><a name="l216" href="#l216">216 </a></span> <span class="c2html-keyword">char</span> *esc = curl_easy_escape(sn-&gt;handle, node.ptr, node.length);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
260 <span class="c2html-lineno"><a name="l217" href="#l217">217 </a></span> ucx_buffer_putc(url, <span class="c2html-string">'/'</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
261 <span class="c2html-lineno"><a name="l218" href="#l218">218 </a></span> ucx_buffer_write(esc, <span class="c2html-macroconst">1</span>, strlen(esc), url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
262 <span class="c2html-lineno"><a name="l219" href="#l219">219 </a></span> curl_free(esc);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
263 <span class="c2html-lineno"><a name="l220" href="#l220">220 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
264 <span class="c2html-lineno"><a name="l221" href="#l221">221 </a></span> free(node.ptr);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
265 <span class="c2html-lineno"><a name="l222" href="#l222">222 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
266 <span class="c2html-lineno"><a name="l223" href="#l223">223 </a></span> free(tks);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
267 <span class="c2html-lineno"><a name="l224" href="#l224">224 </a></span> <span class="c2html-keyword">if</span>(path[p.length-<span class="c2html-macroconst">1</span>] == <span class="c2html-string">'/'</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
268 <span class="c2html-lineno"><a name="l225" href="#l225">225 </a></span> ucx_buffer_putc(url, <span class="c2html-string">'/'</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
269 <span class="c2html-lineno"><a name="l226" href="#l226">226 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
270 <span class="c2html-lineno"><a name="l227" href="#l227">227 </a></span> ucx_buffer_putc(url, <span class="c2html-macroconst">0</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
271 <span class="c2html-lineno"><a name="l228" href="#l228">228 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
272 <span class="c2html-lineno"><a name="l229" href="#l229">229 </a></span> space = url-&gt;space;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
273 <span class="c2html-lineno"><a name="l230" href="#l230">230 </a></span> ucx_buffer_free(url);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
274 <span class="c2html-lineno"><a name="l231" href="#l231">231 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
275 <span class="c2html-lineno"><a name="l232" href="#l232">232 </a></span> <span class="c2html-keyword">return</span> space;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
276 <span class="c2html-lineno"><a name="l233" href="#l233">233 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
277 <span class="c2html-lineno"><a name="l234" href="#l234">234 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
278 <span class="c2html-lineno"><a name="l235" href="#l235">235 </a></span> <span class="c2html-keyword">char</span>* util_parent_path(<span class="c2html-keyword">char</span> *path) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
279 <span class="c2html-lineno"><a name="l236" href="#l236">236 </a></span> <span class="c2html-keyword">char</span> *name = util_resource_name(path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
280 <span class="c2html-lineno"><a name="l237" href="#l237">237 </a></span> <span class="c2html-type">size_t</span> namelen = strlen(name);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
281 <span class="c2html-lineno"><a name="l238" href="#l238">238 </a></span> <span class="c2html-type">size_t</span> pathlen = strlen(path);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
282 <span class="c2html-lineno"><a name="l239" href="#l239">239 </a></span> <span class="c2html-type">size_t</span> parentlen = pathlen - namelen;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
283 <span class="c2html-lineno"><a name="l240" href="#l240">240 </a></span> <span class="c2html-keyword">char</span> *parent = malloc(parentlen + <span class="c2html-macroconst">1</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
284 <span class="c2html-lineno"><a name="l241" href="#l241">241 </a></span> memcpy(parent, path, parentlen);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
285 <span class="c2html-lineno"><a name="l242" href="#l242">242 </a></span> parent[parentlen] = <span class="c2html-string">'\0'</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
286 <span class="c2html-lineno"><a name="l243" href="#l243">243 </a></span> <span class="c2html-keyword">return</span> parent;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
287 <span class="c2html-lineno"><a name="l244" href="#l244">244 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
288 <span class="c2html-lineno"><a name="l245" href="#l245">245 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
289 <span class="c2html-lineno"><a name="l246" href="#l246">246 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
290 <span class="c2html-lineno"><a name="l247" href="#l247">247 </a></span> <span class="c2html-keyword">char</span>* util_xml_get_text(xmlNode *elm) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
291 <span class="c2html-lineno"><a name="l248" href="#l248">248 </a></span> xmlNode *node = elm-&gt;children;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
292 <span class="c2html-lineno"><a name="l249" href="#l249">249 </a></span> <span class="c2html-keyword">while</span>(node) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
293 <span class="c2html-lineno"><a name="l250" href="#l250">250 </a></span> <span class="c2html-keyword">if</span>(node-&gt;type == <span class="c2html-macroconst">XML_TEXT_NODE</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
294 <span class="c2html-lineno"><a name="l251" href="#l251">251 </a></span> <span class="c2html-keyword">return</span> (<span class="c2html-keyword">char</span>*)node-&gt;content;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
295 <span class="c2html-lineno"><a name="l252" href="#l252">252 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
296 <span class="c2html-lineno"><a name="l253" href="#l253">253 </a></span> node = node-&gt;next;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297 <span class="c2html-lineno"><a name="l254" href="#l254">254 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
298 <span class="c2html-lineno"><a name="l255" href="#l255">255 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">NULL</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
299 <span class="c2html-lineno"><a name="l256" href="#l256">256 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
300 <span class="c2html-lineno"><a name="l257" href="#l257">257 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
301 <span class="c2html-lineno"><a name="l258" href="#l258">258 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
302 <span class="c2html-lineno"><a name="l259" href="#l259">259 </a></span> <span class="c2html-keyword">char</span>* util_base64decode(<span class="c2html-keyword">char</span> *in) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
303 <span class="c2html-lineno"><a name="l260" href="#l260">260 </a></span> <span class="c2html-keyword">int</span> len = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
304 <span class="c2html-lineno"><a name="l261" href="#l261">261 </a></span> <span class="c2html-keyword">return</span> util_base64decode_len(in, &len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
305 <span class="c2html-lineno"><a name="l262" href="#l262">262 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
306 <span class="c2html-lineno"><a name="l263" href="#l263">263 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
307 <span class="c2html-lineno"><a name="l264" href="#l264">264 </a></span> <span class="c2html-keyword">char</span>* util_base64decode_len(<span class="c2html-keyword">char</span>* in, <span class="c2html-keyword">int</span> *outlen) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
308 <span class="c2html-lineno"><a name="l265" href="#l265">265 </a></span> <span class="c2html-type">size_t</span> len = strlen(in);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
309 <span class="c2html-lineno"><a name="l266" href="#l266">266 </a></span> <span class="c2html-keyword">char</span> *out = calloc(<span class="c2html-macroconst">1</span>, len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
310 <span class="c2html-lineno"><a name="l267" href="#l267">267 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
311 <span class="c2html-lineno"><a name="l268" href="#l268">268 </a></span> <span class="c2html-macroconst">BIO</span>* b = BIO_new_mem_buf(in, len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
312 <span class="c2html-lineno"><a name="l269" href="#l269">269 </a></span> <span class="c2html-macroconst">BIO</span> *d = BIO_new(BIO_f_base64());
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
313 <span class="c2html-lineno"><a name="l270" href="#l270">270 </a></span> BIO_set_flags(d, <span class="c2html-macroconst">BIO_FLAGS_BASE64_NO_NL</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
314 <span class="c2html-lineno"><a name="l271" href="#l271">271 </a></span> b = BIO_push(d, b);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
315 <span class="c2html-lineno"><a name="l272" href="#l272">272 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
316 <span class="c2html-lineno"><a name="l273" href="#l273">273 </a></span> *outlen = BIO_read(b, out, len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
317 <span class="c2html-lineno"><a name="l274" href="#l274">274 </a></span> BIO_free_all(b);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
318 <span class="c2html-lineno"><a name="l275" href="#l275">275 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
319 <span class="c2html-lineno"><a name="l276" href="#l276">276 </a></span> <span class="c2html-keyword">return</span> out;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
320 <span class="c2html-lineno"><a name="l277" href="#l277">277 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
321 <span class="c2html-lineno"><a name="l278" href="#l278">278 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
322 <span class="c2html-lineno"><a name="l279" href="#l279">279 </a></span> <span class="c2html-keyword">char</span>* util_base64encode(<span class="c2html-keyword">char</span> *in, <span class="c2html-type">size_t</span> len) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
323 <span class="c2html-lineno"><a name="l280" href="#l280">280 </a></span> <span class="c2html-macroconst">BIO</span> *b;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
324 <span class="c2html-lineno"><a name="l281" href="#l281">281 </a></span> <span class="c2html-macroconst">BIO</span> *e;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
325 <span class="c2html-lineno"><a name="l282" href="#l282">282 </a></span> <span class="c2html-macroconst">BUF_MEM</span> *mem;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
326 <span class="c2html-lineno"><a name="l283" href="#l283">283 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
327 <span class="c2html-lineno"><a name="l284" href="#l284">284 </a></span> e = BIO_new(BIO_f_base64());
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
328 <span class="c2html-lineno"><a name="l285" href="#l285">285 </a></span> b = BIO_new(BIO_s_mem());
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
329 <span class="c2html-lineno"><a name="l286" href="#l286">286 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
330 <span class="c2html-lineno"><a name="l287" href="#l287">287 </a></span> e = BIO_push(e, b);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
331 <span class="c2html-lineno"><a name="l288" href="#l288">288 </a></span> BIO_write(e, in, len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
332 <span class="c2html-lineno"><a name="l289" href="#l289">289 </a></span> BIO_flush(e);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
333 <span class="c2html-lineno"><a name="l290" href="#l290">290 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
334 <span class="c2html-lineno"><a name="l291" href="#l291">291 </a></span> BIO_get_mem_ptr(e, &mem);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
335 <span class="c2html-lineno"><a name="l292" href="#l292">292 </a></span> <span class="c2html-keyword">char</span> *out = malloc(mem-&gt;length);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
336 <span class="c2html-lineno"><a name="l293" href="#l293">293 </a></span> memcpy(out, mem-&gt;data, mem-&gt;length -<span class="c2html-macroconst">1</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
337 <span class="c2html-lineno"><a name="l294" href="#l294">294 </a></span> out[mem-&gt;length - <span class="c2html-macroconst">1</span>] = <span class="c2html-string">'\0'</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
338 <span class="c2html-lineno"><a name="l295" href="#l295">295 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
339 <span class="c2html-lineno"><a name="l296" href="#l296">296 </a></span> BIO_free_all(e);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
340 <span class="c2html-lineno"><a name="l297" href="#l297">297 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
341 <span class="c2html-lineno"><a name="l298" href="#l298">298 </a></span> <span class="c2html-keyword">return</span> out;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
342 <span class="c2html-lineno"><a name="l299" href="#l299">299 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
343 <span class="c2html-lineno"><a name="l300" href="#l300">300 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
344 <span class="c2html-lineno"><a name="l301" href="#l301">301 </a></span> <span class="c2html-keyword">char</span>* util_encrypt_str(DavSession *sn, <span class="c2html-keyword">char</span> *str, <span class="c2html-keyword">char</span> *key) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
345 <span class="c2html-lineno"><a name="l302" href="#l302">302 </a></span> DavKey *k = dav_context_get_key(sn-&gt;context, key);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
346 <span class="c2html-lineno"><a name="l303" href="#l303">303 </a></span> <span class="c2html-keyword">if</span>(!k) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
347 <span class="c2html-lineno"><a name="l304" href="#l304">304 </a></span> <span class="c2html-comment">// TODO: session error</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
348 <span class="c2html-lineno"><a name="l305" href="#l305">305 </a></span> <span class="c2html-keyword">return</span> <span class="c2html-macroconst">NULL</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
349 <span class="c2html-lineno"><a name="l306" href="#l306">306 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
350 <span class="c2html-lineno"><a name="l307" href="#l307">307 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
351 <span class="c2html-lineno"><a name="l308" href="#l308">308 </a></span> <span class="c2html-keyword">char</span> *enc_str = aes_encrypt(str, k);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
352 <span class="c2html-lineno"><a name="l309" href="#l309">309 </a></span> <span class="c2html-keyword">char</span> *ret_str = dav_session_strdup(sn, enc_str);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
353 <span class="c2html-lineno"><a name="l310" href="#l310">310 </a></span> free(enc_str);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
354 <span class="c2html-lineno"><a name="l311" href="#l311">311 </a></span> <span class="c2html-keyword">return</span> ret_str;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
355 <span class="c2html-lineno"><a name="l312" href="#l312">312 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
356 <span class="c2html-lineno"><a name="l313" href="#l313">313 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
357 <span class="c2html-lineno"><a name="l314" href="#l314">314 </a></span> <span class="c2html-comment">/* commented out for testing reasons */</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
358 <span class="c2html-lineno"><a name="l315" href="#l315">315 </a></span> <span class="c2html-comment">/*</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
359 <span class="c2html-lineno"><a name="l316" href="#l316">316 </a></span> <span class="c2html-comment">char* util_decrypt_str(DavSession *sn, char *str, char *key) {</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
360 <span class="c2html-lineno"><a name="l317" href="#l317">317 </a></span> <span class="c2html-comment"> DavKey *k = dav_context_get_key(sn-&gt;context, key);</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
361 <span class="c2html-lineno"><a name="l318" href="#l318">318 </a></span> <span class="c2html-comment"> if(!k) {</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
362 <span class="c2html-lineno"><a name="l319" href="#l319">319 </a></span> <span class="c2html-comment"> // TODO: session error</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
363 <span class="c2html-lineno"><a name="l320" href="#l320">320 </a></span> <span class="c2html-comment"> return NULL;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
364 <span class="c2html-lineno"><a name="l321" href="#l321">321 </a></span> <span class="c2html-comment"> }</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
365 <span class="c2html-lineno"><a name="l322" href="#l322">322 </a></span> <span class="c2html-comment"> </span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
366 <span class="c2html-lineno"><a name="l323" href="#l323">323 </a></span> <span class="c2html-comment"> char *dec_str = aes_decrypt(str, k);</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
367 <span class="c2html-lineno"><a name="l324" href="#l324">324 </a></span> <span class="c2html-comment"> char *ret_str = dav_session_strdup(sn, dec_str);</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
368 <span class="c2html-lineno"><a name="l325" href="#l325">325 </a></span> <span class="c2html-comment"> free(dec_str);</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
369 <span class="c2html-lineno"><a name="l326" href="#l326">326 </a></span> <span class="c2html-comment"> return ret_str;</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
370 <span class="c2html-lineno"><a name="l327" href="#l327">327 </a></span> <span class="c2html-comment">}</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
371 <span class="c2html-lineno"><a name="l328" href="#l328">328 </a></span> <span class="c2html-comment">*/</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
372 <span class="c2html-lineno"><a name="l329" href="#l329">329 </a></span> <span class="c2html-keyword">char</span>* util_random_str() {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
373 <span class="c2html-lineno"><a name="l330" href="#l330">330 </a></span> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span> *str = malloc(<span class="c2html-macroconst">25</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
374 <span class="c2html-lineno"><a name="l331" href="#l331">331 </a></span> str[<span class="c2html-macroconst">24</span>] = <span class="c2html-string">'\0'</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
375 <span class="c2html-lineno"><a name="l332" href="#l332">332 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
376 <span class="c2html-lineno"><a name="l333" href="#l333">333 </a></span> <span class="c2html-type">sstr_t</span> t = <span class="c2html-macroconst">S</span>(
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
377 <span class="c2html-lineno"><a name="l334" href="#l334">334 </a></span> <span class="c2html-string">"01234567890"</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
378 <span class="c2html-lineno"><a name="l335" href="#l335">335 </a></span> <span class="c2html-string">"abcdefghijklmnopqrstuvwxyz"</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
379 <span class="c2html-lineno"><a name="l336" href="#l336">336 </a></span> <span class="c2html-string">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
380 <span class="c2html-lineno"><a name="l337" href="#l337">337 </a></span> <span class="c2html-keyword">const</span> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span> *table = (<span class="c2html-keyword">const</span> <span class="c2html-keyword">unsigned</span> <span class="c2html-keyword">char</span>*)t.ptr;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
381 <span class="c2html-lineno"><a name="l338" href="#l338">338 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
382 <span class="c2html-lineno"><a name="l339" href="#l339">339 </a></span> RAND_pseudo_bytes(str, <span class="c2html-macroconst">24</span>);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
383 <span class="c2html-lineno"><a name="l340" href="#l340">340 </a></span> <span class="c2html-keyword">for</span>(<span class="c2html-keyword">int</span> i=<span class="c2html-macroconst">0</span>;i&lt;<span class="c2html-macroconst">24</span>;i++) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
384 <span class="c2html-lineno"><a name="l341" href="#l341">341 </a></span> <span class="c2html-keyword">int</span> c = str[i] % t.length;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
385 <span class="c2html-lineno"><a name="l342" href="#l342">342 </a></span> str[i] = table[c];
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
386 <span class="c2html-lineno"><a name="l343" href="#l343">343 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
387 <span class="c2html-lineno"><a name="l344" href="#l344">344 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
388 <span class="c2html-lineno"><a name="l345" href="#l345">345 </a></span> <span class="c2html-keyword">return</span> (<span class="c2html-keyword">char</span>*)str;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
389 <span class="c2html-lineno"><a name="l346" href="#l346">346 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
390 <span class="c2html-lineno"><a name="l347" href="#l347">347 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
391 <span class="c2html-lineno"><a name="l348" href="#l348">348 </a></span> <span class="c2html-comment">/*</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
392 <span class="c2html-lineno"><a name="l349" href="#l349">349 </a></span> <span class="c2html-comment"> * gets a substring from 0 to the appearance of the token</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
393 <span class="c2html-lineno"><a name="l350" href="#l350">350 </a></span> <span class="c2html-comment"> * tokens are separated by space</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
394 <span class="c2html-lineno"><a name="l351" href="#l351">351 </a></span> <span class="c2html-comment"> * sets sub to the substring and returns the remaining string</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
395 <span class="c2html-lineno"><a name="l352" href="#l352">352 </a></span> <span class="c2html-comment"> */</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
396 <span class="c2html-lineno"><a name="l353" href="#l353">353 </a></span> <span class="c2html-type">sstr_t</span> util_getsubstr_until_token(<span class="c2html-type">sstr_t</span> str, <span class="c2html-type">sstr_t</span> token, <span class="c2html-type">sstr_t</span> *sub) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
397 <span class="c2html-lineno"><a name="l354" href="#l354">354 </a></span> <span class="c2html-keyword">int</span> i;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
398 <span class="c2html-lineno"><a name="l355" href="#l355">355 </a></span> <span class="c2html-keyword">int</span> token_start = -<span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
399 <span class="c2html-lineno"><a name="l356" href="#l356">356 </a></span> <span class="c2html-keyword">int</span> token_end = -<span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
400 <span class="c2html-lineno"><a name="l357" href="#l357">357 </a></span> <span class="c2html-keyword">for</span>(i=<span class="c2html-macroconst">0</span>;i&lt;=str.length;i++) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
401 <span class="c2html-lineno"><a name="l358" href="#l358">358 </a></span> <span class="c2html-keyword">int</span> c;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
402 <span class="c2html-lineno"><a name="l359" href="#l359">359 </a></span> <span class="c2html-keyword">if</span>(i == str.length) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
403 <span class="c2html-lineno"><a name="l360" href="#l360">360 </a></span> c = <span class="c2html-string">' '</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
404 <span class="c2html-lineno"><a name="l361" href="#l361">361 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
405 <span class="c2html-lineno"><a name="l362" href="#l362">362 </a></span> c = str.ptr[i];
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
406 <span class="c2html-lineno"><a name="l363" href="#l363">363 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
407 <span class="c2html-lineno"><a name="l364" href="#l364">364 </a></span> <span class="c2html-keyword">if</span>(c &lt; <span class="c2html-macroconst">33</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
408 <span class="c2html-lineno"><a name="l365" href="#l365">365 </a></span> <span class="c2html-keyword">if</span>(token_start != -<span class="c2html-macroconst">1</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
409 <span class="c2html-lineno"><a name="l366" href="#l366">366 </a></span> token_end = i;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
410 <span class="c2html-lineno"><a name="l367" href="#l367">367 </a></span> <span class="c2html-type">size_t</span> len = token_end - token_start;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
411 <span class="c2html-lineno"><a name="l368" href="#l368">368 </a></span> <span class="c2html-type">sstr_t</span> tk = sstrsubsl(str, token_start, len);
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
412 <span class="c2html-lineno"><a name="l369" href="#l369">369 </a></span> <span class="c2html-comment">//printf("token: {%.*s}\n", token.length, token.ptr);</span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
413 <span class="c2html-lineno"><a name="l370" href="#l370">370 </a></span> <span class="c2html-keyword">if</span>(!sstrcmp(tk, token)) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
414 <span class="c2html-lineno"><a name="l371" href="#l371">371 </a></span> *sub = sstrtrim(sstrsubsl(str, <span class="c2html-macroconst">0</span>, token_start));
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
415 <span class="c2html-lineno"><a name="l372" href="#l372">372 </a></span> <span class="c2html-keyword">break</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
416 <span class="c2html-lineno"><a name="l373" href="#l373">373 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
417 <span class="c2html-lineno"><a name="l374" href="#l374">374 </a></span> token_start = -<span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
418 <span class="c2html-lineno"><a name="l375" href="#l375">375 </a></span> token_end = -<span class="c2html-macroconst">1</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
419 <span class="c2html-lineno"><a name="l376" href="#l376">376 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
420 <span class="c2html-lineno"><a name="l377" href="#l377">377 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
421 <span class="c2html-lineno"><a name="l378" href="#l378">378 </a></span> <span class="c2html-keyword">if</span>(token_start == -<span class="c2html-macroconst">1</span>) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
422 <span class="c2html-lineno"><a name="l379" href="#l379">379 </a></span> token_start = i;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
423 <span class="c2html-lineno"><a name="l380" href="#l380">380 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
424 <span class="c2html-lineno"><a name="l381" href="#l381">381 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
425 <span class="c2html-lineno"><a name="l382" href="#l382">382 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
426 <span class="c2html-lineno"><a name="l383" href="#l383">383 </a></span>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
427 <span class="c2html-lineno"><a name="l384" href="#l384">384 </a></span> <span class="c2html-keyword">if</span>(i &lt; str.length) {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
428 <span class="c2html-lineno"><a name="l385" href="#l385">385 </a></span> <span class="c2html-keyword">return</span> sstrtrim(sstrsubs(str, i));
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
429 <span class="c2html-lineno"><a name="l386" href="#l386">386 </a></span> } <span class="c2html-keyword">else</span> {
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
430 <span class="c2html-lineno"><a name="l387" href="#l387">387 </a></span> str.ptr = <span class="c2html-macroconst">NULL</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
431 <span class="c2html-lineno"><a name="l388" href="#l388">388 </a></span> str.length = <span class="c2html-macroconst">0</span>;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
432 <span class="c2html-lineno"><a name="l389" href="#l389">389 </a></span> <span class="c2html-keyword">return</span> str;
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
433 <span class="c2html-lineno"><a name="l390" href="#l390">390 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
434 <span class="c2html-lineno"><a name="l391" href="#l391">391 </a></span> }
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
435 </pre>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
436 </body>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
437 </html>
c06ab07fd29d increases input buffer + adds regression tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
438

mercurial