| Comment: | OFFile: Simplify mode
This removes "b" for binary and always uses binary, as there is no good |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
23e57c50408c2d3f080d3c4a18047585 |
| User & Date: | js on 2017-07-22 23:04:35 |
| Other Links: | manifest | tags |
|
2017-07-23
| ||
| 17:55 | Add +[OFString stringWithData:encoding:] (check-in: 9aacc26542 user: js tags: trunk) | |
|
2017-07-22
| ||
| 23:04 | OFFile: Simplify mode (check-in: 23e57c5040 user: js tags: trunk) | |
| 20:50 | Split OFDataArray into OFData and OFMutableData (check-in: c8f7b90082 user: js tags: trunk) | |
Modified generators/TableGenerator.m from [e7bcb6d1cb] to [c7bfffe23c].
| ︙ | |||
261 262 263 264 265 266 267 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - + |
} while (!done);
}
- (void)writeTablesToFile: (OFString *)path
{
void *pool = objc_autoreleasePoolPush();
OFFile *file = [OFFile fileWithPath: path
|
| ︙ | |||
707 708 709 710 711 712 713 | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | - + |
objc_autoreleasePoolPop(pool);
}
- (void)writeHeaderToFile: (OFString *)path
{
void *pool = objc_autoreleasePoolPush();
OFFile *file = [OFFile fileWithPath: path
|
| ︙ |
Modified src/OFApplication.m from [970d1b40a3] to [c9d4f7d315].
| ︙ | |||
286 287 288 289 290 291 292 | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | - + | path = [@"ENV:" stringByAppendingString: name]; if ([fileManager directoryExistsAtPath: path]) continue; file = [OFFile fileWithPath: path |
| ︙ |
Modified src/OFData.m from [e5c693e728] to [504d17c5e3].
| ︙ | |||
212 213 214 215 216 217 218 | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | - + |
buffer = malloc(size);
if (buffer == NULL)
@throw [OFOutOfMemoryException
exceptionWithRequestedSize: size];
@try {
OFFile *file = [[OFFile alloc] initWithPath: path
|
| ︙ | |||
590 591 592 593 594 595 596 | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | - + |
return of_base64_encode(_items, _count * _itemSize);
}
#ifdef OF_HAVE_FILES
- (void)writeToFile: (OFString *)path
{
OFFile *file = [[OFFile alloc] initWithPath: path
|
| ︙ |
Modified src/OFFile.h from [d0fae452f5] to [cba6c42a3b].
| ︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + - - + - - - - - - + + + + + - - + - | * @brief Creates a new OFFile with the specified path and mode. * * @param path The path to the file to open as a string * @param mode The mode in which the file should be opened.@n * Possible modes are: * Mode | Description * ---------------|------------------------------------- |
| ︙ |
Modified src/OFFile.m from [4ff8100249] to [afef5a8ffe].
| ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | + + - - - + - - - - - - - + + + + + - - - - - - - - - - - - |
#ifndef OF_MORPHOS
static int
parseMode(const char *mode)
{
if (strcmp(mode, "r") == 0)
return O_RDONLY;
if (strcmp(mode, "r+") == 0)
return O_RDWR;
if (strcmp(mode, "w") == 0)
return O_WRONLY | O_CREAT | O_TRUNC;
if (strcmp(mode, "wx") == 0)
return O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK;
|
| ︙ | |||
234 235 236 237 238 239 240 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | - + | void *pool = objc_autoreleasePoolPush(); int flags; #ifndef OF_MORPHOS if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; |
| ︙ |
Modified src/OFFileManager.m from [0f38891013] to [7bb3d63d81].
| ︙ | |||
925 926 927 928 929 930 931 | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | - + - + |
if ((buffer = malloc(pageSize)) == NULL)
@throw [OFOutOfMemoryException
exceptionWithRequestedSize: pageSize];
@try {
sourceFile = [OFFile fileWithPath: source
|
| ︙ |
Modified src/OFString.m from [27f6116ecb] to [18c9b8230b].
| ︙ | |||
962 963 964 965 966 967 968 | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | - + - + |
@try {
fileSize = [[OFFileManager defaultManager]
sizeOfFileAtPath: path];
} @catch (OFStatItemFailedException *e) {
@throw [OFOpenItemFailedException
exceptionWithPath: path
|
| ︙ | |||
2764 2765 2766 2767 2768 2769 2770 | 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | - + |
- (void)writeToFile: (OFString *)path
encoding: (of_string_encoding_t)encoding
{
void *pool = objc_autoreleasePoolPush();
OFFile *file;
file = [OFFile fileWithPath: path
|
| ︙ |
Modified src/OFTarArchive.m from [cd4c802a1e] to [4c3a4649ab].
| ︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + |
return self;
}
#ifdef OF_HAVE_FILES
- initWithPath: (OFString *)path
{
OFFile *file = [[OFFile alloc] initWithPath: path
|
| ︙ |
Modified src/OFXMLParser.m from [dec1e593aa] to [913f851c54].
| ︙ | |||
278 279 280 281 282 283 284 | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | - + |
}
}
#ifdef OF_HAVE_FILES
- (void)parseFile: (OFString *)path
{
OFFile *file = [[OFFile alloc] initWithPath: path
|
| ︙ |
Modified src/OFZIPArchive.m from [4d9edd8589] to [8c3891b987].
| ︙ | |||
170 171 172 173 174 175 176 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | - + |
return self;
}
#ifdef OF_HAVE_FILES
- initWithPath: (OFString *)path
{
OFFile *file = [[OFFile alloc] initWithPath: path
|
| ︙ | |||
327 328 329 330 331 332 333 | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | - + | void *pool = objc_autoreleasePoolPush(); OFZIPArchiveEntry *entry = [_pathToEntryMap objectForKey: path]; OFZIPArchive_LocalFileHeader *localFileHeader; int64_t offset64; if (entry == nil) @throw [OFOpenItemFailedException exceptionWithPath: path |
| ︙ |
Modified tests/OFHMACTests.m from [b990fbedbe] to [2d71e6059d].
| ︙ | |||
63 64 65 66 67 68 69 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | - + |
"\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99";
@implementation TestsAppDelegate (OFHMACTests)
- (void)HMACTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFMD5HashTests.m from [44be095d7c] to [6a07431a3b].
| ︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + |
@implementation TestsAppDelegate (OFMD5HashTests)
- (void)MD5HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMD5Hash *md5, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFRIPEMD160HashTests.m from [ae86eb7cb3] to [7335aa3290].
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - + |
@implementation TestsAppDelegate (OFRIPEMD160HashTests)
- (void)RIPEMD160HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFRIPEMD160Hash *rmd160, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFSHA1HashTests.m from [33eb237c28] to [9caa66a935].
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - + |
@implementation TestsAppDelegate (SHA1HashTests)
- (void)SHA1HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFSHA1Hash *sha1, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFSHA224HashTests.m from [f315d21aac] to [1ea77887a2].
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - + |
@implementation TestsAppDelegate (SHA224HashTests)
- (void)SHA224HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFSHA224Hash *sha224, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFSHA256HashTests.m from [28da22207c] to [9d7a9504e6].
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - + |
@implementation TestsAppDelegate (SHA256HashTests)
- (void)SHA256HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFSHA256Hash *sha256, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFSHA384HashTests.m from [1e9c862681] to [51fe039320].
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + |
@implementation TestsAppDelegate (SHA384HashTests)
- (void)SHA384HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFSHA384Hash *sha384, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified tests/OFSHA512HashTests.m from [b5613ecdbe] to [d40dd0e7b4].
| ︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + |
@implementation TestsAppDelegate (SHA512HashTests)
- (void)SHA512HashTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFSHA512Hash *sha512, *copy;
OFFile *f = [OFFile fileWithPath: @"testfile.bin"
|
| ︙ |
Modified utils/ofhash/OFHash.m from [7cde93b02a] to [8ba8298b95].
| ︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + |
pool = objc_autoreleasePoolPush();
if ([path isEqual: @"-"])
file = of_stdin;
else {
@try {
file = [OFFile fileWithPath: path
|
| ︙ |
Modified utils/ofhttp/OFHTTP.m from [1f66bff7ec] to [492c8ebbc8].
| ︙ | |||
881 882 883 884 885 886 887 | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | - + |
_errorCode = 1;
goto next;
}
@try {
OFString *mode =
|
| ︙ |
Modified utils/ofzip/GZIPArchive.m from [d96ec8b8b5] to [081b9cc60a].
| ︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - + | @"file", fileName)]; if (![app shouldExtractFile: fileName outFileName: fileName]) return; output = [OFFile fileWithPath: fileName |
| ︙ |
Modified utils/ofzip/OFZIP.m from [95a3ff60d9] to [9f9989e04e].
| ︙ | |||
311 312 313 314 315 316 317 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - + |
_archivePath = [path copy];
if (path == nil)
return nil;
@try {
file = [OFFile fileWithPath: path
|
| ︙ |
Modified utils/ofzip/TarArchive.m from [65e143b64c] to [7ed0f15d3e].
| ︙ | |||
311 312 313 314 315 316 317 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - + | createParents: true]; if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; output = [OFFile fileWithPath: outFileName |
| ︙ |
Modified utils/ofzip/ZIPArchive.m from [8441a7f8cf] to [15729aa028].
| ︙ | |||
264 265 266 267 268 269 270 | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | - + | if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingFile: fileName]; output = [OFFile fileWithPath: outFileName |
| ︙ |