Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: c/dir.c

Issue 2842333002: Updated netty-tcnative to version 2.0.0.Final (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « c/bb.c ('k') | c/error.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18 *
19 * @author Mladen Turk
20 * @version $Id: dir.c 1442587 2013-02-05 13:49:48Z rjung $
21 */
22
23 #include "tcn.h"
24 #include "apr_file_io.h"
25
26 TCN_IMPLEMENT_CALL(jint, Directory, make)(TCN_STDARGS, jstring path,
27 jint perm, jlong pool)
28 {
29 apr_pool_t *p = J2P(pool, apr_pool_t *);
30 TCN_ALLOC_CSTRING(path);
31 apr_status_t rv;
32
33 UNREFERENCED(o);
34 rv = apr_dir_make(J2S(path), (apr_fileperms_t)perm, p);
35 TCN_FREE_CSTRING(path);
36 return (jint)rv;
37 }
38
39 TCN_IMPLEMENT_CALL(jint, Directory, makeRecursive)(TCN_STDARGS, jstring path,
40 jint perm, jlong pool)
41 {
42 apr_pool_t *p = J2P(pool, apr_pool_t *);
43 TCN_ALLOC_CSTRING(path);
44 apr_status_t rv;
45
46 UNREFERENCED(o);
47 rv = apr_dir_make_recursive(J2S(path), (apr_fileperms_t)perm, p);
48 TCN_FREE_CSTRING(path);
49 return (jint)rv;
50 }
51
52 TCN_IMPLEMENT_CALL(jint, Directory, remove)(TCN_STDARGS, jstring path,
53 jlong pool)
54 {
55 apr_pool_t *p = J2P(pool, apr_pool_t *);
56 TCN_ALLOC_CSTRING(path);
57 apr_status_t rv;
58
59 UNREFERENCED(o);
60 rv = apr_dir_remove(J2S(path), p);
61 TCN_FREE_CSTRING(path);
62 return (jint)rv;
63 }
64
65 TCN_IMPLEMENT_CALL(jstring, Directory, tempGet)(TCN_STDARGS, jlong pool)
66 {
67 apr_pool_t *p = J2P(pool, apr_pool_t *);
68 jstring name = NULL;
69 const char *tname;
70
71 UNREFERENCED(o);
72 if (apr_temp_dir_get(&tname, p) == APR_SUCCESS)
73 name = AJP_TO_JSTRING(tname);
74
75 return name;
76 }
77
78 TCN_IMPLEMENT_CALL(jlong, Directory, open)(TCN_STDARGS, jstring path,
79 jlong pool)
80 {
81 apr_pool_t *p = J2P(pool, apr_pool_t *);
82 apr_dir_t *d = NULL;
83 TCN_ALLOC_CSTRING(path);
84
85 UNREFERENCED(o);
86 TCN_THROW_IF_ERR(apr_dir_open(&d, J2S(path), p), d);
87
88 cleanup:
89 TCN_FREE_CSTRING(path);
90 return P2J(d);
91 }
92
93 TCN_IMPLEMENT_CALL(jint, Directory, close)(TCN_STDARGS, jlong dir)
94 {
95 apr_dir_t *d = J2P(dir, apr_dir_t *);
96 UNREFERENCED_STDARGS;
97 return (jint)apr_dir_close(d);
98 }
99
100 TCN_IMPLEMENT_CALL(jint, Directory, rewind)(TCN_STDARGS, jlong dir)
101 {
102 apr_dir_t *d = J2P(dir, apr_dir_t *);
103 UNREFERENCED_STDARGS;
104 return (jint)apr_dir_rewind(d);
105 }
OLDNEW
« no previous file with comments | « c/bb.c ('k') | c/error.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698