comparison nspr/pr/src/io/prdir.c @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "primpl.h"
7
8 PR_IMPLEMENT(PRDir*) PR_OpenDir(const char *name)
9 {
10 PRDir *dir;
11 PRStatus sts;
12
13 dir = PR_NEW(PRDir);
14 if (dir) {
15 sts = _PR_MD_OPEN_DIR(&dir->md,name);
16 if (sts != PR_SUCCESS) {
17 PR_DELETE(dir);
18 return NULL;
19 }
20 } else {
21 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
22 }
23 return dir;
24 }
25
26 PR_IMPLEMENT(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags)
27 {
28 /* _MD_READ_DIR return a char* to the name; allocation in machine-dependent code */
29 char* name = _PR_MD_READ_DIR(&dir->md, flags);
30 dir->d.name = name;
31 return name ? &dir->d : NULL;
32 }
33
34 PR_IMPLEMENT(PRStatus) PR_CloseDir(PRDir *dir)
35 {
36 PRInt32 rv;
37
38 if (dir) {
39 rv = _PR_MD_CLOSE_DIR(&dir->md);
40 PR_DELETE(dir);
41 if (rv < 0) {
42 return PR_FAILURE;
43 } else
44 return PR_SUCCESS;
45 }
46 return PR_SUCCESS;
47 }
48
49 PR_IMPLEMENT(PRStatus) PR_MkDir(const char *name, PRIntn mode)
50 {
51 PRInt32 rv;
52
53 rv = _PR_MD_MKDIR(name, mode);
54 if (rv < 0) {
55 return PR_FAILURE;
56 } else
57 return PR_SUCCESS;
58 }
59
60 PR_IMPLEMENT(PRStatus) PR_MakeDir(const char *name, PRIntn mode)
61 {
62 PRInt32 rv;
63
64 if (!_pr_initialized) _PR_ImplicitInitialization();
65 rv = _PR_MD_MAKE_DIR(name, mode);
66 if (rv < 0) {
67 return PR_FAILURE;
68 } else
69 return PR_SUCCESS;
70 }
71
72 PR_IMPLEMENT(PRStatus) PR_RmDir(const char *name)
73 {
74 PRInt32 rv;
75
76 rv = _PR_MD_RMDIR(name);
77 if (rv < 0) {
78 return PR_FAILURE;
79 } else
80 return PR_SUCCESS;
81 }
82
83 #ifdef MOZ_UNICODE
84 /*
85 * UTF16 Interface
86 */
87 PR_IMPLEMENT(PRDirUTF16*) PR_OpenDirUTF16(const PRUnichar *name)
88 {
89 PRDirUTF16 *dir;
90 PRStatus sts;
91
92 dir = PR_NEW(PRDirUTF16);
93 if (dir) {
94 sts = _PR_MD_OPEN_DIR_UTF16(&dir->md,name);
95 if (sts != PR_SUCCESS) {
96 PR_DELETE(dir);
97 return NULL;
98 }
99 } else {
100 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
101 }
102 return dir;
103 }
104
105 PR_IMPLEMENT(PRDirEntryUTF16*) PR_ReadDirUTF16(PRDirUTF16 *dir, PRDirFlags flags)
106 {
107 /*
108 * _MD_READ_DIR_UTF16 return a PRUnichar* to the name; allocation in
109 * machine-dependent code
110 */
111 PRUnichar* name = _PR_MD_READ_DIR_UTF16(&dir->md, flags);
112 dir->d.name = name;
113 return name ? &dir->d : NULL;
114 }
115
116 PR_IMPLEMENT(PRStatus) PR_CloseDirUTF16(PRDirUTF16 *dir)
117 {
118 PRInt32 rv;
119
120 if (dir) {
121 rv = _PR_MD_CLOSE_DIR_UTF16(&dir->md);
122 PR_DELETE(dir);
123 if (rv < 0)
124 return PR_FAILURE;
125 else
126 return PR_SUCCESS;
127 }
128 return PR_SUCCESS;
129 }
130
131 #endif /* MOZ_UNICODE */
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)