ObjFW  Diff

Differences From Artifact [4ef14749f7]:

To Artifact [fd77a17f17]:


132
133
134
135
136
137
138
139

140
141

142
143

144
145

146
147

148
149

150
151

152
153

154
155

156
157

158
159

160
161

162
163
164
165
166
167
168
132
133
134
135
136
137
138

139
140

141
142

143
144

145
146

147
148

149
150

151
152

153
154

155
156

157
158

159
160

161
162
163
164
165
166
167
168







-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+







	    buffer);
#endif
}

static int
parseMode(const char *mode)
{
	if (!strcmp(mode, "r"))
	if (strcmp(mode, "r") == 0)
		return O_RDONLY;
	if (!strcmp(mode, "rb"))
	if (strcmp(mode, "rb") == 0)
		return O_RDONLY | O_BINARY;
	if (!strcmp(mode, "r+"))
	if (strcmp(mode, "r+") == 0)
		return O_RDWR;
	if (!strcmp(mode, "rb+") || !strcmp(mode, "r+b"))
	if (strcmp(mode, "rb+") == 0 || strcmp(mode, "r+b") == 0)
		return O_RDWR | O_BINARY;
	if (!strcmp(mode, "w"))
	if (strcmp(mode, "w") == 0)
		return O_WRONLY | O_CREAT | O_TRUNC;
	if (!strcmp(mode, "wb"))
	if (strcmp(mode, "wb") == 0)
		return O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
	if (!strcmp(mode, "w+"))
	if (strcmp(mode, "w+") == 0)
		return O_RDWR | O_CREAT | O_TRUNC;
	if (!strcmp(mode, "wb+") || !strcmp(mode, "w+b"))
	if (strcmp(mode, "wb+") == 0 || strcmp(mode, "w+b") == 0)
		return O_RDWR | O_CREAT | O_TRUNC | O_BINARY;
	if (!strcmp(mode, "a"))
	if (strcmp(mode, "a") == 0)
		return O_WRONLY | O_CREAT | O_APPEND;
	if (!strcmp(mode, "ab"))
	if (strcmp(mode, "ab") == 0)
		return O_WRONLY | O_CREAT | O_APPEND | O_BINARY;
	if (!strcmp(mode, "a+"))
	if (strcmp(mode, "a+") == 0)
		return O_RDWR | O_CREAT | O_APPEND;
	if (!strcmp(mode, "ab+") || !strcmp(mode, "a+b"))
	if (strcmp(mode, "ab+") == 0 || strcmp(mode, "a+b") == 0)
		return O_RDWR | O_CREAT | O_APPEND | O_BINARY;

	return -1;
}

@implementation OFFile
+ (void)initialize
350
351
352
353
354
355
356
357
358


359
360
361
362
363
364
365
350
351
352
353
354
355
356


357
358
359
360
361
362
363
364
365







-
-
+
+







							       mode: @"r"];

	@try {
		while ((dirent = readdir(dir)) != NULL) {
			void *pool = objc_autoreleasePoolPush();
			OFString *file;

			if (!strcmp(dirent->d_name, ".") ||
			    !strcmp(dirent->d_name, ".."))
			if (strcmp(dirent->d_name, ".") == 0 ||
			    strcmp(dirent->d_name, "..") == 0)
				continue;

			file = [OFString stringWithCString: dirent->d_name
						  encoding: encoding];
			[files addObject: file];

			objc_autoreleasePoolPop(pool);