Comment: | Merge trunk into 1.0 branch |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 1.0 |
Files: | files | file ages | folders |
SHA3-256: |
db2ba7634216544af16516556a866b3b |
User & Date: | js on 2020-11-29 04:38:48 |
Other Links: | branch diff | manifest | tags |
2020-12-18
| ||
10:45 | Merge trunk into 1.0 branch check-in: 98c3748090 user: js tags: 1.0 | |
2020-11-29
| ||
04:38 | Merge trunk into 1.0 branch check-in: db2ba76342 user: js tags: 1.0 | |
04:02 | OFSelectKernelEventObserver: Move FD_ZERO check-in: 4504bd4141 user: js tags: trunk | |
2020-11-12
| ||
00:45 | Merge trunk into 1.0 branch check-in: a1163fb58b user: js tags: 1.0 | |
Modified .github/ISSUE_TEMPLATE/config.yml from [c578ed1d2f] to [9e9aba5d8e].
︙ | ︙ | |||
10 11 12 13 14 15 16 | about: Please use this to look for existing tickets. - name: ObjFW Forum url: https://objfw.nil.im/forum about: Please use this if you have questions or want support. - name: ObjFW Matrix Room url: https://matrix.to/#/%23objfw:nil.im about: Please use this for interactive questions and support. | | > > > > > > > > > > | > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | about: Please use this to look for existing tickets. - name: ObjFW Forum url: https://objfw.nil.im/forum about: Please use this if you have questions or want support. - name: ObjFW Matrix Room url: https://matrix.to/#/%23objfw:nil.im about: Please use this for interactive questions and support. - name: ObjFW Slack Channel url: https://objfw.nil.im/slack about: Please use this for interactive questions and support - it is bridged to the Matrix room above. - name: ObjFW Discord Channel url: https://objfw.nil.im/discord about: Please use this for interactive questions and support - it is bridged to the Matrix room above. - name: ObjFW Telegram Room url: https://t.me/objfw about: Please use this for interactive questions and support - it is bridged to the Matrix room above. - name: ObjFW Gitter Room url: https://gitter.im/ObjFW/ObjFW about: Please use this for interactive questions and support - it is bridged to the Matrix room above. |
Modified README.md from [f866fd61d7] to [891d14f8ee].
︙ | ︙ | |||
334 335 336 337 338 339 340 | [here](https://objfw.nil.im/docs/). In order to build the documentation yourself (necessary to have documentation for trunk / master), you need to have [Doxygen](https://www.doxygen.nl) installed. Once installed, you can build the documentation from the root directory of the repository: | | | | > | | > > > | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | [here](https://objfw.nil.im/docs/). In order to build the documentation yourself (necessary to have documentation for trunk / master), you need to have [Doxygen](https://www.doxygen.nl) installed. Once installed, you can build the documentation from the root directory of the repository: $ make docs <h1 id="bugs">Bugs and feature requests</h1> If you find any bugs or have feature requests, please [file a new bug](https://objfw.nil.im/tktnew) in the [bug tracker](https://objfw.nil.im/reportlist). Alternatively, feel free to send a mail to js@nil.im! <h1 id="support">Support and community</h1> If you have any questions about ObjFW or would like to talk to other ObjFW users, the following venues are available: * The [forum](https://objfw.nil.im/forum) * A [Matrix room](https://matrix.to/#/%23objfw:nil.im) * A [Slack channel](https://objfw.nil.im/slack), bridged to the Matrix room above * A [Discord channel](https://objfw.nil.im/discord), bridged to the Matrix room above * A [Telegram room](https://t.me/objfw), bridged to the Matrix room above * A [Gitter room](https://gitter.im/ObjFW/ObjFW), bridged to the Matrix room above Please don't hesitate to join any or all of those! <h1 id="commercial-use">Commercial use</h1> If for whatever reason neither the terms of the QPL nor those of the GPL work for you, a proprietary license for ObjFW including support is available upon request. Just write a mail to js@nil.im and we can find a reasonable solution for both parties. |
Modified build-aux/m4/buildsys.m4 from [74391b1263] to [647753f85b].
︙ | ︙ | |||
45 46 47 48 49 50 51 | [AC_SUBST(DEP_OBJCFLAGS, '-MD -MF $${out%.o}.dep')]) AS_IF([test x"$GOBJCXX" = x"yes"], [AC_SUBST(DEP_OBJCXXFLAGS, '-MD -MF $${out%.o}.dep')]) AC_SUBST(AMIGA_LIB_CFLAGS) AC_SUBST(AMIGA_LIB_LDFLAGS) | > > > > > > > > > | > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | [AC_SUBST(DEP_OBJCFLAGS, '-MD -MF $${out%.o}.dep')]) AS_IF([test x"$GOBJCXX" = x"yes"], [AC_SUBST(DEP_OBJCXXFLAGS, '-MD -MF $${out%.o}.dep')]) AC_SUBST(AMIGA_LIB_CFLAGS) AC_SUBST(AMIGA_LIB_LDFLAGS) case "$build_os" in morphos*) dnl Don't use tput on MorphOS: The colored dnl output is quite unreadable and in some dnl MorphOS versions, the output from tput is dnl not 8-bit safe, with awk (for AC_SUBST) dnl failing as a result. ;; *) AC_PATH_PROG(TPUT, tput) ;; esac AS_IF([test x"$TPUT" != x""], [ if x=$($TPUT el 2>/dev/null); then AC_SUBST(TERM_EL, "$x") else AC_SUBST(TERM_EL, "$($TPUT ce 2>/dev/null)") fi |
︙ | ︙ | |||
305 306 307 308 309 310 311 312 313 314 315 316 | ], [ FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/../Frameworks/$$out/$${out%.framework}' ]) AC_SUBST(FRAMEWORK_LDFLAGS) AC_SUBST(FRAMEWORK_LDFLAGS_INSTALL_NAME) $1 ;; esac ]) | > | 316 317 318 319 320 321 322 323 324 325 326 327 328 | ], [ FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/../Frameworks/$$out/$${out%.framework}' ]) AC_SUBST(FRAMEWORK_LDFLAGS) AC_SUBST(FRAMEWORK_LDFLAGS_INSTALL_NAME) AC_SUBST(FRAMEWORK_LIBS) $1 ;; esac ]) |
Modified buildsys.mk.in from [0dd86557eb] to [1766cbea3c].
︙ | ︙ | |||
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | AMIGA_LIB_CFLAGS = @AMIGA_LIB_CFLAGS@ AMIGA_LIB_LDFLAGS = @AMIGA_LIB_LDFLAGS@ PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@ PLUGIN_SUFFIX = @PLUGIN_SUFFIX@ FRAMEWORK_LDFLAGS = @FRAMEWORK_LDFLAGS@ FRAMEWORK_LDFLAGS_INSTALL_NAME = @FRAMEWORK_LDFLAGS_INSTALL_NAME@ CODESIGN = @CODESIGN@ CODESIGN_IDENTITY ?= - CLEAN_LIB = @CLEAN_LIB@ DEP_ASFLAGS = @DEP_ASFLAGS@ DEP_CFLAGS = @DEP_CFLAGS@ DEP_CXXFLAGS = @DEP_CXXFLAGS@ DEP_OBJCFLAGS = @DEP_OBJCFLAGS@ | > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | AMIGA_LIB_CFLAGS = @AMIGA_LIB_CFLAGS@ AMIGA_LIB_LDFLAGS = @AMIGA_LIB_LDFLAGS@ PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@ PLUGIN_SUFFIX = @PLUGIN_SUFFIX@ FRAMEWORK_LDFLAGS = @FRAMEWORK_LDFLAGS@ FRAMEWORK_LDFLAGS_INSTALL_NAME = @FRAMEWORK_LDFLAGS_INSTALL_NAME@ FRAMEWORK_LIBS = @FRAMEWORK_LIBS@ CODESIGN = @CODESIGN@ CODESIGN_IDENTITY ?= - CLEAN_LIB = @CLEAN_LIB@ DEP_ASFLAGS = @DEP_ASFLAGS@ DEP_CFLAGS = @DEP_CFLAGS@ DEP_CXXFLAGS = @DEP_CXXFLAGS@ DEP_OBJCFLAGS = @DEP_OBJCFLAGS@ |
︙ | ︙ |
Modified configure.ac from [641aba20a6] to [644ef88f34].
︙ | ︙ | |||
98 99 100 101 102 103 104 | AC_SUBST(AMIGA_LIB_LDFLAGS, $t) ]) AC_SUBST(LIBBASES_M, libbases.m) ]) enable_shared="no" | < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | AC_SUBST(AMIGA_LIB_LDFLAGS, $t) ]) AC_SUBST(LIBBASES_M, libbases.m) ]) enable_shared="no" ;; *-msdosdjgpp*) enable_shared="no" enable_threads="no" enable_sockets="no" ;; *-*-mingw*) |
︙ | ︙ | |||
145 146 147 148 149 150 151 | dnl Hack to make configure find these on DOS. : ${AR:=ar.exe} : ${GREP:=grep.exe} : ${RANLIB:=ranlib.exe} ]) AC_LANG([Objective C]) | > > > > > > > | > > > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | dnl Hack to make configure find these on DOS. : ${AR:=ar.exe} : ${GREP:=grep.exe} : ${RANLIB:=ranlib.exe} ]) AC_LANG([Objective C]) case "$host_os" in morphos*) dnl Don't use clang on MorphOS - it does not support baserel, dnl which is required for the .library. potential_compilers="gcc" ;; *) potential_compilers="clang egcc gcc" ;; esac AC_PROG_OBJC($potential_compilers) AC_PROG_OBJCPP AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_EGREP BUILDSYS_CHECK_IOS |
︙ | ︙ | |||
356 357 358 359 360 361 362 | AC_ARG_ENABLE(shared, AS_HELP_STRING([--disable-shared], [do not build shared library])) AS_IF([test x"$enable_shared" != x"no"], [ BUILDSYS_SHARED_LIB AC_SUBST(OBJFW_SHARED_LIB, "${LIB_PREFIX}objfw${LIB_SUFFIX}") AC_SUBST(EXCEPTIONS_LIB_A, "exceptions.lib.a") | < < < | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | AC_ARG_ENABLE(shared, AS_HELP_STRING([--disable-shared], [do not build shared library])) AS_IF([test x"$enable_shared" != x"no"], [ BUILDSYS_SHARED_LIB AC_SUBST(OBJFW_SHARED_LIB, "${LIB_PREFIX}objfw${LIB_SUFFIX}") AC_SUBST(EXCEPTIONS_LIB_A, "exceptions.lib.a") AC_SUBST(FORWARDING_LIB_A, "forwarding.lib.a") AC_SUBST(LOOKUP_ASM_LIB_A, "lookup-asm.lib.a") BUILDSYS_FRAMEWORK([ AC_SUBST(OBJFW_FRAMEWORK, "ObjFW.framework") build_framework="yes" ]) ], [ AC_DEFINE(OF_NO_SHARED, 1, [Whether no shared library was built]) |
︙ | ︙ | |||
384 385 386 387 388 389 390 | TESTS_LIBS="-L../src/runtime -L../src/runtime/linklib $TESTS_LIBS" TESTS_LIBS="-L../src -lobjfw $TESTS_LIBS" ]) AC_ARG_ENABLE(amiga-lib, AS_HELP_STRING([--disable-amiga-lib], [do not build Amiga library])) AS_IF([test x"$supports_amiga_lib" != x"yes"], [enable_amiga_lib="no"]) | | | | > > > > > | < < < | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | TESTS_LIBS="-L../src/runtime -L../src/runtime/linklib $TESTS_LIBS" TESTS_LIBS="-L../src -lobjfw $TESTS_LIBS" ]) AC_ARG_ENABLE(amiga-lib, AS_HELP_STRING([--disable-amiga-lib], [do not build Amiga library])) AS_IF([test x"$supports_amiga_lib" != x"yes"], [enable_amiga_lib="no"]) AS_IF([test x"$enable_amiga_lib" != x"no"], [ AC_SUBST(OBJFW_STATIC_LIB, "libobjfw.a") AC_SUBST(EXCEPTIONS_A, "exceptions.a") AC_SUBST(FORWARDING_A, "forwarding.a") AC_SUBST(LOOKUP_ASM_AMIGALIB_A, "lookup-asm.amigalib.a") ]) AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static library])) AS_IF([test x"$enable_shared" = x"no" -a x"$enable_amiga_lib" = x"no"], [ enable_static="yes" ]) AS_IF([test x"$enable_static" = x"yes"], [ AC_SUBST(OBJFW_STATIC_LIB, "libobjfw.a") AC_SUBST(EXCEPTIONS_A, "exceptions.a") AC_SUBST(FORWARDING_A, "forwarding.a") AC_SUBST(LOOKUP_ASM_A, "lookup-asm.a") ]) AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins]) AS_IF([test x"$enable_files" != x"no" -a x"$PLUGIN_SUFFIX" != x""], [ AC_SUBST(USE_SRCS_PLUGINS, '${SRCS_PLUGINS}') AC_SUBST(TESTPLUGIN, "plugin") AC_DEFINE(OF_HAVE_PLUGINS, 1, [Whether we have plugin support]) |
︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | [disable compiler thread local storage])) case "$host" in aarch64*-*-android*) # Compiler TLS is broken on AArch64 Android with Clang enable_compiler_tls="no" ;; | | > > > > | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | [disable compiler thread local storage])) case "$host" in aarch64*-*-android*) # Compiler TLS is broken on AArch64 Android with Clang enable_compiler_tls="no" ;; m68k-*-amigaos* | powerpc-*-amigaos*) # Compiler TLS is broken on AmigaOS enable_compiler_tls="no" ;; *-*-morphos*) # Compiler TLS needs helpers that we don't want in the # .library enable_compiler_tls="no" esac AS_IF([test x"$enable_compiler_tls" != x"no"], [ AC_CHECK_HEADER(threads.h, [ AC_DEFINE(OF_HAVE_THREADS_H, 1, [Whether we have threads.h]) ]) |
︙ | ︙ | |||
1302 1303 1304 1305 1306 1307 1308 | [Whether strerror_r returns char *]) ]) ]) AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_FUNCS(uname) | < < < < | | | < < | 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | [Whether strerror_r returns char *]) ]) ]) AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_FUNCS(uname) AC_CHECK_FUNC(pipe, [ AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()]) ]) AC_ARG_ENABLE(sockets, AS_HELP_STRING([--disable-sockets], [disable socket support])) AS_IF([test x"$enable_sockets" != x"no"], [ AC_DEFINE(OF_HAVE_SOCKETS, 1, [Whether we have sockets]) AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}') |
︙ | ︙ | |||
1548 1549 1550 1551 1552 1553 1554 | AC_MSG_RESULT(no) ]) ]) CHECK_BUILTIN_BSWAP(16) CHECK_BUILTIN_BSWAP(32) CHECK_BUILTIN_BSWAP(64) | | | > > > > > > > > > > > > | > | | | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 | AC_MSG_RESULT(no) ]) ]) CHECK_BUILTIN_BSWAP(16) CHECK_BUILTIN_BSWAP(32) CHECK_BUILTIN_BSWAP(64) case "$host_os" in darwin*) AC_MSG_CHECKING(whether we are compiling for macOS) AC_EGREP_CPP(egrep_cpp_yes, [ #include <TargetConditionals.h> #if defined(TARGET_OS_OSX) && TARGET_OS_OSX egrep_cpp_yes #endif ], [ AC_MSG_RESULT(yes) have_processes="yes" ], [ AC_MSG_RESULT(no) have_processes="no" ]) ;; mingw*) have_processes="yes" ;; msdosdjgpp*) have_processes="no" ;; *) AC_HEADER_SYS_WAIT AC_CHECK_FUNCS(kill) AC_CHECK_FUNCS(posix_spawnp, [ |
︙ | ︙ |
Modified extra.mk.in from [a32bf0e1ad] to [9649110b45].
︙ | ︙ | |||
18 19 20 21 22 23 24 | OBJFWBRIDGE_FRAMEWORK = @OBJFWBRIDGE_FRAMEWORK@ BIN_PREFIX = @BIN_PREFIX@ BRIDGE = @BRIDGE@ CVINCLUDE_INLINE_H = @CVINCLUDE_INLINE_H@ ENCODINGS = @ENCODINGS@ ENCODINGS_A = @ENCODINGS_A@ | < < < < < < < < < | | 18 19 20 21 22 23 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 49 | OBJFWBRIDGE_FRAMEWORK = @OBJFWBRIDGE_FRAMEWORK@ BIN_PREFIX = @BIN_PREFIX@ BRIDGE = @BRIDGE@ CVINCLUDE_INLINE_H = @CVINCLUDE_INLINE_H@ ENCODINGS = @ENCODINGS@ ENCODINGS_A = @ENCODINGS_A@ ENCODINGS_LIB_A = @ENCODINGS_LIB_A@ ENCODINGS_SRCS = @ENCODINGS_SRCS@ EXCEPTIONS_A = @EXCEPTIONS_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FISH_COMPLETIONS = @FISH_COMPLETIONS@ FORWARDING_A = @FORWARDING_A@ FORWARDING_LIB_A = @FORWARDING_LIB_A@ INVOCATION_A = @INVOCATION_A@ INVOCATION_LIB_A = @INVOCATION_LIB_A@ LIBBASES_M = @LIBBASES_M@ LIBOBJFWRT_DEP = @LIBOBJFWRT_DEP@ LIBOBJFWRT_DEP_LVL2 = @LIBOBJFWRT_DEP_LVL2@ LIBOBJFW_DEP = @LIBOBJFW_DEP@ LIBOBJFW_DEP_LVL2 = @LIBOBJFW_DEP_LVL2@ LINKLIB = @LINKLIB@ LOOKUP_ASM_A = @LOOKUP_ASM_A@ LOOKUP_ASM_LIB_A = @LOOKUP_ASM_LIB_A@ LOOKUP_ASM_AMIGALIB_A = @LOOKUP_ASM_AMIGALIB_A@ MAP_LDFLAGS = @MAP_LDFLAGS@ OFARC = @OFARC@ OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHTTP = @OFHTTP@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ |
︙ | ︙ |
Modified src/Makefile from [0e8eec5c83] to [d9efabcafe].
︙ | ︙ | |||
210 211 212 213 214 215 216 | OFKernelEventObserver.m \ ${OF_EPOLL_KERNEL_EVENT_OBSERVER_M} \ ${OF_KQUEUE_KERNEL_EVENT_OBSERVER_M} \ ${OF_POLL_KERNEL_EVENT_OBSERVER_M} \ ${OF_SELECT_KERNEL_EVENT_OBSERVER_M} \ OFTCPSocketSOCKS5Connector.m | | < < < > > | < < < > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | OFKernelEventObserver.m \ ${OF_EPOLL_KERNEL_EVENT_OBSERVER_M} \ ${OF_KQUEUE_KERNEL_EVENT_OBSERVER_M} \ ${OF_POLL_KERNEL_EVENT_OBSERVER_M} \ ${OF_SELECT_KERNEL_EVENT_OBSERVER_M} \ OFTCPSocketSOCKS5Connector.m OBJS_EXTRA = exceptions/exceptions.a \ encodings/encodings.a \ forwarding/forwarding.a LIB_OBJS_EXTRA = exceptions/exceptions.lib.a \ encodings/encodings.lib.a \ forwarding/forwarding.lib.a include ../buildsys.mk CPPFLAGS += -I. -I.. -Iexceptions -Iruntime LD = ${OBJC} FRAMEWORK_LIBS := -Fruntime \ ${RUNTIME_FRAMEWORK_LIBS} \ ${REEXPORT_RUNTIME_FRAMEWORK} \ ${LIBS} LIBS := -Lruntime ${RUNTIME_LIBS} ${REEXPORT_RUNTIME} ${LIBS} |
Modified src/OFApplication.m from [ba8b4a32b1] to [b8581aaf02].
︙ | ︙ | |||
256 257 258 259 260 261 262 | fprintf(stderr, "Warning: Invalid environment " "variable: %s\n", tmp.UTF8String); continue; } key = [tmp substringToIndex: pos]; | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | fprintf(stderr, "Warning: Invalid environment " "variable: %s\n", tmp.UTF8String); continue; } key = [tmp substringToIndex: pos]; value = [tmp substringFromIndex: pos + 1]; [_environment setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } |
︙ | ︙ |
Modified src/OFArray.m from [6e7407d49b] to [5b6a2f3354].
︙ | ︙ | |||
237 238 239 240 241 242 243 | for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } - (id const *)objects { size_t count = self.count; | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } - (id const *)objects { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { [self getObjects: buffer inRange: of_range(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count |
︙ | ︙ | |||
379 380 381 382 383 384 385 | range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) return [OFSubarray arrayWithArray: self range: range]; | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) return [OFSubarray arrayWithArray: self range: range]; buffer = of_alloc(range.length, sizeof(*buffer)); @try { [self getObjects: buffer inRange: range]; ret = [OFArray arrayWithObjects: buffer count: range.length]; } @finally { |
︙ | ︙ | |||
854 855 856 857 858 859 860 | } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block { OFArray *ret; size_t count = self.count; | | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block { OFArray *ret; size_t count = self.count; id *tmp = of_alloc(count, sizeof(id)); @try { [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { tmp[idx] = block(object, idx); }]; ret = [OFArray arrayWithObjects: tmp count: count]; } @finally { free(tmp); } return ret; } - (OFArray *)filteredArrayUsingBlock: (of_array_filter_block_t)block { OFArray *ret; size_t count = self.count; id *tmp = of_alloc(count, sizeof(id)); @try { __block size_t i = 0; [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { if (block(object, idx)) |
︙ | ︙ |
Modified src/OFBitSetCharacterSet.m from [a0186359ac] to [b1c313bb58].
︙ | ︙ | |||
36 37 38 39 40 41 42 | void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = string.characters; size_t length = string.length; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; | | | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = string.characters; size_t length = string.length; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (c / CHAR_BIT >= _size) { size_t newSize; if (UINT32_MAX - c < 1) @throw [OFOutOfRangeException exception]; newSize = OF_ROUND_UP_POW2(CHAR_BIT, c + 1) / CHAR_BIT; _bitset = of_realloc(_bitset, newSize, 1); memset(_bitset + _size, '\0', newSize - _size); _size = newSize; } |
︙ | ︙ | |||
72 73 74 75 76 77 78 | free(_bitset); [super dealloc]; } - (bool)characterIsMember: (of_unichar_t)character { | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 | free(_bitset); [super dealloc]; } - (bool)characterIsMember: (of_unichar_t)character { if (character / CHAR_BIT >= _size) return false; return of_bitset_isset(_bitset, character); } @end |
Modified src/OFBytesValue.m from [54953a495e] to [bf70f130e6].
︙ | ︙ | |||
27 28 29 30 31 32 33 | objCType: (const char *)objCType { self = [super init]; @try { _size = of_sizeof_type_encoding(objCType); _objCType = objCType; | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | objCType: (const char *)objCType { self = [super init]; @try { _size = of_sizeof_type_encoding(objCType); _objCType = objCType; _bytes = of_alloc(1, _size); memcpy(_bytes, bytes, _size); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/OFConstantString.m from [4db8f4cb59] to [1a5c26a192].
︙ | ︙ | |||
109 110 111 112 113 114 115 | { @synchronized (self) { struct of_string_utf8_ivars *ivars; if ([self isMemberOfClass: [OFConstantUTF8String class]]) return; | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | { @synchronized (self) { struct of_string_utf8_ivars *ivars; if ([self isMemberOfClass: [OFConstantUTF8String class]]) return; ivars = of_alloc_zeroed(1, sizeof(*ivars)); ivars->cString = _cString; ivars->cStringLength = _cStringLength; switch (of_string_utf8_check(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: ivars->isUTF8 = true; |
︙ | ︙ |
Modified src/OFDNSResolver.m from [3373845de9] to [2df523d351].
︙ | ︙ | |||
1134 1135 1136 1137 1138 1139 1140 | [context->_TCPSocket release]; context->_TCPSocket = nil; context->_responseLength = 0; return nil; } if (context->_TCPBuffer == nil) | | | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | [context->_TCPSocket release]; context->_TCPSocket = nil; context->_responseLength = 0; return nil; } if (context->_TCPBuffer == nil) context->_TCPBuffer = of_alloc(MAX_DNS_RESPONSE_LENGTH, 1); [sock asyncReadIntoBuffer: context->_TCPBuffer exactLength: 2]; return nil; } - (bool)stream: (OFStream *)stream |
︙ | ︙ |
Modified src/OFData.m from [c84ec47cce] to [86e2a3f40f].
︙ | ︙ | |||
128 129 130 131 132 133 134 | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; _items = of_alloc(count, itemSize); _count = count; _itemSize = itemSize; _freeWhenDone = true; memcpy(_items, items, count * itemSize); } @catch (id e) { [self release]; |
︙ | ︙ | |||
192 193 194 195 196 197 198 | attributesOfItemAtPath: path].fileSize; # if ULLONG_MAX > SIZE_MAX if (size > SIZE_MAX) @throw [OFOutOfRangeException exception]; # endif | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | attributesOfItemAtPath: path].fileSize; # if ULLONG_MAX > SIZE_MAX if (size > SIZE_MAX) @throw [OFOutOfRangeException exception]; # endif buffer = of_alloc((size_t)size, 1); file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { [file readIntoBuffer: buffer exactLength: (size_t)size]; } @finally { [file release]; |
︙ | ︙ | |||
244 245 246 247 248 249 250 | mode: @"r"]; _count = 0; _itemSize = 1; _freeWhenDone = true; pageSize = [OFSystemInfo pageSize]; | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | mode: @"r"]; _count = 0; _itemSize = 1; _freeWhenDone = true; pageSize = [OFSystemInfo pageSize]; buffer = of_alloc(1, pageSize); @try { while (!stream.atEndOfStream) { size_t length = [stream readIntoBuffer: buffer length: pageSize]; |
︙ | ︙ | |||
287 288 289 290 291 292 293 | const char *cString; if (count % 2 != 0) @throw [OFInvalidFormatException exception]; count /= 2; | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | const char *cString; if (count % 2 != 0) @throw [OFInvalidFormatException exception]; count /= 2; _items = of_alloc(count, 1); _count = count; _itemSize = 1; _freeWhenDone = true; cString = [string cStringWithEncoding: OF_STRING_ENCODING_ASCII]; |
︙ | ︙ |
Modified src/OFDate.m from [cf1b1da641] to [2f04475c25].
︙ | ︙ | |||
775 776 777 778 779 780 781 | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = of_alloc(1, pageSize); @try { #ifndef OF_WINDOWS if (strftime(buffer, pageSize, format.UTF8String, &tm) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; #else |
︙ | ︙ | |||
835 836 837 838 839 840 841 | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; | | | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = of_alloc(1, pageSize); @try { #ifndef OF_WINDOWS if (strftime(buffer, pageSize, format.UTF8String, &tm) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; #else |
︙ | ︙ |
Modified src/OFFile.m from [edd10634f5] to [23492381a4].
︙ | ︙ | |||
239 240 241 242 243 244 245 | if (handle == -1) @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno]; #else | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | if (handle == -1) @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno]; #else handle = of_alloc(1, sizeof(*handle)); @try { if ((flags = parseMode(mode.UTF8String, &handle->append)) == -1) @throw [OFInvalidArgumentException exception]; if ((handle->handle = Open([path cStringWithEncoding: [OFLocale encoding]], flags)) == 0) { |
︙ | ︙ |
Modified src/OFFileManager.m from [50c6f8c9c9] to [97ff5cb871].
︙ | ︙ | |||
661 662 663 664 665 666 667 | } } else if ([type isEqual: of_file_type_regular]) { size_t pageSize = [OFSystemInfo pageSize]; OFStream *sourceStream = nil; OFStream *destinationStream = nil; char *buffer; | | | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | } } else if ([type isEqual: of_file_type_regular]) { size_t pageSize = [OFSystemInfo pageSize]; OFStream *sourceStream = nil; OFStream *destinationStream = nil; char *buffer; buffer = of_alloc(1, pageSize); @try { sourceStream = [[OFURLHandler handlerForURL: source] openItemAtURL: source mode: @"r"]; destinationStream = [[OFURLHandler handlerForURL: destination] openItemAtURL: destination mode: @"w"]; |
︙ | ︙ |
Modified src/OFFileURLHandler.m from [987947edfd] to [9e0a7e3741].
︙ | ︙ | |||
733 734 735 736 737 738 739 | lastAccessDate.timeIntervalSince1970; of_time_interval_t modificationTime = modificationDate.timeIntervalSince1970; struct timeval times[2] = { { .tv_sec = (time_t)lastAccessTime, .tv_usec = | | < | > | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | lastAccessDate.timeIntervalSince1970; of_time_interval_t modificationTime = modificationDate.timeIntervalSince1970; struct timeval times[2] = { { .tv_sec = (time_t)lastAccessTime, .tv_usec = (int)((lastAccessTime - times[0].tv_sec) * 1000000) }, { .tv_sec = (time_t)modificationTime, .tv_usec = (int)((modificationTime - times[1].tv_sec) * 1000000) }, }; if (utimes([path cStringWithEncoding: [OFLocale encoding]], times) != 0) @throw [OFSetItemAttributesFailedException exceptionWithURL: URL attributes: attributes |
︙ | ︙ |
Modified src/OFHTTPClient.m from [72f7071464] to [5174ef54a9].
︙ | ︙ | |||
511 512 513 514 515 516 517 | } lineC = line.UTF8String; if ((tmp = strchr(lineC, ':')) == NULL) @throw [OFInvalidServerReplyException exception]; | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | } lineC = line.UTF8String; if ((tmp = strchr(lineC, ':')) == NULL) @throw [OFInvalidServerReplyException exception]; keyC = of_alloc(tmp - lineC + 1, 1); memcpy(keyC, lineC, tmp - lineC); keyC[tmp - lineC] = '\0'; normalizeKey(keyC); @try { key = [OFString stringWithUTF8StringNoCopy: keyC freeWhenDone: true]; |
︙ | ︙ |
Modified src/OFInflateStream.m from [b112db9229] to [95c86a8053].
︙ | ︙ | |||
192 193 194 195 196 197 198 | _bitIndex = 8; #ifdef OF_INFLATE64_STREAM_M _slidingWindowMask = 0xFFFF; #else _slidingWindowMask = 0x7FFF; #endif | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | _bitIndex = 8; #ifdef OF_INFLATE64_STREAM_M _slidingWindowMask = 0xFFFF; #else _slidingWindowMask = 0x7FFF; #endif _slidingWindow = of_alloc_zeroed(_slidingWindowMask + 1, 1); } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
376 377 378 379 380 381 382 | if OF_UNLIKELY (!tryReadBits(self, &bits, 4)) return bytesWritten; CTX.codeLenCodesCount = bits; } if OF_LIKELY (CTX.lengths == NULL) | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | if OF_UNLIKELY (!tryReadBits(self, &bits, 4)) return bytesWritten; CTX.codeLenCodesCount = bits; } if OF_LIKELY (CTX.lengths == NULL) CTX.lengths = of_alloc_zeroed(19, 1); for (uint16_t i = CTX.receivedCount; i < CTX.codeLenCodesCount + 4; i++) { if OF_UNLIKELY (!tryReadBits(self, &bits, 3)) { CTX.receivedCount = i; return bytesWritten; } |
︙ | ︙ | |||
399 400 401 402 403 404 405 | free(CTX.lengths); CTX.lengths = NULL; CTX.receivedCount = 0; CTX.value = 0xFF; } if OF_LIKELY (CTX.lengths == NULL) | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | free(CTX.lengths); CTX.lengths = NULL; CTX.receivedCount = 0; CTX.value = 0xFF; } if OF_LIKELY (CTX.lengths == NULL) CTX.lengths = of_alloc( CTX.litLenCodesCount + CTX.distCodesCount + 258, 1); for (uint16_t i = CTX.receivedCount; i < CTX.litLenCodesCount + CTX.distCodesCount + 258;) { uint8_t j, count; if OF_LIKELY (CTX.value == 0xFF) { |
︙ | ︙ |
Modified src/OFKernelEventObserver.h from [74da8f3153] to [e557d74842].
︙ | ︙ | |||
120 121 122 123 124 125 126 | @interface OFKernelEventObserver: OFObject { OFMutableArray OF_GENERIC(id <OFReadyForReadingObserving>) *_readObjects; OFMutableArray OF_GENERIC(id <OFReadyForWritingObserving>) *_writeObjects; id <OFKernelEventObserverDelegate> _Nullable _delegate; | | < < > > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | @interface OFKernelEventObserver: OFObject { OFMutableArray OF_GENERIC(id <OFReadyForReadingObserving>) *_readObjects; OFMutableArray OF_GENERIC(id <OFReadyForWritingObserving>) *_writeObjects; id <OFKernelEventObserverDelegate> _Nullable _delegate; #if defined(OF_AMIGAOS) struct Task *_waitingTask; ULONG _cancelSignal; #elif defined(OF_HAVE_PIPE) int _cancelFD[2]; #else of_socket_t _cancelFD[2]; struct sockaddr_in _cancelAddr; #endif #ifdef OF_AMIGAOS ULONG _execSignalMask; #endif |
︙ | ︙ |
Modified src/OFKernelEventObserver.m from [0cbb2bba17] to [451fcb3cdf].
︙ | ︙ | |||
111 112 113 114 115 116 117 | !defined(OF_NINTENDO_3DS) socklen_t cancelAddrLen; #endif _readObjects = [[OFMutableArray alloc] init]; _writeObjects = [[OFMutableArray alloc] init]; | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | !defined(OF_NINTENDO_3DS) socklen_t cancelAddrLen; #endif _readObjects = [[OFMutableArray alloc] init]; _writeObjects = [[OFMutableArray alloc] init]; #if defined(OF_HAVE_PIPE) && !defined(OF_AMIGAOS) if (pipe(_cancelFD)) @throw [OFInitializationFailedException exceptionWithClass: self.class]; #elif !defined(OF_AMIGAOS) _cancelFD[0] = _cancelFD[1] = socket(AF_INET, SOCK_DGRAM, 0); if (_cancelFD[0] == INVALID_SOCKET) |
︙ | ︙ | |||
172 173 174 175 176 177 178 | } return self; } - (void)dealloc { | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | } return self; } - (void)dealloc { #if defined(OF_HAVE_PIPE) && !defined(OF_AMIGAOS) close(_cancelFD[0]); if (_cancelFD[1] != _cancelFD[0]) close(_cancelFD[1]); #elif !defined(OF_AMIGAOS) closesocket(_cancelFD[0]); if (_cancelFD[1] != _cancelFD[0]) closesocket(_cancelFD[1]); |
︙ | ︙ | |||
255 256 257 258 259 260 261 | - (void)observeUntilDate: (OFDate *)date { [self observeForTimeInterval: date.timeIntervalSinceNow]; } - (void)cancel { | | < < > > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - (void)observeUntilDate: (OFDate *)date { [self observeForTimeInterval: date.timeIntervalSinceNow]; } - (void)cancel { #if defined(OF_AMIGAOS) Forbid(); if (_waitingTask != NULL) { Signal(_waitingTask, (1ul << _cancelSignal)); _waitingTask = NULL; } Permit(); #elif defined(OF_HAVE_PIPE) OF_ENSURE(write(_cancelFD[1], "", 1) > 0); #elif defined(OF_WII) OF_ENSURE(sendto(_cancelFD[1], "", 1, 0, (struct sockaddr *)&_cancelAddr, 8) > 0); #else OF_ENSURE(sendto(_cancelFD[1], (void *)"", 1, 0, (struct sockaddr *)&_cancelAddr, sizeof(_cancelAddr)) > 0); #endif } @end |
Modified src/OFLHADecompressingStream.m from [548b68c743] to [9b1fbea443].
︙ | ︙ | |||
106 107 108 109 110 111 112 | /* 0-7 address the bit, 8 means fetch next byte */ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; _slidingWindowMask = (1u << dictionaryBits) - 1; | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /* 0-7 address the bit, 8 means fetch next byte */ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; _slidingWindowMask = (1u << dictionaryBits) - 1; _slidingWindow = of_alloc(_slidingWindowMask + 1, 1); memset(_slidingWindow, ' ', _slidingWindowMask + 1); } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
173 174 175 176 177 178 179 | if OF_UNLIKELY (bits == 0) { _state = STATE_CODE_LEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if OF_UNLIKELY (bits == 0) { _state = STATE_CODE_LEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_alloc_zeroed(bits, 1); _skip = true; _state = STATE_CODE_LEN_TREE; goto start; case STATE_CODE_LEN_TREE: while (_codesReceived < _codesCount) { if OF_UNLIKELY (_currentIsExtendedLength) { |
︙ | ︙ | |||
254 255 256 257 258 259 260 | _state = STATE_LITLEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | _state = STATE_LITLEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_alloc_zeroed(bits, 1); _skip = false; _treeIter = _codeLenTree; _state = STATE_LITLEN_TREE; goto start; case STATE_LITLEN_TREE: while (_codesReceived < _codesCount) { |
︙ | ︙ | |||
344 345 346 347 348 349 350 | if OF_UNLIKELY (bits == 0) { _state = STATE_DIST_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; | | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | if OF_UNLIKELY (bits == 0) { _state = STATE_DIST_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; _codesLengths = of_alloc_zeroed(bits, 1); _treeIter = _codeLenTree; _state = STATE_DIST_TREE; goto start; case STATE_DIST_TREE: while (_codesReceived < _codesCount) { if OF_UNLIKELY (_currentIsExtendedLength) { |
︙ | ︙ |
Modified src/OFList.m from [17f16f253f] to [5f900e9ac3].
︙ | ︙ | |||
93 94 95 96 97 98 99 | [super dealloc]; } - (of_list_object_t *)appendObject: (id)object { of_list_object_t *listObject; | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | [super dealloc]; } - (of_list_object_t *)appendObject: (id)object { of_list_object_t *listObject; listObject = of_alloc(1, sizeof(of_list_object_t)); listObject->object = [object retain]; listObject->next = NULL; listObject->previous = _lastListObject; if (_lastListObject != NULL) _lastListObject->next = listObject; |
︙ | ︙ | |||
116 117 118 119 120 121 122 | return listObject; } - (of_list_object_t *)prependObject: (id)object { of_list_object_t *listObject; | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | return listObject; } - (of_list_object_t *)prependObject: (id)object { of_list_object_t *listObject; listObject = of_alloc(1, sizeof(of_list_object_t)); listObject->object = [object retain]; listObject->next = _firstListObject; listObject->previous = NULL; if (_firstListObject != NULL) _firstListObject->previous = listObject; |
︙ | ︙ | |||
139 140 141 142 143 144 145 | } - (of_list_object_t *)insertObject: (id)object beforeListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | } - (of_list_object_t *)insertObject: (id)object beforeListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; newListObject = of_alloc(1, sizeof(of_list_object_t)); newListObject->object = [object retain]; newListObject->next = listObject; newListObject->previous = listObject->previous; if (listObject->previous != NULL) listObject->previous->next = newListObject; |
︙ | ︙ | |||
163 164 165 166 167 168 169 | } - (of_list_object_t *)insertObject: (id)object afterListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | } - (of_list_object_t *)insertObject: (id)object afterListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; newListObject = of_alloc(1, sizeof(of_list_object_t)); newListObject->object = [object retain]; newListObject->next = listObject->next; newListObject->previous = listObject; if (listObject->next != NULL) listObject->next->previous = newListObject; |
︙ | ︙ | |||
297 298 299 300 301 302 303 | listObject = NULL; previous = NULL; @try { for (of_list_object_t *iter = _firstListObject; iter != NULL; iter = iter->next) { | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | listObject = NULL; previous = NULL; @try { for (of_list_object_t *iter = _firstListObject; iter != NULL; iter = iter->next) { listObject = of_alloc(1, sizeof(of_list_object_t)); listObject->object = [iter->object retain]; listObject->next = NULL; listObject->previous = previous; if (copy->_firstListObject == NULL) copy->_firstListObject = listObject; if (previous != NULL) |
︙ | ︙ |
Modified src/OFMapTable.m from [bb1c57067e] to [6adf8ae2bb].
︙ | ︙ | |||
159 160 161 162 163 164 165 | if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; _buckets = of_alloc_zeroed(_capacity, sizeof(*_buckets)); if (of_hash_seed != 0) _rotate = of_random16() & 31; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
321 322 323 324 325 326 327 | /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; buckets = of_alloc_zeroed(capacity, sizeof(*buckets)); for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { unsigned long j, last; last = capacity; |
︙ | ︙ | |||
410 411 412 413 414 415 416 | for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; bucket = of_alloc(1, sizeof(*bucket)); @try { bucket->key = _keyFunctions.retain(key); } @catch (id e) { free(bucket); @throw e; } |
︙ | ︙ |
Modified src/OFMapTableDictionary.m from [afa073ac3b] to [3854d30085].
︙ | ︙ | |||
340 341 342 343 344 345 346 | - (OFArray *)allKeys { OFArray *ret; id *keys; size_t count; count = _mapTable.count; | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - (OFArray *)allKeys { OFArray *ret; id *keys; size_t count; count = _mapTable.count; keys = of_alloc(count, sizeof(*keys)); @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **keyPtr; size_t i; |
︙ | ︙ | |||
374 375 376 377 378 379 380 | - (OFArray *)allObjects { OFArray *ret; id *objects; size_t count; count = _mapTable.count; | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - (OFArray *)allObjects { OFArray *ret; id *objects; size_t count; count = _mapTable.count; objects = of_alloc(count, sizeof(*objects)); @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **objectPtr; size_t i; |
︙ | ︙ |
Modified src/OFMethodSignature.m from [67a687aa14] to [69e0a6b22a].
︙ | ︙ | |||
593 594 595 596 597 598 599 | @throw [OFInvalidArgumentException exception]; length = strlen(types); if (length == 0) @throw [OFInvalidFormatException exception]; | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | @throw [OFInvalidArgumentException exception]; length = strlen(types); if (length == 0) @throw [OFInvalidFormatException exception]; _types = of_alloc(length + 1, 1); memcpy(_types, types, length); _typesPointers = [[OFMutableData alloc] initWithItemSize: sizeof(char *)]; _offsets = [[OFMutableData alloc] initWithItemSize: sizeof(size_t)]; |
︙ | ︙ |
Modified src/OFMutableAdjacentArray.m from [73c0aec03a] to [40b1b9e5f0].
︙ | ︙ | |||
239 240 241 242 243 244 245 | size_t count = _array.count; id *copy; if (range.length > SIZE_MAX - range.location || range.location >= count || range.length > count - range.location) @throw [OFOutOfRangeException exception]; | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | size_t count = _array.count; id *copy; if (range.length > SIZE_MAX - range.location || range.location >= count || range.length > count - range.location) @throw [OFOutOfRangeException exception]; copy = of_alloc(range.length, sizeof(*copy)); memcpy(copy, objects + range.location, range.length * sizeof(id)); @try { [_array removeItemsInRange: range]; _mutations++; for (size_t i = 0; i < range.length; i++) |
︙ | ︙ |
Modified src/OFMutableData.m from [8aa04f6052] to [c52dab0d6d].
︙ | ︙ | |||
90 91 92 93 94 95 96 | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; _items = of_alloc(capacity, itemSize); _itemSize = itemSize; _capacity = capacity; _freeWhenDone = true; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/OFMutableSet.m from [247e02065c] to [4037992100].
︙ | ︙ | |||
168 169 170 171 172 173 174 | - (void)intersectSet: (OFSet *)set { void *pool = objc_autoreleasePoolPush(); size_t count = self.count; id *cArray; | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - (void)intersectSet: (OFSet *)set { void *pool = objc_autoreleasePoolPush(); size_t count = self.count; id *cArray; cArray = of_alloc(count, sizeof(id)); @try { size_t i; i = 0; for (id object in self) { assert(i < count); cArray[i++] = object; |
︙ | ︙ |
Modified src/OFMutableUTF8String.m from [e2512a1c1d] to [32655d5053].
︙ | ︙ | |||
97 98 99 100 101 102 103 | _s->cString[i] = t; } return; } unicodeLen = self.length; | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | _s->cString[i] = t; } return; } unicodeLen = self.length; unicodeString = of_alloc(unicodeLen, sizeof(of_unichar_t)); i = j = 0; newCStringLength = 0; while (i < _s->cStringLength) { const of_unichar_t *const *table; size_t tableSize; |
︙ | ︙ | |||
151 152 153 154 155 156 157 | @throw [OFInvalidEncodingException exception]; } i += cLen; } @try { | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | @throw [OFInvalidEncodingException exception]; } i += cLen; } @try { newCString = of_alloc(newCStringLength + 1, 1); } @catch (id e) { free(unicodeString); @throw e; } j = 0; |
︙ | ︙ | |||
371 372 373 374 375 376 377 | } else _s->isUTF8 = true; } - (void)appendCharacters: (const of_unichar_t *)characters length: (size_t)length { | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | } else _s->isUTF8 = true; } - (void)appendCharacters: (const of_unichar_t *)characters length: (size_t)length { char *tmp = of_alloc((length * 4) + 1, 1); @try { size_t j = 0; bool isUTF8 = false; for (size_t i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], |
︙ | ︙ |
Modified src/OFObject+KeyValueCoding.m from [060fc086b7] to [8a9fc8e1ab].
︙ | ︙ | |||
46 47 48 49 50 51 52 | char *name; if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); return [self valueForUndefinedKey: key]; } | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | char *name; if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); return [self valueForUndefinedKey: key]; } name = of_alloc(keyLength + 3, 1); @try { memcpy(name, "is", 2); memcpy(name + 2, key.UTF8String, keyLength); name[keyLength + 2] = '\0'; name[2] = of_ascii_toupper(name[2]); |
︙ | ︙ | |||
158 159 160 161 162 163 164 | if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); [self setValue: value forUndefinedKey: key]; return; } | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); [self setValue: value forUndefinedKey: key]; return; } name = of_alloc(keyLength + 5, 1); @try { memcpy(name, "set", 3); memcpy(name + 3, key.UTF8String, keyLength); memcpy(name + keyLength + 3, ":", 2); name[3] = of_ascii_toupper(name[3]); |
︙ | ︙ |
Modified src/OFObject.h from [3aacd2e524] to [ec746b369b].
︙ | ︙ | |||
1235 1236 1237 1238 1239 1240 1241 | @end #endif #ifdef __cplusplus extern "C" { #endif /** | | > | | | | | | 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | @end #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Allocates memory for the specified number of items of the specified * size. * * To free the allocated memory, use `free()`. * * Throws @ref OFOutOfMemoryException if allocating failed and * @ref OFOutOfRangeException if the requested size exceeds the address space. * * @param count The number of items to allocate * @param size The size of each item to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. */ extern void *_Nullable of_alloc(size_t count, size_t size) OF_WARN_UNUSED_RESULT; /** * @brief Allocates memory for the specified number of items of the specified * size and initializes it with zeros. * * To free the allocated memory, use `free()`. * * Throws @ref OFOutOfMemoryException if allocating failed and * @ref OFOutOfRangeException if the requested size exceeds the address space. * * @param size The size of each item to allocate * @param count The number of items to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. */ extern void *_Nullable of_alloc_zeroed(size_t count, size_t size) OF_WARN_UNUSED_RESULT; /** * @brief Resizes memory to the specified number of items of the specified size. * * To free the allocated memory, use `free()`. * * If the pointer is NULL, this is equivalent to allocating memory. * If the size or number of items is 0, this is equivalent to freeing memory. * * Throws @ref OFOutOfMemoryException if allocating failed and |
︙ | ︙ |
Modified src/OFObject.m from [e2e795413b] to [dfafb38c1f].
︙ | ︙ | |||
95 96 97 98 99 100 101 | static struct { Class isa; } allocFailedException; uint32_t of_hash_seed; void * | | | | 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 | static struct { Class isa; } allocFailedException; uint32_t of_hash_seed; void * of_alloc(size_t count, size_t size) { void *pointer; if OF_UNLIKELY (count == 0 || size == 0) return NULL; if OF_UNLIKELY (count > SIZE_MAX / size) @throw [OFOutOfRangeException exception]; if OF_UNLIKELY ((pointer = malloc(count * size)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: size]; return pointer; } void * of_alloc_zeroed(size_t count, size_t size) { void *pointer; if OF_UNLIKELY (count == 0 || size == 0) return NULL; /* Not all calloc implementations check for overflow. */ |
︙ | ︙ |
Modified src/OFOptionsParser.m from [93ab00cf42] to [a5d08e3dd3].
︙ | ︙ | |||
82 83 84 85 86 87 88 | *iter->isSpecifiedPtr = false; if (iter->argumentPtr) *iter->argumentPtr = nil; count++; } | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | *iter->isSpecifiedPtr = false; if (iter->argumentPtr) *iter->argumentPtr = nil; count++; } _options = of_alloc(count + 1, sizeof(*_options)); _longOptions = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions]; for (iter = options, iter2 = _options; iter->shortOption != '\0' || iter->longOption != nil; iter++, iter2++) { |
︙ | ︙ |
Modified src/OFPollKernelEventObserver.m from [4cf3bcee3f] to [f6b8ae522e].
︙ | ︙ | |||
48 49 50 51 52 53 54 | struct pollfd p = { _cancelFD[0], POLLIN, 0 }; _FDs = [[OFMutableData alloc] initWithItemSize: sizeof(struct pollfd)]; [_FDs addItem: &p]; _maxFD = _cancelFD[0]; | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | struct pollfd p = { _cancelFD[0], POLLIN, 0 }; _FDs = [[OFMutableData alloc] initWithItemSize: sizeof(struct pollfd)]; [_FDs addItem: &p]; _maxFD = _cancelFD[0]; _FDToObject = of_alloc((size_t)_maxFD + 1, sizeof(id)); } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |
Modified src/OFSecureData.m from [8a522b1fcf] to [7de8ab3a25].
︙ | ︙ | |||
97 98 99 100 101 102 103 | munmap(pointer, numPages * pageSize); } static struct page * addPage(bool allowPreallocated) { size_t pageSize = [OFSystemInfo pageSize]; | | > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | munmap(pointer, numPages * pageSize); } static struct page * addPage(bool allowPreallocated) { size_t pageSize = [OFSystemInfo pageSize]; size_t mapSize = OF_ROUND_UP_POW2(CHAR_BIT, pageSize / CHUNK_SIZE) / CHAR_BIT; struct page *page; # if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) struct page *lastPage; # endif if (allowPreallocated) { # if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) |
︙ | ︙ | |||
136 137 138 139 140 141 142 | # endif } return page; } } | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # endif } return page; } } page = of_alloc(1, sizeof(*page)); @try { page->map = of_alloc_zeroed(1, mapSize); } @catch (id e) { free(page); @throw e; } @try { page->page = mapPages(1); } @catch (id e) { |
︙ | ︙ | |||
182 183 184 185 186 187 188 | } static void removePageIfEmpty(struct page *page) { unsigned char *map = page->map; size_t pageSize = [OFSystemInfo pageSize]; | | > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | } static void removePageIfEmpty(struct page *page) { unsigned char *map = page->map; size_t pageSize = [OFSystemInfo pageSize]; size_t mapSize = OF_ROUND_UP_POW2(CHAR_BIT, pageSize / CHUNK_SIZE) / CHAR_BIT; for (size_t i = 0; i < mapSize; i++) if (map[i] != 0) return; unmapPages(page->page, 1); free(page->map); |
︙ | ︙ | |||
290 291 292 293 294 295 296 | size_t numPreallocatedPages; # endif size_t i; if (preallocatedPages != NULL) @throw [OFInvalidArgumentException exception]; | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | size_t numPreallocatedPages; # endif size_t i; if (preallocatedPages != NULL) @throw [OFInvalidArgumentException exception]; preallocatedPages = of_alloc_zeroed(numPages, sizeof(struct page)); # if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) of_tlskey_set(preallocatedPagesKey, preallocatedPages); # endif @try { for (i = 0; i < numPages; i++) preallocatedPages[i] = addPage(false); |
︙ | ︙ | |||
411 412 413 414 415 416 417 | size_t pageSize = [OFSystemInfo pageSize]; #endif if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { | | | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | size_t pageSize = [OFSystemInfo pageSize]; #endif if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { _items = of_alloc(count, itemSize); _freeWhenDone = true; memset(_items, 0, count * itemSize); #if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON) } else if (count * itemSize >= pageSize) _items = mapPages(OF_ROUND_UP_POW2(pageSize, count * itemSize) / pageSize); else { |
︙ | ︙ |
Modified src/OFSelectKernelEventObserver.m from [22b01117bc] to [73642ffd8c].
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | @implementation OFSelectKernelEventObserver - (instancetype)init { self = [super init]; @try { #ifdef OF_AMIGAOS _maxFD = 0; #else # ifndef OF_WINDOWS if (_cancelFD[0] >= (int)FD_SETSIZE) @throw [OFInitializationFailedException exceptionWithClass: self.class]; # endif | > > > < < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | @implementation OFSelectKernelEventObserver - (instancetype)init { self = [super init]; @try { FD_ZERO(&_readFDs); FD_ZERO(&_writeFDs); #ifdef OF_AMIGAOS _maxFD = 0; #else # ifndef OF_WINDOWS if (_cancelFD[0] >= (int)FD_SETSIZE) @throw [OFInitializationFailedException exceptionWithClass: self.class]; # endif FD_SET(_cancelFD[0], &_readFDs); if (_cancelFD[0] > INT_MAX) @throw [OFOutOfRangeException exception]; _maxFD = (int)_cancelFD[0]; #endif |
︙ | ︙ | |||
168 169 170 171 172 173 174 | - (void)observeForTimeInterval: (of_time_interval_t)timeInterval { fd_set readFDs; fd_set writeFDs; struct timeval timeout; int events; #ifdef OF_AMIGAOS | > | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | - (void)observeForTimeInterval: (of_time_interval_t)timeInterval { fd_set readFDs; fd_set writeFDs; struct timeval timeout; int events; #ifdef OF_AMIGAOS BYTE cancelSignal; ULONG execSignalMask; #endif void *pool; if ([self of_processReadBuffers]) return; #ifdef FD_COPY |
︙ | ︙ | |||
194 195 196 197 198 199 200 | * satisfy the required range, we just cast to int. */ #ifndef OF_WINDOWS timeout.tv_sec = (time_t)timeInterval; #else timeout.tv_sec = (long)timeInterval; #endif | | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | * satisfy the required range, we just cast to int. */ #ifndef OF_WINDOWS timeout.tv_sec = (time_t)timeInterval; #else timeout.tv_sec = (long)timeInterval; #endif timeout.tv_usec = (int)((timeInterval - timeout.tv_sec) * 1000000); #ifdef OF_AMIGAOS if ((cancelSignal = AllocSignal(-1)) == (BYTE)-1) @throw [OFObserveFailedException exceptionWithObserver: self errNo: EAGAIN]; execSignalMask = _execSignalMask | (1ul << cancelSignal); Forbid(); |
︙ | ︙ |
Modified src/OFStream.m from [b13d6173e0] to [c6022abcb0].
︙ | ︙ | |||
147 148 149 150 151 152 153 | bytesRead = [self lowlevelReadIntoBuffer: tmp length: MIN_READ_SIZE]; if (bytesRead > length) { memcpy(buffer, tmp, length); | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | bytesRead = [self lowlevelReadIntoBuffer: tmp length: MIN_READ_SIZE]; if (bytesRead > length) { memcpy(buffer, tmp, length); readBuffer = of_alloc(bytesRead - length, 1); memcpy(readBuffer, tmp + length, bytesRead - length); _readBuffer = _readBufferMemory = readBuffer; _readBufferLength = bytesRead - length; return length; |
︙ | ︙ | |||
639 640 641 642 643 644 645 | { OFData *ret; char *buffer; if OF_UNLIKELY (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; | | | | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | { OFData *ret; char *buffer; if OF_UNLIKELY (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; buffer = of_alloc(count, itemSize); @try { [self readIntoBuffer: buffer exactLength: count * itemSize]; ret = [OFData dataWithItemsNoCopy: buffer count: count itemSize: itemSize freeWhenDone: true]; } @catch (id e) { free(buffer); @throw e; } return ret; } - (OFData *)readDataUntilEndOfStream { OFMutableData *data = [OFMutableData data]; size_t pageSize = [OFSystemInfo pageSize]; char *buffer = of_alloc(1, pageSize); @try { while (!self.atEndOfStream) { size_t length; length = [self readIntoBuffer: buffer length: pageSize]; |
︙ | ︙ | |||
690 691 692 693 694 695 696 | encoding: OF_STRING_ENCODING_UTF_8]; } - (OFString *)readStringWithLength: (size_t)length encoding: (of_string_encoding_t)encoding { OFString *ret; | | | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | encoding: OF_STRING_ENCODING_UTF_8]; } - (OFString *)readStringWithLength: (size_t)length encoding: (of_string_encoding_t)encoding { OFString *ret; char *buffer = of_alloc(length + 1, 1); buffer[length] = 0; @try { [self readIntoBuffer: buffer exactLength: length]; ret = [OFString stringWithCString: buffer |
︙ | ︙ | |||
737 738 739 740 741 742 743 | return ret; } } } /* Read and see if we got a newline or \0 */ pageSize = [OFSystemInfo pageSize]; | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | return ret; } } } /* Read and see if we got a newline or \0 */ pageSize = [OFSystemInfo pageSize]; buffer = of_alloc(1, pageSize); @try { if ([self lowlevelIsAtEndOfStream]) { size_t retLength; if (_readBuffer == NULL) { _waitingForDelimiter = false; |
︙ | ︙ | |||
773 774 775 776 777 778 779 | length: pageSize]; /* Look if there's a newline or \0 */ for (size_t i = 0; i < bufferLength; i++) { if OF_UNLIKELY (buffer[i] == '\n' || buffer[i] == '\0') { size_t retLength = _readBufferLength + i; | | | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | length: pageSize]; /* Look if there's a newline or \0 */ for (size_t i = 0; i < bufferLength; i++) { if OF_UNLIKELY (buffer[i] == '\n' || buffer[i] == '\0') { size_t retLength = _readBufferLength + i; char *retCString = of_alloc(retLength, 1); if (_readBuffer != NULL) memcpy(retCString, _readBuffer, _readBufferLength); memcpy(retCString + _readBufferLength, buffer, i); |
︙ | ︙ | |||
796 797 798 799 800 801 802 | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ | | | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ readBuffer = of_alloc( _readBufferLength + bufferLength, 1); memcpy(readBuffer, _readBuffer, _readBufferLength); memcpy(readBuffer + _readBufferLength, |
︙ | ︙ | |||
818 819 820 821 822 823 824 | } @throw e; } @finally { free(retCString); } | | | | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | } @throw e; } @finally { free(retCString); } readBuffer = of_alloc(bufferLength - i - 1, 1); if (readBuffer != NULL) memcpy(readBuffer, buffer + i + 1, bufferLength - i - 1); free(_readBufferMemory); _readBuffer = _readBufferMemory = readBuffer; _readBufferLength = bufferLength - i - 1; _waitingForDelimiter = false; return ret; } } /* There was no newline or \0 */ if (bufferLength > 0) { readBuffer = of_alloc(_readBufferLength + bufferLength, 1); memcpy(readBuffer, _readBuffer, _readBufferLength); memcpy(readBuffer + _readBufferLength, buffer, bufferLength); free(_readBufferMemory); |
︙ | ︙ | |||
975 976 977 978 979 980 981 | return ret; } } } /* Read and see if we got a delimiter or \0 */ pageSize = [OFSystemInfo pageSize]; | | | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | return ret; } } } /* Read and see if we got a delimiter or \0 */ pageSize = [OFSystemInfo pageSize]; buffer = of_alloc(1, pageSize); @try { if ([self lowlevelIsAtEndOfStream]) { if (_readBuffer == NULL) { _waitingForDelimiter = false; return nil; } |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | char *retCString; if (buffer[i] == '\0') delimiterLength = 1; retLength = _readBufferLength + i + 1 - delimiterLength; | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | char *retCString; if (buffer[i] == '\0') delimiterLength = 1; retLength = _readBufferLength + i + 1 - delimiterLength; retCString = of_alloc(retLength, 1); if (_readBuffer != NULL && _readBufferLength <= retLength) memcpy(retCString, _readBuffer, _readBufferLength); else if (_readBuffer != NULL) memcpy(retCString, _readBuffer, |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ | | | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ readBuffer = of_alloc( _readBufferLength + bufferLength, 1); memcpy(readBuffer, _readBuffer, _readBufferLength); memcpy(readBuffer + _readBufferLength, |
︙ | ︙ | |||
1059 1060 1061 1062 1063 1064 1065 | } @throw e; } @finally { free(retCString); } | | | | 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | } @throw e; } @finally { free(retCString); } readBuffer = of_alloc(bufferLength - i - 1, 1); if (readBuffer != NULL) memcpy(readBuffer, buffer + i + 1, bufferLength - i - 1); free(_readBufferMemory); _readBuffer = _readBufferMemory = readBuffer; _readBufferLength = bufferLength - i - 1; _waitingForDelimiter = false; return ret; } } /* Neither the delimiter nor \0 was found */ if (bufferLength > 0) { readBuffer = of_alloc(_readBufferLength + bufferLength, 1); memcpy(readBuffer, _readBuffer, _readBufferLength); memcpy(readBuffer + _readBufferLength, buffer, bufferLength); free(_readBufferMemory); |
︙ | ︙ | |||
1332 1333 1334 1335 1336 1337 1338 | size = count * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | size = count * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint16_t *tmp = of_alloc(count, sizeof(uint16_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | size = count * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | size = count * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint32_t *tmp = of_alloc(count, sizeof(uint32_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 | size = count * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | size = count * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint64_t *tmp = of_alloc(count, sizeof(uint64_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1422 1423 1424 1425 1426 1427 1428 | size = count * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 | size = count * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else float *tmp = of_alloc(count, sizeof(float)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | size = count * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | size = count * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else double *tmp = of_alloc(count, sizeof(double)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1522 1523 1524 1525 1526 1527 1528 | size = count * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | size = count * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint16_t *tmp = of_alloc(count, sizeof(uint16_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1552 1553 1554 1555 1556 1557 1558 | size = count * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | size = count * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint32_t *tmp = of_alloc(count, sizeof(uint32_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1582 1583 1584 1585 1586 1587 1588 | size = count * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | size = count * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else uint64_t *tmp = of_alloc(count, sizeof(uint64_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1612 1613 1614 1615 1616 1617 1618 | size = count * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | size = count * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else float *tmp = of_alloc(count, sizeof(float)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1642 1643 1644 1645 1646 1647 1648 | size = count * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else | | | 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | size = count * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else double *tmp = of_alloc(count, sizeof(double)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); [self writeBuffer: tmp length: size]; |
︙ | ︙ | |||
1715 1716 1717 1718 1719 1720 1721 | - (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; | | | 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | - (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; buffer = of_alloc(stringLength + 1, 1); @try { memcpy(buffer, [string cStringWithEncoding: encoding], stringLength); buffer[stringLength] = '\n'; [self writeBuffer: buffer |
︙ | ︙ | |||
1870 1871 1872 1873 1874 1875 1876 | length: (size_t)length { char *readBuffer; if (length > SIZE_MAX - _readBufferLength) @throw [OFOutOfRangeException exception]; | | | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | length: (size_t)length { char *readBuffer; if (length > SIZE_MAX - _readBufferLength) @throw [OFOutOfRangeException exception]; readBuffer = of_alloc(_readBufferLength + length, 1); memcpy(readBuffer, buffer, length); memcpy(readBuffer + length, _readBuffer, _readBufferLength); free(_readBufferMemory); _readBuffer = _readBufferMemory = readBuffer; _readBufferLength += length; } |
︙ | ︙ |
Modified src/OFString+JSONParsing.m from [c0346b7fe9] to [57caefd874].
︙ | ︙ | |||
144 145 146 147 148 149 150 | char *buffer; size_t i = 0; char delimiter = **pointer; if (++(*pointer) + 1 >= stop) return nil; | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | char *buffer; size_t i = 0; char delimiter = **pointer; if (++(*pointer) + 1 >= stop) return nil; buffer = of_alloc(stop - *pointer, 1); while (*pointer < stop) { /* Parse escape codes */ if (**pointer == '\\') { if (++(*pointer) >= stop) { free(buffer); return nil; |
︙ | ︙ | |||
290 291 292 293 294 295 296 | static inline OFString * parseIdentifier(const char **pointer, const char *stop) { char *buffer; size_t i = 0; | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | static inline OFString * parseIdentifier(const char **pointer, const char *stop) { char *buffer; size_t i = 0; buffer = of_alloc(stop - *pointer, 1); while (*pointer < stop) { if ((**pointer >= 'a' && **pointer <= 'z') || (**pointer >= 'A' && **pointer <= 'Z') || (**pointer >= '0' && **pointer <= '9') || **pointer == '_' || **pointer == '$' || (**pointer & 0x80)) { |
︙ | ︙ |
Modified src/OFString+URLEncoding.m from [329955234f] to [387a1fe7bd].
︙ | ︙ | |||
85 86 87 88 89 90 91 | const char *string = self.UTF8String; size_t length = self.UTF8StringLength; char *retCString; char byte = 0; int state = 0; size_t i = 0; | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | const char *string = self.UTF8String; size_t length = self.UTF8StringLength; char *retCString; char byte = 0; int state = 0; size_t i = 0; retCString = of_alloc(length + 1, 1); while (length--) { char c = *string++; switch (state) { case 0: if (c == '%') |
︙ | ︙ |
Modified src/OFString+XMLEscaping.m from [e1df224af8] to [9d2e4926e1].
︙ | ︙ | |||
38 39 40 41 42 43 44 | OFString *ret; string = self.UTF8String; length = self.UTF8StringLength; j = 0; retLength = length; | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | OFString *ret; string = self.UTF8String; length = self.UTF8StringLength; j = 0; retLength = length; retCString = of_alloc(retLength, 1); for (size_t i = 0; i < length; i++) { switch (string[i]) { case '<': append = "<"; appendLen = 4; break; |
︙ | ︙ |
Modified src/OFString.m from [3f36b9543e] to [8c96d0cf6e].
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | /* * We need one extra byte for the terminating zero if we want * to use -[initWithUTF8StringNoCopy:length:freeWhenDone:]. */ if (SIZE_MAX - (size_t)fileSize < 1) @throw [OFOutOfRangeException exception]; | | | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | /* * We need one extra byte for the terminating zero if we want * to use -[initWithUTF8StringNoCopy:length:freeWhenDone:]. */ if (SIZE_MAX - (size_t)fileSize < 1) @throw [OFOutOfRangeException exception]; tmp = of_alloc((size_t)fileSize + 1, 1); @try { file = [[OFFile alloc] initWithPath: path mode: @"r"]; [file readIntoBuffer: tmp exactLength: (size_t)fileSize]; } @catch (id e) { |
︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 | { size_t length = self.length; char *cString; size_t cStringLength; switch (encoding) { case OF_STRING_ENCODING_UTF_8: | | | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | { size_t length = self.length; char *cString; size_t cStringLength; switch (encoding) { case OF_STRING_ENCODING_UTF_8: cString = of_alloc((length * 4) + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: (length * 4) + 1 encoding: OF_STRING_ENCODING_UTF_8 lossy: lossy]; |
︙ | ︙ | |||
1411 1412 1413 1414 1415 1416 1417 | case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_CODEPAGE_858: case OF_STRING_ENCODING_MAC_ROMAN: case OF_STRING_ENCODING_KOI8_R: case OF_STRING_ENCODING_KOI8_U: | | | 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_CODEPAGE_858: case OF_STRING_ENCODING_MAC_ROMAN: case OF_STRING_ENCODING_KOI8_R: case OF_STRING_ENCODING_KOI8_U: cString = of_alloc(length + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: length + 1 encoding: encoding lossy: lossy]; } @catch (id e) { |
︙ | ︙ | |||
1865 1866 1867 1868 1869 1870 1871 | if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; | | | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(characters + i, searchCharacters, |
︙ | ︙ | |||
1933 1934 1935 1936 1937 1938 1939 | if (range.length == 0) return OF_NOT_FOUND; if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; | | | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | if (range.length == 0) return OF_NOT_FOUND; if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - 1;; i--) { if (characterIsMember(characterSet, |
︙ | ︙ | |||
2176 2177 2178 2179 2180 2181 2182 | of_unichar_t *tmp; size_t prefixLength; bool hasPrefix; if ((prefixLength = prefix.length) > self.length) return false; | | | 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | of_unichar_t *tmp; size_t prefixLength; bool hasPrefix; if ((prefixLength = prefix.length) > self.length) return false; tmp = of_alloc(prefixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(0, prefixLength)]; hasPrefix = (memcmp(tmp, prefix.characters, |
︙ | ︙ | |||
2206 2207 2208 2209 2210 2211 2212 | bool hasSuffix; if ((suffixLength = suffix.length) > self.length) return false; length = self.length; | | | 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 | bool hasSuffix; if ((suffixLength = suffix.length) > self.length) return false; length = self.length; tmp = of_alloc(suffixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(length - suffixLength, suffixLength)]; |
︙ | ︙ | |||
2499 2500 2501 2502 2503 2504 2505 | } - (const of_unichar_t *)characters { size_t length = self.length; of_unichar_t *buffer; | | | 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 | } - (const of_unichar_t *)characters { size_t length = self.length; of_unichar_t *buffer; buffer = of_alloc(length, sizeof(of_unichar_t)); @try { [self getCharacters: buffer inRange: of_range(0, length)]; return [[OFData dataWithItemsNoCopy: buffer count: length itemSize: sizeof(of_unichar_t) |
︙ | ︙ | |||
2529 2530 2531 2532 2533 2534 2535 | const of_unichar_t *characters = self.characters; size_t length = self.length; of_char16_t *buffer; size_t j; bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); /* Allocate memory for the worst case */ | | | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 | const of_unichar_t *characters = self.characters; size_t length = self.length; of_char16_t *buffer; size_t j; bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); /* Allocate memory for the worst case */ buffer = of_alloc((length + 1) * 2, sizeof(of_char16_t)); j = 0; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (c > 0x10FFFF) { free(buffer); |
︙ | ︙ | |||
2601 2602 2603 2604 2605 2606 2607 | } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { size_t length = self.length; of_char32_t *buffer; | | | 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 | } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { size_t length = self.length; of_char32_t *buffer; buffer = of_alloc(length + 1, sizeof(of_char32_t)); @try { [self getCharacters: buffer inRange: of_range(0, length)]; buffer[length] = 0; if (byteOrder != OF_BYTE_ORDER_NATIVE) for (size_t i = 0; i < length; i++) |
︙ | ︙ |
Modified src/OFUTF8String.m from [4cdd46e0d2] to [4b2268ed9f].
︙ | ︙ | |||
177 178 179 180 181 182 183 | - (instancetype)init { self = [super init]; @try { _s = &_storage; | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - (instancetype)init { self = [super init]; @try { _s = &_storage; _s->cString = of_alloc_zeroed(1, 1); _s->freeWhenDone = true; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
243 244 245 246 247 248 249 | memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; _s->cString = of_alloc(cStringLength + 1, 1); _s->cStringLength = cStringLength; _s->freeWhenDone = true; if (encoding == OF_STRING_ENCODING_UTF_8 || encoding == OF_STRING_ENCODING_ASCII) { switch (of_string_utf8_check(cString, cStringLength, &_s->length)) { |
︙ | ︙ | |||
448 449 450 451 452 453 454 | [string isKindOfClass: [OFMutableUTF8String class]]) _s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8; else _s->isUTF8 = true; _s->length = string.length; | | | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | [string isKindOfClass: [OFMutableUTF8String class]]) _s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8; else _s->isUTF8 = true; _s->length = string.length; _s->cString = of_alloc(_s->cStringLength + 1, 1); memcpy(_s->cString, string.UTF8String, _s->cStringLength + 1); _s->freeWhenDone = true; } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)initWithCharacters: (const of_unichar_t *)characters length: (size_t)length { self = [super init]; @try { size_t j; _s = &_storage; _s->cString = of_alloc((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], _s->cString + j); |
︙ | ︙ | |||
525 526 527 528 529 530 531 | string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; _s->cString = of_alloc((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { of_unichar_t character = (swap ? OF_BSWAP16(string[i]) : string[i]); |
︙ | ︙ | |||
610 611 612 613 614 615 616 | characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; | | | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; _s->cString = of_alloc((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { char buffer[4]; size_t len = of_string_utf8_encode( |
︙ | ︙ | |||
685 686 687 688 689 690 691 | case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } | | | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->cString = of_alloc(cStringLength + 1, 1); memcpy(_s->cString, tmp, cStringLength + 1); _s->freeWhenDone = true; } @finally { free(tmp); } } @catch (id e) { [self release]; |
︙ | ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | objc_autoreleasePoolPop(pool); return array; } - (const of_unichar_t *)characters { | | | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | objc_autoreleasePoolPop(pool); return array; } - (const of_unichar_t *)characters { of_unichar_t *buffer = of_alloc(_s->length, sizeof(of_unichar_t)); size_t i = 0, j = 0; while (i < _s->cStringLength) { of_unichar_t c; ssize_t cLen; cLen = of_string_utf8_decode(_s->cString + i, |
︙ | ︙ | |||
1178 1179 1180 1181 1182 1183 1184 | count: _s->length itemSize: sizeof(of_unichar_t) freeWhenDone: true] items]; } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { | | | 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | count: _s->length itemSize: sizeof(of_unichar_t) freeWhenDone: true] items]; } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { of_char32_t *buffer = of_alloc(_s->length + 1, sizeof(of_char32_t)); size_t i = 0, j = 0; while (i < _s->cStringLength) { of_char32_t c; ssize_t cLen; cLen = of_string_utf8_decode(_s->cString + i, |
︙ | ︙ |
Modified src/OFValue.m from [3be7f2e37d] to [fcc7bff050].
︙ | ︙ | |||
179 180 181 182 183 184 185 | objCType = self.objCType; if (strcmp([object objCType], objCType) != 0) return false; size = of_sizeof_type_encoding(objCType); | | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | objCType = self.objCType; if (strcmp([object objCType], objCType) != 0) return false; size = of_sizeof_type_encoding(objCType); value = of_alloc(1, size); @try { otherValue = of_alloc(1, size); } @catch (id e) { free(value); @throw e; } @try { [self getValue: value |
︙ | ︙ | |||
208 209 210 211 212 213 214 | - (unsigned long)hash { size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; uint32_t hash; | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - (unsigned long)hash { size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; uint32_t hash; value = of_alloc(1, size); @try { [self getValue: value size: size]; OF_HASH_INIT(hash); for (size_t i = 0; i < size; i++) |
︙ | ︙ | |||
309 310 311 312 313 314 315 | - (OFString *)description { OFMutableString *ret = [OFMutableString stringWithString: @"<OFValue: "]; size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; | | | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - (OFString *)description { OFMutableString *ret = [OFMutableString stringWithString: @"<OFValue: "]; size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; value = of_alloc(1, size); @try { [self getValue: value size: size]; for (size_t i = 0; i < size; i++) { if (i > 0) [ret appendString: @" "]; |
︙ | ︙ |
Modified src/OFWin32ConsoleStdIOStream.m from [7dd85d6178] to [01349f1730].
︙ | ︙ | |||
133 134 135 136 137 138 139 | char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; UTF16 = of_alloc(length, sizeof(of_char16_t)); @try { DWORD UTF16Len; OFMutableData *rest = nil; size_t i = 0; if ([OFSystemInfo isWindowsNT]) { if (!ReadConsoleW(_handle, UTF16, (DWORD)length, |
︙ | ︙ | |||
360 361 362 363 364 365 366 | bytesWritten: bytesWritten * 2 errNo: 0]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | bytesWritten: bytesWritten * 2 errNo: 0]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } tmp = of_alloc(length * 2, sizeof(of_char16_t)); @try { DWORD bytesWritten; while (i < length) { of_unichar_t c; ssize_t UTF8Len; |
︙ | ︙ |
Modified src/OFWindowsRegistryKey.m from [db8bc56ab6] to [ae5fc782fa].
︙ | ︙ | |||
357 358 359 360 361 362 363 | type: (DWORD)type { void *pool = objc_autoreleasePoolPush(); OFData *data; if ([OFSystemInfo isWindowsNT]) data = [OFData dataWithItems: string.UTF16String | > | < | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | type: (DWORD)type { void *pool = objc_autoreleasePoolPush(); OFData *data; if ([OFSystemInfo isWindowsNT]) data = [OFData dataWithItems: string.UTF16String count: string.UTF16StringLength + 1 itemSize: sizeof(of_char16_t)]; else { of_string_encoding_t encoding = [OFLocale encoding]; const char *cString = [string cStringWithEncoding: encoding]; size_t length = [string cStringLengthWithEncoding: encoding]; data = [OFData dataWithItems: cString count: length + 1]; |
︙ | ︙ |
Modified src/OFXMLComment.m from [2577a47d50] to [ed66bc6cfa].
︙ | ︙ | |||
112 113 114 115 116 117 118 | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { char *whitespaces = of_alloc((level * indentation) + 1, 1); memset(whitespaces, ' ', level * indentation); whitespaces[level * indentation] = 0; @try { ret = [OFString stringWithFormat: @"%s<!--%@-->", whitespaces, _comment]; |
︙ | ︙ |
Modified src/OFXMLElement.m from [d12879cd95] to [c47060e7f9].
︙ | ︙ | |||
458 459 460 461 462 463 464 | else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; else defaultNS = _defaultNamespace; i = 0; length = _name.UTF8StringLength + 3 + (level * indentation); | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; else defaultNS = _defaultNamespace; i = 0; length = _name.UTF8StringLength + 3 + (level * indentation); cString = of_alloc(length, 1); @try { memset(cString + i, ' ', level * indentation); i += level * indentation; /* Start of tag */ cString[i++] = '<'; |
︙ | ︙ |
Modified src/OFXMLParser.m from [8b036ac867] to [0dd447c3c4].
︙ | ︙ | |||
274 275 276 277 278 279 280 | [self parseBuffer: string.UTF8String length: string.UTF8StringLength]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | [self parseBuffer: string.UTF8String length: string.UTF8StringLength]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; char *buffer = of_alloc(1, pageSize); @try { while (!stream.atEndOfStream) { size_t length = [stream readIntoBuffer: buffer length: pageSize]; [self parseBuffer: buffer |
︙ | ︙ |
Modified src/OFXMLProcessingInstructions.m from [5705c589f5] to [3f7941e3fa].
︙ | ︙ | |||
113 114 115 116 117 118 119 | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { char *whitespaces = of_alloc((level * indentation) + 1, 1); memset(whitespaces, ' ', level * indentation); whitespaces[level * indentation] = 0; @try { ret = [OFString stringWithFormat: @"%s<?%@?>", whitespaces, _processingInstructions]; } @finally { |
︙ | ︙ |
Modified src/forwarding/forwarding-powerpc-elf.S from [765ed4e505] to [40eb7ee848].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | .globl of_forward_stret .section .text of_forward: stwu %r1, -112(%r1) mflr %r0 stw %r0, 116(%r1) stw %r30, 104(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l /* Save all arguments */ stw %r3, 8(%r1) stw %r4, 12(%r1) stw %r5, 16(%r1) stw %r6, 20(%r1) stw %r7, 24(%r1) | > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | .globl of_forward_stret .section .text of_forward: stwu %r1, -112(%r1) mflr %r0 stw %r0, 116(%r1) #ifdef OF_PIC stw %r30, 104(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l #endif /* Save all arguments */ stw %r3, 8(%r1) stw %r4, 12(%r1) stw %r5, 16(%r1) stw %r6, 20(%r1) stw %r7, 24(%r1) |
︙ | ︙ | |||
51 52 53 54 55 56 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 83 84 85 86 87 88 89 90 91 92 | stfd %f3, 56(%r1) stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) bl object_getClass+0x8000@plt lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl class_respondsToSelector+0x8000@plt cmpwi %r3, 0 beq- 0f lwz %r3, 8(%r1) lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl objc_msg_lookup+0x8000@plt mtctr %r3 lwz %r3, 8(%r1) lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) lwz %r5, 12(%r1) bctrl cmpwi %r3, 0 beq- 0f lwz %r4, 8(%r1) cmpw %r3, %r4 beq- 0f stw %r3, 8(%r1) lwz %r4, 12(%r1) bl objc_msg_lookup+0x8000@plt mtctr %r3 /* Restore all arguments */ lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r6, 20(%r1) | > > > > > > > > > > > > > > > > > > > > > > > | 53 54 55 56 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 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 | stfd %f3, 56(%r1) stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) #ifdef OF_PIC bl object_getClass+0x8000@plt lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl class_respondsToSelector+0x8000@plt #else bl object_getClass lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l bl class_respondsToSelector #endif cmpwi %r3, 0 beq- 0f lwz %r3, 8(%r1) #ifdef OF_PIC lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl objc_msg_lookup+0x8000@plt #else lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l bl objc_msg_lookup #endif mtctr %r3 lwz %r3, 8(%r1) #ifdef OF_PIC lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) #else lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l #endif lwz %r5, 12(%r1) bctrl cmpwi %r3, 0 beq- 0f lwz %r4, 8(%r1) cmpw %r3, %r4 beq- 0f stw %r3, 8(%r1) lwz %r4, 12(%r1) #ifdef OF_PIC bl objc_msg_lookup+0x8000@plt #else bl objc_msg_lookup #endif mtctr %r3 /* Restore all arguments */ lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r6, 20(%r1) |
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | lfd %f3, 56(%r1) lfd %f4, 64(%r1) lfd %f5, 72(%r1) lfd %f6, 80(%r1) lfd %f7, 88(%r1) lfd %f8, 96(%r1) lwz %r30, 104(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr 0: lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r0, .Lgot_of_method_not_found-.Lbiased_got2(%r30) mtctr %r0 | > > > > < > > > > > > > > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | lfd %f3, 56(%r1) lfd %f4, 64(%r1) lfd %f5, 72(%r1) lfd %f6, 80(%r1) lfd %f7, 88(%r1) lfd %f8, 96(%r1) #ifdef OF_PIC lwz %r30, 104(%r1) #endif lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr 0: lwz %r3, 8(%r1) lwz %r4, 12(%r1) #ifdef OF_PIC lwz %r0, .Lgot_of_method_not_found-.Lbiased_got2(%r30) mtctr %r0 lwz %r30, 104(%r1) #endif lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 #ifdef OF_PIC bctr #else b of_method_not_found #endif .type of_forward, @function .size of_forward, .-of_forward of_forward_stret: stwu %r1, -112(%r1) mflr %r0 stw %r0, 116(%r1) #ifdef OF_PIC stw %r30, 104(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l #endif /* Save all arguments */ stw %r3, 8(%r1) stw %r4, 12(%r1) stw %r5, 16(%r1) stw %r6, 20(%r1) stw %r7, 24(%r1) |
︙ | ︙ | |||
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) mr %r3, %r4 bl object_getClass+0x800@plt lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl class_respondsToSelector+0x8000@plt cmpwi %r3, 0 beq- 0f lwz %r3, 12(%r1) lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl objc_msg_lookup+0x8000@plt mtctr %r3 lwz %r3, 12(%r1) lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) lwz %r5, 16(%r1) bctrl cmpwi %r3, 0 beq- 0f lwz %r4, 12(%r1) cmpw %r3, %r4 beq- 0f stw %r3, 12(%r1) lwz %r4, 16(%r1) bl objc_msg_lookup_stret+0x8000@plt mtctr %r3 /* Restore all arguments */ lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r6, 20(%r1) | > > > > > > > > > > > > > > > > > > > > > > > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | stfd %f4, 64(%r1) stfd %f5, 72(%r1) stfd %f6, 80(%r1) stfd %f7, 88(%r1) stfd %f8, 96(%r1) mr %r3, %r4 #ifdef OF_PIC bl object_getClass+0x800@plt lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl class_respondsToSelector+0x8000@plt #else bl object_getClass lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l bl class_respondsToSelector #endif cmpwi %r3, 0 beq- 0f lwz %r3, 12(%r1) #ifdef OF_PIC lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) bl objc_msg_lookup+0x8000@plt #else lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l bl objc_msg_lookup #endif mtctr %r3 lwz %r3, 12(%r1) #ifdef OF_PIC lwz %r4, .Lgot_sel_forwardingTargetForSelector_-.Lbiased_got2(%r30) #else lis %r4, sel_forwardingTargetForSelector_@ha addi %r4, %r4, sel_forwardingTargetForSelector_@l #endif lwz %r5, 16(%r1) bctrl cmpwi %r3, 0 beq- 0f lwz %r4, 12(%r1) cmpw %r3, %r4 beq- 0f stw %r3, 12(%r1) lwz %r4, 16(%r1) #ifdef OF_PIC bl objc_msg_lookup_stret+0x8000@plt #else bl objc_msg_lookup_stret #endif mtctr %r3 /* Restore all arguments */ lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r6, 20(%r1) |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | lfd %f3, 56(%r1) lfd %f4, 64(%r1) lfd %f5, 72(%r1) lfd %f6, 80(%r1) lfd %f7, 88(%r1) lfd %f8, 96(%r1) lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr 0: lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) lwz %r0, .Lgot_of_method_not_found_stret-.Lbiased_got2(%r30) mtctr %r0 | > > > > > < > > > > > > > > > > > > > | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | lfd %f3, 56(%r1) lfd %f4, 64(%r1) lfd %f5, 72(%r1) lfd %f6, 80(%r1) lfd %f7, 88(%r1) lfd %f8, 96(%r1) #ifdef OF_PIC lwz %r30, 104(%r1) #endif lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 bctr 0: lwz %r3, 8(%r1) lwz %r4, 12(%r1) lwz %r5, 16(%r1) #ifdef OF_PIC lwz %r0, .Lgot_of_method_not_found_stret-.Lbiased_got2(%r30) mtctr %r0 lwz %r30, 104(%r1) #endif lwz %r0, 116(%r1) mtlr %r0 addi %r1, %r1, 112 #ifdef OF_PIC bctr #else b of_method_not_found_stret #endif .type of_forward_stret, @function .size of_forward_stret, .-of_forward_stret init: stwu %r1, -16(%r1) mflr %r0 stw %r0, 20(%r1) #ifdef OF_PIC stw %r30, 8(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l lwz %r3, .Lgot_module-.Lbiased_got2(%r30) bl __objc_exec_class+0x8000@plt lwz %r30, 8(%r1) #else lis %r3, module@ha addi %r3, %r3, module@l bl __objc_exec_class #endif lwz %r0, 20(%r1) addi %r1, %r1, 16 mtlr %r0 blr .section .ctors, "aw", @progbits .long init |
︙ | ︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | .long 0, sel_forwardingTargetForSelector_ .short 0, 0 .long 0 .long 0 module: .long 8, 16, 0, symtab .section .got2, "aw" .Lbiased_got2 = .+0x8000 .Lgot_module: .long module .Lgot_sel_forwardingTargetForSelector_: .long sel_forwardingTargetForSelector_ .Lgot_of_method_not_found: .long of_method_not_found .Lgot_of_method_not_found_stret: .long of_method_not_found_stret #ifdef OF_LINUX .section .note.GNU-stack, "", @progbits #endif | > > | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | .long 0, sel_forwardingTargetForSelector_ .short 0, 0 .long 0 .long 0 module: .long 8, 16, 0, symtab #ifdef OF_PIC .section .got2, "aw" .Lbiased_got2 = .+0x8000 .Lgot_module: .long module .Lgot_sel_forwardingTargetForSelector_: .long sel_forwardingTargetForSelector_ .Lgot_of_method_not_found: .long of_method_not_found .Lgot_of_method_not_found_stret: .long of_method_not_found_stret #endif #ifdef OF_LINUX .section .note.GNU-stack, "", @progbits #endif |
Modified src/huffman_tree.m from [f65a681bbc] to [f9e711d791].
︙ | ︙ | |||
26 27 28 29 30 31 32 | #import "OFOutOfMemoryException.h" static struct of_huffman_tree * newTree(void) { struct of_huffman_tree *tree; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import "OFOutOfMemoryException.h" static struct of_huffman_tree * newTree(void) { struct of_huffman_tree *tree; tree = of_alloc(1, sizeof(*tree)); tree->leaves[0] = tree->leaves[1] = NULL; tree->value = 0xFFFF; return tree; } static void |
︙ | ︙ |
Modified src/macros.h from [43e7dc4d8f] to [7383bf6570].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS #endif #ifndef __STDC_CONSTANT_MACROS # define __STDC_CONSTANT_MACROS #endif #include <limits.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
820 821 822 823 824 825 826 | OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool of_bitset_isset(unsigned char *_Nonnull storage, size_t idx) { | | | | | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool of_bitset_isset(unsigned char *_Nonnull storage, size_t idx) { return storage[idx / CHAR_BIT] & (1u << (idx % CHAR_BIT)); } static OF_INLINE void of_bitset_set(unsigned char *_Nonnull storage, size_t idx) { storage[idx / CHAR_BIT] |= (1u << (idx % CHAR_BIT)); } static OF_INLINE void of_bitset_clear(unsigned char *_Nonnull storage, size_t idx) { storage[idx / CHAR_BIT] &= ~(1u << (idx % CHAR_BIT)); } static OF_INLINE char *_Nullable of_strdup(const char *_Nonnull string) { char *copy; size_t length = strlen(string); |
︙ | ︙ |
Modified src/platform.h from [40ddf7ef54] to [c42ebbf9ca].
︙ | ︙ | |||
101 102 103 104 105 106 107 | #endif #if defined(__APPLE__) # include <TargetConditionals.h> # if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ (defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR) # define OF_IOS | | > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #endif #if defined(__APPLE__) # include <TargetConditionals.h> # if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || \ (defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR) # define OF_IOS # endif # if defined(TARGET_OS_OSX) && TARGET_OS_OSX # define OF_MACOS # endif #elif defined(__linux__) # define OF_LINUX #elif defined(_WIN32) # define OF_WINDOWS #elif defined(__FreeBSD__) |
︙ | ︙ |
Modified src/platform/posix/OFProcess.m from [39ae31952e] to [e683854d10].
︙ | ︙ | |||
238 239 240 241 242 243 244 | forProgramName: (OFString *)programName andArguments: (OFArray *)arguments { OFString *const *objects = arguments.objects; size_t i, count = arguments.count; of_string_encoding_t encoding; | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | forProgramName: (OFString *)programName andArguments: (OFArray *)arguments { OFString *const *objects = arguments.objects; size_t i, count = arguments.count; of_string_encoding_t encoding; *argv = of_alloc(count + 2, sizeof(char *)); encoding = [OFLocale encoding]; (*argv)[0] = (char *)[programName cStringWithEncoding: encoding]; for (i = 0; i < count; i++) (*argv)[i + 1] = |
︙ | ︙ | |||
263 264 265 266 267 268 269 | if (environment == nil) return NULL; encoding = [OFLocale encoding]; count = environment.count; | | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | if (environment == nil) return NULL; encoding = [OFLocale encoding]; count = environment.count; envp = of_alloc_zeroed(count + 1, sizeof(char *)); @try { OFEnumerator *keyEnumerator = [environment keyEnumerator]; OFEnumerator *objectEnumerator = [environment objectEnumerator]; for (size_t i = 0; i < count; i++) { OFString *key; OFString *object; size_t keyLen, objectLen; key = [keyEnumerator nextObject]; object = [objectEnumerator nextObject]; keyLen = [key cStringLengthWithEncoding: encoding]; objectLen = [object cStringLengthWithEncoding: encoding]; envp[i] = of_alloc(keyLen + objectLen + 2, 1); memcpy(envp[i], [key cStringWithEncoding: encoding], keyLen); envp[i][keyLen] = '='; memcpy(envp[i] + keyLen + 1, [object cStringWithEncoding: encoding], objectLen); envp[i][keyLen + objectLen + 1] = '\0'; |
︙ | ︙ |
Modified src/platform/windows/OFProcess.m from [1de0e5d870] to [b53baca85e].
︙ | ︙ | |||
191 192 193 194 195 196 197 | si.cb = sizeof(si); si.hStdInput = _writePipe[0]; si.hStdOutput = _readPipe[1]; si.hStdError = GetStdHandle(STD_ERROR_HANDLE); si.dwFlags |= STARTF_USESTDHANDLES; length = argumentsString.UTF16StringLength; | | > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | si.cb = sizeof(si); si.hStdInput = _writePipe[0]; si.hStdOutput = _readPipe[1]; si.hStdError = GetStdHandle(STD_ERROR_HANDLE); si.dwFlags |= STARTF_USESTDHANDLES; length = argumentsString.UTF16StringLength; argumentsCopy = of_alloc(length + 1, sizeof(of_char16_t)); memcpy(argumentsCopy, argumentsString.UTF16String, (length + 1) * 2); @try { if (!CreateProcessW(program.UTF16String, argumentsCopy, NULL, NULL, TRUE, CREATE_UNICODE_ENVIRONMENT, [self of_wideEnvironmentForDictionary: |
︙ | ︙ |
Modified src/runtime/Makefile from [0941bab434] to [db9b1528cf].
︙ | ︙ | |||
29 30 31 32 33 34 35 | protocol.m \ selector.m \ sparsearray.m \ static-instances.m \ synchronized.m \ tagged-pointer.m \ ${USE_SRCS_THREADS} | | < | > | | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | protocol.m \ selector.m \ sparsearray.m \ static-instances.m \ synchronized.m \ tagged-pointer.m \ ${USE_SRCS_THREADS} SRCS_THREADS = mutex.m \ once.m \ threading.m \ tlskey.m INCLUDES = ObjFWRT.h includesubdir = ObjFWRT OBJS_EXTRA = lookup-asm/lookup-asm.a LIB_OBJS_EXTRA = lookup-asm/lookup-asm.lib.a AMIGA_LIB_OBJS_START = amiga-library.amigalib.o AMIGA_LIB_OBJS_EXTRA = amiga-glue.amigalib.o \ lookup-asm/lookup-asm.amigalib.a \ amiga-end.amigalib.o include ../../buildsys.mk ${OBJFWRT_AMIGA_LIB}: inline.h ${SFDC_INLINE_H}: ${SFD_FILE} |
︙ | ︙ |
Modified src/runtime/amiga-end.m from [0d112ca98e] to [c87f18bf9e].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #import "platform.h" #ifdef OF_MORPHOS __asm__ ( | > > | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "config.h" #import "platform.h" #ifdef OF_MORPHOS __asm__ ( ".section .eh_frame, \"aw\"\n" " .long 0\n" ".section .ctors, \"aw\"\n" " .long 0" ); #else __asm__ ( "" ); #endif |
Modified src/runtime/amiga-glue.m from [896aceecb7] to [15f440e90e].
︙ | ︙ | |||
820 821 822 823 824 825 826 | glue_object_isTaggedPointer PPC_PARAMS(id object) { M68K_ARG(id, object, a0) return object_isTaggedPointer(object); } | < < < < < < < < | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | glue_object_isTaggedPointer PPC_PARAMS(id object) { M68K_ARG(id, object, a0) return object_isTaggedPointer(object); } uintptr_t __saveds glue_object_getTaggedPointerValue PPC_PARAMS(id object) { M68K_ARG(id, object, a0) return object_getTaggedPointerValue(object); } |
︙ | ︙ |
Modified src/runtime/amiga-library.m from [3b48513197] to [aa8e67d72d].
︙ | ︙ | |||
146 147 148 149 150 151 152 | extern void glue_objc_hashtable_set(void); extern void *glue_objc_hashtable_get(void); extern void glue_objc_hashtable_delete(void); extern void glue_objc_hashtable_free(void); extern void glue_objc_setTaggedPointerSecret(void); extern int glue_objc_registerTaggedPointerClass(void); extern bool glue_object_isTaggedPointer(void); | < | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | extern void glue_objc_hashtable_set(void); extern void *glue_objc_hashtable_get(void); extern void glue_objc_hashtable_delete(void); extern void glue_objc_hashtable_free(void); extern void glue_objc_setTaggedPointerSecret(void); extern int glue_objc_registerTaggedPointerClass(void); extern bool glue_object_isTaggedPointer(void); extern uintptr_t glue_object_getTaggedPointerValue(void); extern id glue_objc_createTaggedPointer(void); #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | child->dataSeg += DATA_OFFSET; return &child->library; } static void * | | > > | > > > > > > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | child->dataSeg += DATA_OFFSET; return &child->library; } static void * expunge(struct ObjFWRTBase *base, struct ExecBase *sysBase) { #define SysBase sysBase void *segList; if (base->parent != NULL) { base->parent->library.lib_Flags |= LIBF_DELEXP; return 0; } if (base->library.lib_OpenCnt > 0) { base->library.lib_Flags |= LIBF_DELEXP; return 0; } segList = base->segList; Remove(&base->library.lib_Node); FreeMem((char *)base - base->library.lib_NegSize, base->library.lib_NegSize + base->library.lib_PosSize); return segList; #undef SysBase } static void *__saveds lib_expunge(void) { OBJC_M68K_ARG(struct ObjFWRTBase *, base, a6) return expunge(base, SysBase); } static void *__saveds lib_close(void) { /* * SysBase becomes invalid during this function, so we store it in * sysBase and add a define to make the inlines use the right one. */ struct ExecBase *sysBase = SysBase; #define SysBase sysBase OBJC_M68K_ARG(struct ObjFWRTBase *, base, a6) if (base->parent != NULL) { struct ObjFWRTBase *parent; #ifdef OF_AMIGAOS_M68K if (base->initialized) |
︙ | ︙ | |||
384 385 386 387 388 389 390 | base->library.lib_NegSize + base->library.lib_PosSize); base = parent; } if (--base->library.lib_OpenCnt == 0 && (base->library.lib_Flags & LIBF_DELEXP)) | | > > > > | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | base->library.lib_NegSize + base->library.lib_PosSize); base = parent; } if (--base->library.lib_OpenCnt == 0 && (base->library.lib_Flags & LIBF_DELEXP)) return expunge(base, sysBase); return NULL; #undef SysBase } static void * lib_null(void) { return NULL; } bool objc_init(unsigned int version, struct objc_libc *libc_, FILE *stdout_, FILE *stderr_) { #ifdef OF_AMIGAOS_M68K OBJC_M68K_ARG(struct ObjFWRTBase *, base, a6) #else register struct ObjFWRTBase *r12 __asm__("r12"); struct ObjFWRTBase *base = r12; #endif #ifdef OF_MORPHOS void *frame; #endif uintptr_t *iter, *iter0; if (version > 1) return false; memcpy(&libc, libc_, sizeof(libc)); |
︙ | ︙ | |||
425 426 427 428 429 430 431 | for (size_t i = 1; i <= (size_t)_EH_FRAME_BEGINS__; i++) libc.__register_frame_info((&_EH_FRAME_BEGINS__)[i], (&_EH_FRAME_OBJECTS__)[i]); iter0 = &__CTOR_LIST__[1]; #elif defined(OF_MORPHOS) __asm__ ( | | | > > | > > | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | for (size_t i = 1; i <= (size_t)_EH_FRAME_BEGINS__; i++) libc.__register_frame_info((&_EH_FRAME_BEGINS__)[i], (&_EH_FRAME_OBJECTS__)[i]); iter0 = &__CTOR_LIST__[1]; #elif defined(OF_MORPHOS) __asm__ ( "lis %0, __EH_FRAME_BEGIN__@ha\n\t" "la %0, __EH_FRAME_BEGIN__@l(%0)\n\t" "lis %1, __CTOR_LIST__@ha\n\t" "la %1, __CTOR_LIST__@l(%1)\n\t" : "=r"(frame), "=r"(iter0) ); libc.__register_frame(frame); #endif for (iter = iter0; *iter != 0; iter++); while (iter > iter0) { void (*ctor)(void) = (void (*)(void))*--iter; ctor(); |
︙ | ︙ | |||
575 576 577 578 579 580 581 582 583 584 585 586 587 588 | #else void _Unwind_Resume(void *ex) { libc._Unwind_Resume(ex); } #endif #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" static CONST_APTR functionTable[] = { #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_BEGIN, (CONST_APTR)FUNCARRAY_32BIT_NATIVE, | > > > > > > | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | #else void _Unwind_Resume(void *ex) { libc._Unwind_Resume(ex); } #endif int * objc_get_errno(void) { return libc.get_errno(); } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" static CONST_APTR functionTable[] = { #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_BEGIN, (CONST_APTR)FUNCARRAY_32BIT_NATIVE, |
︙ | ︙ | |||
678 679 680 681 682 683 684 | (CONST_APTR)glue_objc_hashtable_set, (CONST_APTR)glue_objc_hashtable_get, (CONST_APTR)glue_objc_hashtable_delete, (CONST_APTR)glue_objc_hashtable_free, (CONST_APTR)glue_objc_setTaggedPointerSecret, (CONST_APTR)glue_objc_registerTaggedPointerClass, (CONST_APTR)glue_object_isTaggedPointer, | < | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | (CONST_APTR)glue_objc_hashtable_set, (CONST_APTR)glue_objc_hashtable_get, (CONST_APTR)glue_objc_hashtable_delete, (CONST_APTR)glue_objc_hashtable_free, (CONST_APTR)glue_objc_setTaggedPointerSecret, (CONST_APTR)glue_objc_registerTaggedPointerClass, (CONST_APTR)glue_object_isTaggedPointer, (CONST_APTR)glue_object_getTaggedPointerValue, (CONST_APTR)glue_objc_createTaggedPointer, (CONST_APTR)-1, #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_END #endif }; |
︙ | ︙ | |||
727 728 729 730 731 732 733 | .rt_Revision = OBJFWRT_LIB_MINOR, .rt_Tags = NULL, #endif }; #ifdef OF_MORPHOS __asm__ ( | > > > > | | > | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | .rt_Revision = OBJFWRT_LIB_MINOR, .rt_Tags = NULL, #endif }; #ifdef OF_MORPHOS __asm__ ( ".section .eh_frame, \"aw\"\n" ".globl __EH_FRAME_BEGIN__\n" ".type __EH_FRAME_BEGIN__, @object\n" "__EH_FRAME_BEGIN__:\n" ".section .ctors, \"aw\"\n" ".globl __CTOR_LIST__\n" ".type __CTOR_LIST__, @object\n" "__CTOR_LIST__:\n" ".section .text" ); #endif |
Modified src/runtime/amigaos3.sfd from [7f54fc7db5] to [52fd389150].
︙ | ︙ | |||
89 90 91 92 93 94 95 | void *_Nullable glue_objc_hashtable_get(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_delete(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_free(struct objc_hashtable *_Nonnull table)(a0) * Public functions again void glue_objc_setTaggedPointerSecret(uintptr_t secret)(d0) int glue_objc_registerTaggedPointerClass(Class _Nonnull class_)(a0) bool glue_object_isTaggedPointer(id _Nullable object)(a0) | < | 89 90 91 92 93 94 95 96 97 98 | void *_Nullable glue_objc_hashtable_get(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_delete(struct objc_hashtable *_Nonnull table, const void *_Nonnull key)(a0,a1) void glue_objc_hashtable_free(struct objc_hashtable *_Nonnull table)(a0) * Public functions again void glue_objc_setTaggedPointerSecret(uintptr_t secret)(d0) int glue_objc_registerTaggedPointerClass(Class _Nonnull class_)(a0) bool glue_object_isTaggedPointer(id _Nullable object)(a0) uintptr_t glue_object_getTaggedPointerValue(id _Nonnull object)(a0) id _Nullable glue_objc_createTaggedPointer(int class_, uintptr_t value)(d0,d1) ==end |
Modified src/runtime/linklib/linklib.m from [f6ecf9cc72] to [99c78c6a65].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <proto/exec.h> struct ObjFWRTBase; #import "inline.h" #include <stdio.h> #include <stdlib.h> #if defined(OF_AMIGAOS_M68K) # include <stabs.h> # define SYM(name) __asm__("_" name) #elif defined(OF_MORPHOS) | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #include <proto/exec.h> struct ObjFWRTBase; #import "inline.h" #include <errno.h> #include <stdio.h> #include <stdlib.h> #if defined(OF_AMIGAOS_M68K) # include <stabs.h> # define SYM(name) __asm__("_" name) #elif defined(OF_MORPHOS) |
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | extern void _Unwind_SetIP(void *, uintptr_t); extern void _Unwind_SetGR(void *, int, uintptr_t); #ifdef HAVE_SJLJ_EXCEPTIONS extern void _Unwind_SjLj_Resume(void *); #else extern void _Unwind_Resume(void *); #endif extern void __register_frame_info(const void *, void *); extern void *__deregister_frame_info(const void *); struct Library *ObjFWRTBase; void *__objc_class_name_Protocol; static void __attribute__((__used__)) ctor(void) { static bool initialized = false; struct objc_libc libc = { .malloc = malloc, | > > > > > > > > > > > > | 54 55 56 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 83 84 | extern void _Unwind_SetIP(void *, uintptr_t); extern void _Unwind_SetGR(void *, int, uintptr_t); #ifdef HAVE_SJLJ_EXCEPTIONS extern void _Unwind_SjLj_Resume(void *); #else extern void _Unwind_Resume(void *); #endif #ifdef OF_AMIGAOS_M68K extern void __register_frame_info(const void *, void *); extern void *__deregister_frame_info(const void *); #endif #ifdef OF_MORPHOS extern void __register_frame(void *); extern void __deregister_frame(void *); #endif struct Library *ObjFWRTBase; void *__objc_class_name_Protocol; static int * get_errno(void) { return &errno; } static void __attribute__((__used__)) ctor(void) { static bool initialized = false; struct objc_libc libc = { .malloc = malloc, |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ._Unwind_SetIP = _Unwind_SetIP, ._Unwind_SetGR = _Unwind_SetGR, #ifdef HAVE_SJLJ_EXCEPTIONS ._Unwind_SjLj_Resume = _Unwind_SjLj_Resume, #else ._Unwind_Resume = _Unwind_Resume, #endif .__register_frame_info = __register_frame_info, .__deregister_frame_info = __deregister_frame_info, }; if (initialized) return; if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB, OBJFWRT_LIB_MINOR)) == NULL) { | > > > > > > > | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | ._Unwind_SetIP = _Unwind_SetIP, ._Unwind_SetGR = _Unwind_SetGR, #ifdef HAVE_SJLJ_EXCEPTIONS ._Unwind_SjLj_Resume = _Unwind_SjLj_Resume, #else ._Unwind_Resume = _Unwind_Resume, #endif #ifdef OF_AMIGAOS_M68K .__register_frame_info = __register_frame_info, .__deregister_frame_info = __deregister_frame_info, #endif #ifdef OF_MORPHOS .__register_frame = __register_frame, .__deregister_frame = __deregister_frame, #endif .get_errno = get_errno, }; if (initialized) return; if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB, OBJFWRT_LIB_MINOR)) == NULL) { |
︙ | ︙ | |||
722 723 724 725 726 727 728 | bool object_isTaggedPointer(id object) { return glue_object_isTaggedPointer(object); } | < < < < < < | | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | bool object_isTaggedPointer(id object) { return glue_object_isTaggedPointer(object); } uintptr_t object_getTaggedPointerValue(id object) { return glue_object_getTaggedPointerValue(object); } id objc_createTaggedPointer(int class, uintptr_t value) { return glue_objc_createTaggedPointer(class, value); } |
Modified src/runtime/lookup-asm/Makefile from [a8b7579307] to [3c7b7f7fc1].
1 2 3 4 5 6 7 8 9 10 | include ../../../extra.mk STATIC_PIC_LIB_NOINST = ${LOOKUP_ASM_LIB_A} STATIC_LIB_NOINST = ${LOOKUP_ASM_A} SRCS = lookup-asm.S include ../../../buildsys.mk ASFLAGS += -I../../.. -I../.. | > > | 1 2 3 4 5 6 7 8 9 10 11 12 | include ../../../extra.mk STATIC_PIC_LIB_NOINST = ${LOOKUP_ASM_LIB_A} STATIC_AMIGA_LIB_NOINST = ${LOOKUP_ASM_AMIGALIB_A} STATIC_LIB_NOINST = ${LOOKUP_ASM_A} SRCS = lookup-asm.S include ../../../buildsys.mk ASFLAGS += -I../../.. -I../.. ASFLAGS_lookup-asm.amigalib.o += -DOF_BASEREL |
Modified src/runtime/lookup-asm/lookup-asm-powerpc-elf.S from [6a0efd2f1b] to [8af7ae3da5].
︙ | ︙ | |||
53 54 55 56 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | cmpwi %r5, 0 beq- 0f mr %r3, %r5 blr 0: stwu %r1, -16(%r1) mflr %r0 stw %r0, 20(%r1) stw %r30, 8(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l lwz %r0, .Lgot_\not_found-.Lbiased_got2(%r30) mtctr %r0 lwz %r30, 8(%r1) lwz %r0, 20(%r1) addi %r1, %r1, 16 mtlr %r0 bctr .Ltagged_pointer_\name: mflr %r7 bl 0f 0: mflr %r6 mtlr %r7 addis %r6, %r6, .Lbiased_got2-0b@ha addi %r6, %r6, .Lbiased_got2-0b@l lwz %r5, .Lgot_objc_tagged_pointer_secret-.Lbiased_got2(%r6) lwz %r5, 0(%r5) xor %r5, %r3, %r5 rlwinm %r5, %r5, 1, 0x1C lwz %r6, .Lgot_objc_tagged_pointer_classes-.Lbiased_got2(%r6) lwzx %r5, %r6, %r5 lwz %r5, 32(%r5) b .Lmain_\name .type \name, @function .size \name, .-\name .endm | > > > > > > > > > > > > > > > > > > > > | 53 54 55 56 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 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 | cmpwi %r5, 0 beq- 0f mr %r3, %r5 blr 0: #ifdef OF_PIC stwu %r1, -16(%r1) mflr %r0 stw %r0, 20(%r1) stw %r30, 8(%r1) bl 0f 0: mflr %r30 addis %r30, %r30, .Lbiased_got2-0b@ha addi %r30, %r30, .Lbiased_got2-0b@l lwz %r0, .Lgot_\not_found-.Lbiased_got2(%r30) mtctr %r0 lwz %r30, 8(%r1) lwz %r0, 20(%r1) addi %r1, %r1, 16 mtlr %r0 bctr #else b \not_found #endif .Ltagged_pointer_\name: #if defined(OF_PIC) mflr %r7 bl 0f 0: mflr %r6 mtlr %r7 addis %r6, %r6, .Lbiased_got2-0b@ha addi %r6, %r6, .Lbiased_got2-0b@l lwz %r5, .Lgot_objc_tagged_pointer_secret-.Lbiased_got2(%r6) lwz %r5, 0(%r5) #elif defined(OF_BASEREL) addis %r5, %r13, objc_tagged_pointer_secret@drel@ha lwz %r5, objc_tagged_pointer_secret@drel@l(%r5) #else lis %r5, objc_tagged_pointer_secret@ha lwz %r5, objc_tagged_pointer_secret@l(%r5) #endif xor %r5, %r3, %r5 rlwinm %r5, %r5, 1, 0x1C #if defined(OF_PIC) lwz %r6, .Lgot_objc_tagged_pointer_classes-.Lbiased_got2(%r6) #elif defined(OF_BASEREL) addis %r6, %r13, objc_tagged_pointer_classes@drel@ha addi %r6, %r6, objc_tagged_pointer_classes@drel@l #else lis %r6, objc_tagged_pointer_classes@ha addi %r6, %r6, objc_tagged_pointer_classes@l #endif lwzx %r5, %r6, %r5 lwz %r5, 32(%r5) b .Lmain_\name .type \name, @function .size \name, .-\name .endm |
︙ | ︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | li %r3, 0 blr get_pc: mflr %r3 blr .section .got2, "aw" .Lbiased_got2 = .+0x8000 .Lgot_objc_method_not_found: .long objc_method_not_found .Lgot_objc_method_not_found_stret: .long objc_method_not_found_stret .Lgot_objc_tagged_pointer_secret: .long objc_tagged_pointer_secret .Lgot_objc_tagged_pointer_classes: .long objc_tagged_pointer_classes #ifdef OF_LINUX .section .note.GNU-stack, "", @progbits #endif | > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | li %r3, 0 blr get_pc: mflr %r3 blr #ifdef OF_PIC .section .got2, "aw" .Lbiased_got2 = .+0x8000 .Lgot_objc_method_not_found: .long objc_method_not_found .Lgot_objc_method_not_found_stret: .long objc_method_not_found_stret .Lgot_objc_tagged_pointer_secret: .long objc_tagged_pointer_secret .Lgot_objc_tagged_pointer_classes: .long objc_tagged_pointer_classes #endif #ifdef OF_LINUX .section .note.GNU-stack, "", @progbits #endif |
Modified src/runtime/morphos-clib.h from [252cb36e71] to [8a12dfceaa].
︙ | ︙ | |||
84 85 86 87 88 89 90 | void *glue_objc_hashtable_get(struct objc_hashtable *, const void *); void glue_objc_hashtable_delete(struct objc_hashtable *, const void *); void glue_objc_hashtable_free(struct objc_hashtable *); /* Public functions again */ void glue_objc_setTaggedPointerSecret(uintptr_t); int glue_objc_registerTaggedPointerClass(Class); bool glue_object_isTaggedPointer(id); | < | 84 85 86 87 88 89 90 91 92 | void *glue_objc_hashtable_get(struct objc_hashtable *, const void *); void glue_objc_hashtable_delete(struct objc_hashtable *, const void *); void glue_objc_hashtable_free(struct objc_hashtable *); /* Public functions again */ void glue_objc_setTaggedPointerSecret(uintptr_t); int glue_objc_registerTaggedPointerClass(Class); bool glue_object_isTaggedPointer(id); uintptr_t glue_object_getTaggedPointerValue(id); id glue_objc_createTaggedPointer(int, uintptr_t); |
Modified src/runtime/morphos.fd from [881a580162] to [f88311d1a0].
︙ | ︙ | |||
87 88 89 90 91 92 93 | glue_objc_hashtable_get(table,key)(sysv,r12base) glue_objc_hashtable_delete(table,key)(sysv,r12base) glue_objc_hashtable_free(table)(sysv,r12base) * Public functions again glue_objc_setTaggedPointerSecret(secret)(sysv,r12base) glue_objc_registerTaggedPointerClass(class_)(sysv,r12base) glue_object_isTaggedPointer(object)(sysv,r12base) | < | 87 88 89 90 91 92 93 94 95 96 | glue_objc_hashtable_get(table,key)(sysv,r12base) glue_objc_hashtable_delete(table,key)(sysv,r12base) glue_objc_hashtable_free(table)(sysv,r12base) * Public functions again glue_objc_setTaggedPointerSecret(secret)(sysv,r12base) glue_objc_registerTaggedPointerClass(class_)(sysv,r12base) glue_object_isTaggedPointer(object)(sysv,r12base) glue_object_getTaggedPointerValue(object)(sysv,r12base) glue_objc_createTaggedPointer(class_,value)(sysv,r12base) ##end |
Added src/runtime/mutex.m version [02475a3c36].
> > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../mutex.m" |
Added src/runtime/once.m version [fbcc5fceb4].
> > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../once.m" |
Modified src/runtime/private.h from [8bfde7861e] to [21af80272e].
︙ | ︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | void (*_Nonnull _Unwind_SetIP)(void *_Nonnull, uintptr_t); void (*_Nonnull _Unwind_SetGR)(void *_Nonnull, int, uintptr_t); # ifdef HAVE_SJLJ_EXCEPTIONS void (*_Nonnull _Unwind_SjLj_Resume)(void *_Nonnull); # else void (*_Nonnull _Unwind_Resume)(void *_Nonnull); # endif void (*_Nonnull __register_frame_info)(const void *_Nonnull, void *_Nonnull); void *(*_Nonnull __deregister_frame_info)(const void *_Nonnull); }; #endif #ifdef OBJC_COMPILING_AMIGA_LIBRARY # if defined(__MORPHOS__) # include <ppcinline/macros.h> # define OBJC_M68K_ARG(type, name, reg) type name = (type)REG_##reg; # else # define OBJC_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; # endif # undef stdout # undef stderr | > > > > > > > > | > > | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | void (*_Nonnull _Unwind_SetIP)(void *_Nonnull, uintptr_t); void (*_Nonnull _Unwind_SetGR)(void *_Nonnull, int, uintptr_t); # ifdef HAVE_SJLJ_EXCEPTIONS void (*_Nonnull _Unwind_SjLj_Resume)(void *_Nonnull); # else void (*_Nonnull _Unwind_Resume)(void *_Nonnull); # endif # ifdef OF_AMIGAOS_M68K void (*_Nonnull __register_frame_info)(const void *_Nonnull, void *_Nonnull); void *(*_Nonnull __deregister_frame_info)(const void *_Nonnull); # endif # ifdef OF_MORPHOS void (*_Nonnull __register_frame)(void *_Nonnull); void (*_Nonnull __deregister_frame)(void *_Nonnull); # endif int *_Nonnull (*_Nonnull get_errno)(void); }; #endif #ifdef OBJC_COMPILING_AMIGA_LIBRARY # if defined(__MORPHOS__) # include <ppcinline/macros.h> # define OBJC_M68K_ARG(type, name, reg) type name = (type)REG_##reg; # else # define OBJC_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; # endif # undef stdout # undef stderr # undef errno extern FILE *_Nonnull stdout, *_Nonnull stderr; extern int *_Nonnull objc_get_errno(void); # define errno (*objc_get_errno()) #endif extern void objc_register_all_categories(struct objc_symtab *_Nonnull); extern struct objc_category *_Nullable *_Nullable objc_categories_for_class(Class _Nonnull); extern void objc_unregister_all_categories(void); extern void objc_initialize_class(Class _Nonnull); |
︙ | ︙ |
Added src/runtime/tlskey.m version [805621a000].
> > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../tlskey.m" |
Modified src/socket.m from [2544d0730b] to [3d8eb3c453].
︙ | ︙ | |||
56 57 58 59 60 61 62 | #endif #if defined(OF_HAVE_THREADS) && !defined(OF_AMIGAOS) static of_mutex_t mutex; #endif #if !defined(OF_AMIGAOS) || !defined(OF_HAVE_THREADS) static bool initSuccessful = false; | | > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #endif #if defined(OF_HAVE_THREADS) && !defined(OF_AMIGAOS) static of_mutex_t mutex; #endif #if !defined(OF_AMIGAOS) || !defined(OF_HAVE_THREADS) static bool initSuccessful = false; #endif #ifdef OF_AMIGAOS # ifdef OF_HAVE_THREADS of_tlskey_t of_socket_base_key; # ifdef OF_AMIGAOS4 of_tlskey_t of_socket_interface_key; # endif # else struct Library *SocketBase; |
︙ | ︙ |
Modified tests/OFDataTests.m from [b5f79a4b6c] to [2bd92fc7fc].
︙ | ︙ | |||
32 33 34 35 36 37 38 | OFData *immutable; void *raw[2]; of_range_t range; TEST(@"+[dataWithItemSize:]", (mutable = [OFMutableData dataWithItemSize: 4096])) | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | OFData *immutable; void *raw[2]; of_range_t range; TEST(@"+[dataWithItemSize:]", (mutable = [OFMutableData dataWithItemSize: 4096])) raw[0] = of_alloc(1, 4096); raw[1] = of_alloc(1, 4096); memset(raw[0], 0xFF, 4096); memset(raw[1], 0x42, 4096); TEST(@"-[addItem:]", R([mutable addItem: raw[0]]) && R([mutable addItem: raw[1]])) TEST(@"-[itemAtIndex:]", |
︙ | ︙ |
Modified tests/OFStreamTests.m from [5c572f840c] to [7eb72ee0e3].
︙ | ︙ | |||
67 68 69 70 71 72 73 | { void *pool = objc_autoreleasePoolPush(); size_t pageSize = [OFSystemInfo pageSize]; StreamTester *t = [[[StreamTester alloc] init] autorelease]; OFString *str; char *cstr; | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | { void *pool = objc_autoreleasePoolPush(); size_t pageSize = [OFSystemInfo pageSize]; StreamTester *t = [[[StreamTester alloc] init] autorelease]; OFString *str; char *cstr; cstr = of_alloc(pageSize - 2, 1); memset(cstr, 'X', pageSize - 3); cstr[pageSize - 3] = '\0'; TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] && [(str = [t readLine]) length] == pageSize - 3 && !strcmp(str.UTF8String, cstr)) free(cstr); objc_autoreleasePoolPop(pool); } @end |
Modified utils/ofhttp/OFHTTP.m from [121d87bdd5] to [0d0e8ff125].
︙ | ︙ | |||
300 301 302 303 304 305 306 | _clientHeaders = [[OFMutableDictionary alloc] initWithObject: @"OFHTTP" forKey: @"User-Agent"]; _HTTPClient = [[OFHTTPClient alloc] init]; _HTTPClient.delegate = self; | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | _clientHeaders = [[OFMutableDictionary alloc] initWithObject: @"OFHTTP" forKey: @"User-Agent"]; _HTTPClient = [[OFHTTPClient alloc] init]; _HTTPClient.delegate = self; _buffer = of_alloc(1, [OFSystemInfo pageSize]); } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |