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

Side by Side Diff: nspr/pr/src/io/prdir.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 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 | « nspr/pr/include/prwin16.h ('k') | nspr/pr/src/io/prfdcach.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 /* -*- 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 */
OLDNEW
« no previous file with comments | « nspr/pr/include/prwin16.h ('k') | nspr/pr/src/io/prfdcach.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698