ObjFW  Diff

Differences From Artifact [8d104459de]:

To Artifact [ca5d4f1f51]:


20
21
22
23
24
25
26

27
28
29
30
31
32
33
#include <string.h>
#include <limits.h>

#import "OFDataArray.h"
#import "OFString.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"

#endif
#import "OFURL.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPClient.h"
# import "OFHTTPRequest.h"
# import "OFHTTPResponse.h"
#endif







>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <string.h>
#include <limits.h>

#import "OFDataArray.h"
#import "OFString.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
# import "OFFileManager.h"
#endif
#import "OFURL.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPClient.h"
# import "OFHTTPRequest.h"
# import "OFHTTPResponse.h"
#endif
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164

#ifdef OF_HAVE_FILES
- initWithContentsOfFile: (OFString*)path
{
	@try {
		OFFile *file = [[OFFile alloc] initWithPath: path
						       mode: @"rb"];

		of_offset_t size = [OFFile sizeOfFileAtPath: path];

		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException exception];

		self = [self initWithItemSize: 1
				     capacity: (size_t)size];








>
|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

#ifdef OF_HAVE_FILES
- initWithContentsOfFile: (OFString*)path
{
	@try {
		OFFile *file = [[OFFile alloc] initWithPath: path
						       mode: @"rb"];
		of_offset_t size = [[OFFileManager defaultManager]
		    sizeOfFileAtPath: path];

		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException exception];

		self = [self initWithItemSize: 1
				     capacity: (size_t)size];