Differences From Artifact [10ad5c2607]:
- File src/OFEmbeddedFileURLHandler.m — part of check-in [12a7357722] at 2022-08-07 18:23:02 on branch trunk — OFEmbeddedFileURLHandler: Add scheme check (user: js, size: 2880) [annotate] [blame] [check-ins using] [more...]
To Artifact [bac2da914b]:
- File
src/OFEmbeddedURIHandler.m
— part of check-in
[9b3cae6cba]
at
2022-10-09 16:33:24
on branch trunk
— Drop of- prefix from URI schemes
It's generally uncommon to prefix those.
Additionally, it might be worthwhile to try to get those actually
registered, which requires usage. (user: js, size: 2870) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include "config.h" #include <errno.h> #include <stdlib.h> #include <string.h> | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include "config.h" #include <errno.h> #include <stdlib.h> #include <string.h> #import "OFEmbeddedURIHandler.h" #import "OFMemoryStream.h" #import "OFURI.h" #import "OFInvalidArgumentException.h" #import "OFOpenItemFailedException.h" #ifdef OF_HAVE_THREADS # import "OFOnce.h" # import "OFPlainMutex.h" |
︙ | ︙ | |||
67 68 69 70 71 72 73 | numEmbeddedFiles++; #ifdef OF_HAVE_THREADS OFEnsure(OFPlainMutexUnlock(&mutex) == 0); #endif } | | | | | | | | | 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 | numEmbeddedFiles++; #ifdef OF_HAVE_THREADS OFEnsure(OFPlainMutexUnlock(&mutex) == 0); #endif } @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 errNo: EROFS]; if ((path = URI.path.UTF8String) == NULL) { @throw [OFInvalidArgumentException exception]; } #ifdef OF_HAVE_THREADS OFEnsure(OFPlainMutexLock(&mutex) == 0); @try { #endif |
︙ | ︙ | |||
106 107 108 109 110 111 112 | } #ifdef OF_HAVE_THREADS } @finally { OFEnsure(OFPlainMutexUnlock(&mutex) == 0); } #endif | | | 106 107 108 109 110 111 112 113 114 115 116 117 | } #ifdef OF_HAVE_THREADS } @finally { OFEnsure(OFPlainMutexUnlock(&mutex) == 0); } #endif @throw [OFOpenItemFailedException exceptionWithURI: URI mode: mode errNo: ENOENT]; } @end |