ObjFW  Diff

Differences From Artifact [c90f56e169]:

  • File src/OFFile.m — part of check-in [4e59d2692f] at 2014-04-26 00:40:17 on branch trunk — Fix a few issues on LLP64 and Win64

    LLP64 was mostly fast enumeration using an unsigned long for the state,
    which can't store a pointer or a size_t on LLP64. This is now solved by
    either throwing an OFOutOfRangeException if the value of the size_t is
    bigger than ULONG_MAX or storing the pointer in the extra field (copied
    using memcpy, as it's an array of unsigned long, which again would be
    too small to store a pointer).

    Win64 was mostly Microsoft not being able to decide whether a length is
    a size_t, a DWORD, an int or an unsigned int (thus the different types
    in places that seem to be almost the same). But since that would not be
    confusing enough, a file descriptor is an int if it's for a file, but a
    long long if it is for a socket. But of course, for ReadFile and friends
    it's a DWORD instead of an int then. (user: js, size: 21261) [annotate] [blame] [check-ins using]

To Artifact [8a5121abb8]:


21
22
23
24
25
26
27

28
29
30
31
32
33
34
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35







+







#include "config.h"

/* Work around a bug with Clang + glibc */
#ifdef __clang__
# define _HAVE_STRING_ARCH_strcmp
#endif

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include <unistd.h>

43
44
45
46
47
48
49




50
51
52
53
54
55
56
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







+
+
+
+







#endif

#ifdef __wii__
# define BOOL OGC_BOOL
# include <fat.h>
# undef BOOL
#endif

#ifdef OF_NINTENDO_DS
# include <filesystem.h>
#endif

#import "OFFile.h"
#import "OFString.h"
#import "OFArray.h"
#ifdef OF_HAVE_THREADS
# import "threading.h"
#endif
175
176
177
178
179
180
181






182
183
184
185
186
187
188
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199







+
+
+
+
+
+







	if (!of_mutex_new(&mutex))
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
#endif

#ifdef __wii__
	if (!fatInitDefault())
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
#endif

#ifdef OF_NINTENDO_DS
	if (!nitroFSInit(NULL))
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
#endif
}

+ (instancetype)fileWithPath: (OFString*)path
			mode: (OFString*)mode