Differences From Artifact [1c567dbe1d]:
- File src/OFString.m — part of check-in [65afbedbd4] at 2014-07-07 22:28:00 on branch trunk — OFURL: Allow all RFC 1808 compatible schemes (user: js, size: 56084) [annotate] [blame] [check-ins using]
To Artifact [f631bc6b9b]:
- File
src/OFString.m
— part of check-in
[ec66e49dca]
at
2014-10-04 21:59:51
on branch trunk
— Add +[OFSystemInfo native8BitEncoding]
This replaces +[OFString nativeOSEncoding]. (user: js, size: 55944) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <sys/stat.h> #import "OFString.h" #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFArray.h" #import "OFDictionary.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 | > > < | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include <sys/stat.h> #import "OFString.h" #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFSystemInfo.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 #import "OFXMLElement.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPRequestFailedException.h" #endif #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" |
︙ | ︙ | |||
663 664 665 666 667 668 669 | } objc_autoreleasePoolPop(pool); return ret; } | < < < < < < | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | } objc_autoreleasePoolPop(pool); return ret; } - init { if (object_getClass(self) == [OFString class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; |
︙ | ︙ | |||
830 831 832 833 834 835 836 | @try { OFFile *file; /* Make sure the file system is initialized */ [OFFile class]; | | | | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | @try { OFFile *file; /* Make sure the file system is initialized */ [OFFile class]; if (stat([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], &st) == -1) @throw [OFOpenFileFailedException exceptionWithPath: path mode: @"rb"]; if (st.st_size > SIZE_MAX) @throw [OFOutOfRangeException exception]; |
︙ | ︙ | |||
1156 1157 1158 1159 1160 1161 1162 | [self OF_getCString: cString maxLength: length + 1 encoding: encoding lossy: lossy]; break; default: | | < | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | [self OF_getCString: cString maxLength: length + 1 encoding: encoding lossy: lossy]; break; default: @throw [OFInvalidEncodingException exception]; } return cString; } - (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { |
︙ | ︙ | |||
1214 1215 1216 1217 1218 1219 1220 | case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: return [self length]; default: | | < | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | case OF_STRING_ENCODING_ASCII: case OF_STRING_ENCODING_ISO_8859_1: case OF_STRING_ENCODING_ISO_8859_15: case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: return [self length]; default: @throw [OFInvalidEncodingException exception]; } } - (size_t)UTF8StringLength { return [self cStringLengthWithEncoding: OF_STRING_ENCODING_UTF_8]; } |
︙ | ︙ |