Differences From Artifact [8d104459de]:
- File src/OFDataArray.m — part of check-in [dbe286c39f] at 2015-05-14 09:10:55 on branch trunk — initWithContentsOfURL: Require files or sockets (user: js, size: 14540) [annotate] [blame] [check-ins using]
To Artifact [ca5d4f1f51]:
- File
src/OFDataArray.m
— part of check-in
[f3c452dfef]
at
2015-08-22 10:57:14
on branch trunk
— Move file management to its own class
This makes it possible to add support for delegates for file management
operations and on top makes it easier to add support for file management
operations on URLs. (user: js, size: 14597) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
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 | #ifdef OF_HAVE_FILES - initWithContentsOfFile: (OFString*)path { @try { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"rb"]; | > | | 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]; |
︙ | ︙ |