Comment: | Drop of- prefix from URI schemes
It's generally uncommon to prefix those. Additionally, it might be worthwhile to try to get those actually |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9b3cae6cbaf1dc051276f55b9a178f5e |
User & Date: | js on 2022-10-09 16:33:24 |
Other Links: | manifest | tags |
2022-10-09
| ||
21:03 | Update buildsys check-in: 95c9171201 user: js tags: trunk | |
16:33 | Drop of- prefix from URI schemes check-in: 9b3cae6cba user: js tags: trunk | |
16:19 | OFZIPArchive: Make returned streams retain archive check-in: 6527c97d03 user: js tags: trunk | |
Modified src/OFArchiveURIHandler.m from [688b91a007] to [99f47b2418].
︙ | ︙ | |||
67 68 69 70 71 72 73 | */ @throw [OFInvalidArgumentException exception]; /* * GZIP only compresses one file and thus has no path inside an * archive. */ | | | | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 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 | */ @throw [OFInvalidArgumentException exception]; /* * GZIP only compresses one file and thus has no path inside an * archive. */ if ([scheme isEqual: @"gzip"]) { stream = [OFURIHandler openItemAtURI: [OFURI URIWithString: URI.path] mode: @"r"]; stream = [OFGZIPStream streamWithStream: stream mode: @"r"]; goto end; } percentEncodedPath = URI.percentEncodedPath; pos = [percentEncodedPath rangeOfString: @"!"].location; if (pos == OFNotFound) @throw [OFInvalidArgumentException exception]; archiveURI = [OFURI URIWithString: [percentEncodedPath substringWithRange: OFMakeRange(0, pos)] .stringByRemovingPercentEncoding]; path = [percentEncodedPath substringWithRange: OFMakeRange(pos + 1, percentEncodedPath.length - pos - 1)] .stringByRemovingPercentEncoding; if ([scheme isEqual: @"lha"]) { OFLHAArchive *archive = [OFLHAArchive archiveWithURI: archiveURI mode: @"r"]; OFLHAArchiveEntry *entry; while ((entry = [archive nextEntry]) != nil) { if ([entry.fileName isEqual: path]) { stream = [archive streamForReadingCurrentEntry]; goto end; } } @throw [OFOpenItemFailedException exceptionWithURI: URI mode: mode errNo: ENOENT]; } else if ([scheme isEqual: @"tar"]) { OFTarArchive *archive = [OFTarArchive archiveWithURI: archiveURI mode: @"r"]; OFTarArchiveEntry *entry; while ((entry = [archive nextEntry]) != nil) { if ([entry.fileName isEqual: path]) { stream = [archive streamForReadingCurrentEntry]; goto end; } } @throw [OFOpenItemFailedException exceptionWithURI: URI mode: mode errNo: ENOENT]; } else if ([scheme isEqual: @"zip"]) { OFZIPArchive *archive = [OFZIPArchive archiveWithURI: archiveURI mode: @"r"]; stream = [archive streamForReadingFile: path]; } else @throw [OFInvalidArgumentException exception]; |
︙ | ︙ |
Modified src/OFEmbeddedURIHandler.m from [b9239d2145] to [bac2da914b].
︙ | ︙ | |||
72 73 74 75 76 77 78 | } @implementation OFEmbeddedURIHandler - (OFStream *)openItemAtURI: (OFURI *)URI mode: (OFString *)mode { const char *path; | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | } @implementation OFEmbeddedURIHandler - (OFStream *)openItemAtURI: (OFURI *)URI mode: (OFString *)mode { const char *path; if (![URI.scheme isEqual: @"embedded"] || URI.host.length > 0 || URI.port != nil || URI.user != nil || URI.password != nil || URI.query != nil || URI.fragment != nil) @throw [OFInvalidArgumentException exception]; if (![mode isEqual: @"r"]) @throw [OFOpenItemFailedException exceptionWithURI: URI mode: mode |
︙ | ︙ |
Modified src/OFLHAArchive.m from [3876237eb4] to [4f2f21f0fa].
︙ | ︙ | |||
91 92 93 94 95 96 97 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { return OFArchiveURIHandlerURIForFileInArchive(@"lha", path, archive); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ |
Modified src/OFTarArchive.m from [4c749d1fe6] to [e86038baec].
︙ | ︙ | |||
77 78 79 80 81 82 83 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { return OFArchiveURIHandlerURIForFileInArchive(@"tar", path, archive); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ |
Modified src/OFURIHandler.m from [48616dbf01] to [1cc8c8dac2].
︙ | ︙ | |||
57 58 59 60 61 62 63 | handlers = [[OFMutableDictionary alloc] init]; #ifdef OF_HAVE_THREADS mutex = [[OFMutex alloc] init]; atexit(releaseMutex); #endif [self registerClass: [OFEmbeddedURIHandler class] | | | | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | handlers = [[OFMutableDictionary alloc] init]; #ifdef OF_HAVE_THREADS mutex = [[OFMutex alloc] init]; atexit(releaseMutex); #endif [self registerClass: [OFEmbeddedURIHandler class] forScheme: @"embedded"]; #ifdef OF_HAVE_FILES [self registerClass: [OFFileURIHandler class] forScheme: @"file"]; #endif #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS) [self registerClass: [OFHTTPURIHandler class] forScheme: @"http"]; [self registerClass: [OFHTTPURIHandler class] forScheme: @"https"]; #endif [self registerClass: [OFArchiveURIHandler class] forScheme: @"gzip"]; [self registerClass: [OFArchiveURIHandler class] forScheme: @"lha"]; [self registerClass: [OFArchiveURIHandler class] forScheme: @"tar"]; [self registerClass: [OFArchiveURIHandler class] forScheme: @"zip"]; } + (bool)registerClass: (Class)class forScheme: (OFString *)scheme { #ifdef OF_HAVE_THREADS [mutex lock]; @try { |
︙ | ︙ |
Modified src/OFZIPArchive.m from [9d548c4f33] to [7434ba6daa].
︙ | ︙ | |||
172 173 174 175 176 177 178 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { return OFArchiveURIHandlerURIForFileInArchive(@"zip", path, archive); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ |
Modified tests/OFHMACTests.m from [e2caa794c8] to [dc8ace4048].
︙ | ︙ | |||
47 48 49 50 51 52 53 | "\x61\xB3\xF9\x1A\xE3\x09\x43\xA6\x5B\x85\xB1\x50\x5B\xCB\x1A\x2E" "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { void *pool = objc_autoreleasePoolPush(); | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | "\x61\xB3\xF9\x1A\xE3\x09\x43\xA6\x5B\x85\xB1\x50\x5B\xCB\x1A\x2E" "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { void *pool = objc_autoreleasePoolPush(); OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; OFHMAC *HMACMD5, *HMACSHA1, *HMACRMD160; OFHMAC *HMACSHA256, *HMACSHA384, *HMACSHA512; TEST(@"+[HMACWithHashClass:] with MD5", (HMACMD5 = [OFHMAC HMACWithHashClass: [OFMD5Hash class] allowsSwappableMemory: true])) |
︙ | ︙ |
Modified tests/OFINIFileTests.m from [69c1fa4176] to [18e2931d0e].
︙ | ︙ | |||
49 50 51 52 53 54 55 | OFArray *array; #if defined(OF_HAVE_FILES) && !defined(OF_NINTENDO_DS) OFURI *writeURI; #endif module = @"OFINIFile"; | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | OFArray *array; #if defined(OF_HAVE_FILES) && !defined(OF_NINTENDO_DS) OFURI *writeURI; #endif module = @"OFINIFile"; URI = [OFURI URIWithString: @"embedded:testfile.ini"]; TEST(@"+[fileWithURI:encoding:]", (file = [OFINIFile fileWithURI: URI encoding: OFStringEncodingCodepage437])) tests = [file categoryForName: @"tests"]; foobar = [file categoryForName: @"foobar"]; types = [file categoryForName: @"types"]; |
︙ | ︙ |
Modified tests/OFMD5HashTests.m from [aeb9ce5779] to [5005b07061].
︙ | ︙ | |||
25 26 27 28 29 30 31 | "\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38"; @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { void *pool = objc_autoreleasePoolPush(); OFMD5Hash *MD5, *MD5Copy; | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | "\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38"; @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { void *pool = objc_autoreleasePoolPush(); OFMD5Hash *MD5, *MD5Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (MD5 = [OFMD5Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[64]; |
︙ | ︙ |
Modified tests/OFRIPEMD160HashTests.m from [7421f32a5c] to [c46510efe0].
︙ | ︙ | |||
26 27 28 29 30 31 32 | "\xE6\x08\x8B"; @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { void *pool = objc_autoreleasePoolPush(); OFRIPEMD160Hash *RIPEMD160, *RIPEMD160Copy; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "\xE6\x08\x8B"; @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { void *pool = objc_autoreleasePoolPush(); OFRIPEMD160Hash *RIPEMD160, *RIPEMD160Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (RIPEMD160 = [OFRIPEMD160Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[64]; |
︙ | ︙ |
Modified tests/OFSHA1HashTests.m from [e2a91910a3] to [76d8541713].
︙ | ︙ | |||
26 27 28 29 30 31 32 | "\x94\xE7\x17"; @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA1Hash *SHA1, *SHA1Copy; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "\x94\xE7\x17"; @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA1Hash *SHA1, *SHA1Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA1 = [OFSHA1Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[64]; |
︙ | ︙ |
Modified tests/OFSHA224HashTests.m from [927be92210] to [a723282b7a].
︙ | ︙ | |||
26 27 28 29 30 31 32 | "\x5F\x4F\x20\x02\x4D\x15\xED\x1C\x61\x1F\xF7"; @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA224Hash *SHA224, *SHA224Copy; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "\x5F\x4F\x20\x02\x4D\x15\xED\x1C\x61\x1F\xF7"; @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA224Hash *SHA224, *SHA224Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA224 = [OFSHA224Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[64]; |
︙ | ︙ |
Modified tests/OFSHA256HashTests.m from [cdbd1a9d12] to [ea4a5936cb].
︙ | ︙ | |||
26 27 28 29 30 31 32 | "\x67\x93\x8F\x0F\x44\x90\xB8\xF5\x35\x89\xF0\x5A\x23\x7F\x69"; @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA256Hash *SHA256, *SHA256Copy; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "\x67\x93\x8F\x0F\x44\x90\xB8\xF5\x35\x89\xF0\x5A\x23\x7F\x69"; @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA256Hash *SHA256, *SHA256Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA256 = [OFSHA256Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[64]; |
︙ | ︙ |
Modified tests/OFSHA384HashTests.m from [41c4f16030] to [4335e4cd7c].
︙ | ︙ | |||
27 28 29 30 31 32 33 | "\xE9\x1A\xB3\x51\x70\x8C\x1F\x3F\x56\x12\x44\x01\x91\x54"; @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA384Hash *SHA384, *SHA384Copy; | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | "\xE9\x1A\xB3\x51\x70\x8C\x1F\x3F\x56\x12\x44\x01\x91\x54"; @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA384Hash *SHA384, *SHA384Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA384 = [OFSHA384Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[128]; |
︙ | ︙ |
Modified tests/OFSHA512HashTests.m from [0cc8515cf1] to [9748b0700b].
︙ | ︙ | |||
28 29 30 31 32 33 34 | "\xA1\x8A\x41\x64\x33\x69\x21\x8C\x2A\x44\x6D\xF2\xA0"; @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA512Hash *SHA512, *SHA512Copy; | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | "\xA1\x8A\x41\x64\x33\x69\x21\x8C\x2A\x44\x6D\xF2\xA0"; @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA512Hash *SHA512, *SHA512Copy; OFURI *URI = [OFURI URIWithString: @"embedded:testfile.bin"]; OFStream *file = [OFURIHandler openItemAtURI: URI mode: @"r"]; TEST(@"+[hashWithAllowsSwappableMemory:]", (SHA512 = [OFSHA512Hash hashWithAllowsSwappableMemory: true])) while (!file.atEndOfStream) { char buffer[128]; |
︙ | ︙ |
Modified tests/OFSerializationTests.m from [5f49396f7c] to [d36329ce8f].
︙ | ︙ | |||
58 59 60 61 62 63 64 | UUID = [OFUUID UUIDWithUUIDString: @"01234567-89AB-CDEF-FEDC-BA9876543210"]; [dict setObject: @"uuid" forKey: UUID]; TEST(@"-[stringBySerializing]", (string = dict.stringBySerializing) && [string isEqual: [OFString stringWithContentsOfURI: | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | UUID = [OFUUID UUIDWithUUIDString: @"01234567-89AB-CDEF-FEDC-BA9876543210"]; [dict setObject: @"uuid" forKey: UUID]; TEST(@"-[stringBySerializing]", (string = dict.stringBySerializing) && [string isEqual: [OFString stringWithContentsOfURI: [OFURI URIWithString: @"embedded:serialization.xml"]]]) TEST(@"-[objectByDeserializing]", [string.objectByDeserializing isEqual: dict]) objc_autoreleasePoolPop(pool); } @end |