Changes In Branch 1.1 Through [c540d53637] Excluding Merge-Ins
This is equivalent to a diff from f61f430bfb to c540d53637
2024-08-30
| ||
20:43 | forwarding-arm64-elf.S: Fix padding with 4 check-in: eed4e94119 user: js tags: 1.1 | |
2024-08-26
| ||
21:12 | Fix compiling with DJGPP check-in: c540d53637 user: js tags: 1.1 | |
21:12 | Fix compiling with DJGPP check-in: dd49efb579 user: js tags: trunk | |
2024-08-25
| ||
21:39 | Set version to 1.1.7 check-in: 2d82fdbd61 user: js tags: 1.1, 1.1.7-release | |
2024-04-23
| ||
01:00 | Simplify calls to objfw-embed check-in: 569a7aa657 user: js tags: trunk | |
2024-04-22
| ||
00:02 | Merge trunk into 1.1 branch check-in: 69075d7082 user: js tags: 1.1 | |
2024-04-21
| ||
19:55 | Add missing NTAPI for RtlGenRandom check-in: f61f430bfb user: js tags: trunk | |
19:15 | Use RtlGenRandom on Windows if available check-in: 2bcb2bd40f user: js tags: trunk | |
Modified .github/workflows/fedora-mingw.yml from [9e238dad53] to [b651262de0].
︙ | ︙ | |||
8 9 10 11 12 13 14 | include: - prefix: mingw32 triple: i686-w64-mingw32 - prefix: mingw64 triple: x86_64-w64-mingw32 - prefix: ucrt64 triple: x86_64-w64-mingw32ucrt | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | include: - prefix: mingw32 triple: i686-w64-mingw32 - prefix: mingw64 triple: x86_64-w64-mingw32 - prefix: ucrt64 triple: x86_64-w64-mingw32ucrt container: fedora steps: - name: Install dependencies run: | sudo dnf upgrade --refresh -y sudo dnf install -y ${{matrix.prefix}}-gcc ${{matrix.prefix}}-openssl clang autoconf automake make wine - uses: actions/checkout@v4 - name: autogen.sh |
︙ | ︙ |
Deleted .github/workflows/macos-11.yml version [ade6268255].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added .github/workflows/macos-12.yml version [ee9ffcacad].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | name: macos-12 on: [push, pull_request] jobs: tests: runs-on: macos-12 strategy: matrix: configure_flags: - - --disable-threads - --disable-threads --disable-sockets - --disable-threads --disable-files - --disable-threads --disable-sockets --disable-files - --disable-sockets - --disable-sockets --disable-files - --disable-files - --disable-shared steps: - name: Install dependencies run: brew install autoconf automake - uses: actions/checkout@v4 - name: autogen.sh run: ./autogen.sh - name: configure run: ./configure ${{ matrix.configure_flags }} - name: make run: make -j$(sysctl -n hw.logicalcpu) - name: make check run: make check - name: make install run: sudo make install |
Deleted .github/workflows/macos-latest.yml version [2ffa2189c3].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified ChangeLog from [7f06c4f76b] to [5e899eb3a6].
1 2 3 4 5 6 7 8 9 10 11 12 13 | Legend: * Changes of existing features or bugfixes + New features This file only contains the most significant changes. ObjFW 1.1.1 -> ObjFW 1.1.2, 2024-04-20 * Fixes configure script on systems using BusyBox for tr. * Fixes compiling for Haiku. * Fixes -[contentsOfDirectoryAtIRI:] corrupting the stack on Solaris. * Fixes compiling for Wii with newer SDK. * Fixes missing endbr / bti. * Minor optimizations to ARM64 assembly. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | Legend: * Changes of existing features or bugfixes + New features This file only contains the most significant changes. ObjFW 1.1.6 -> ObjFW 1.1.7, 2024-08-25 * Fixes creating OFStrings from C strings with some encodings. * Fixes creating an ASCII C string from an OFString that has been initialized by passing an instance of a custom string class. * Fixes OFINIFile not parsing `=` within `"` correctly. * OFINIFile now allows comments and pairs before the first category. * OFINIFile now allows # for comments. * Hides some private symbols in the runtime library. * Disables UNIX datagram sockets on Hurd as Hurd has incomplete support for UNIX datagram sockets. ObjFW 1.1.5 -> ObjFW 1.1.6, 2024-08-11 * Fixes ObjC++ with GCC. * Adds handling of EINTR in OFKernelEventObserver. * Fixes overriding / reusing stack arguments in super calls on x86. * Makes headers compatible with -Wunused-parameter. ObjFW 1.1.4 -> ObjFW 1.1.5, 2024-07-06 * Fixes MIPS32. * Properly hides private symbols in the runtime so they can't be used accidentally anymore. ObjFW 1.1.3 -> ObjFW 1.1.4, 2024-05-22 * Fixes ofarc failing to extract from stdin on macOS. * Fixes the workaround for missing blx on ARM. * Avoids Clang's integrated assembler on MIPS64 for .S files (as it cannot calcualte the offset between two labels). * Fixes X32 being mistaken for AMD64. ObjFW 1.1.2 -> ObjFW 1.1.3, 2024-05-12 * Fixes +[OFSystemInfo networkInterfaces] on NetBSD. * Properly hides private symbols so they can't be used accidentally anymore. * Adds missing documentation for various functions and macros. * Uses RtlGenRandom to get proper randomness on Windows now. * No longer uses _wutime64, which is buggy in some MinGW distributions. * Only uses blx on ARM if it is available now. * Adds a workaround for OFSubprocess tests on Windows 9x. * Skips symlink tests if symlinks are unavailable. ObjFW 1.1.1 -> ObjFW 1.1.2, 2024-04-20 * Fixes configure script on systems using BusyBox for tr. * Fixes compiling for Haiku. * Fixes -[contentsOfDirectoryAtIRI:] corrupting the stack on Solaris. * Fixes compiling for Wii with newer SDK. * Fixes missing endbr / bti. * Minor optimizations to ARM64 assembly. |
︙ | ︙ |
Modified Doxyfile from [75514e9314] to [ea0872cd8b].
︙ | ︙ | |||
46 47 48 49 50 51 52 | OF_WEAK_UNAVAILABLE= \ SIGHUP \ SIGUSR1 \ SIGUSR2 MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES IGNORE_PREFIX = OF OF_ OT OT_ | > | 46 47 48 49 50 51 52 53 | OF_WEAK_UNAVAILABLE= \ SIGHUP \ SIGUSR1 \ SIGUSR2 MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES IGNORE_PREFIX = OF OF_ OT OT_ EXTRACT_STATIC = yes |
Modified PLATFORMS.md from [2210a2624d] to [48bde990f7].
1 2 3 4 5 6 | Platforms ========= ObjFW is known to work on the following platforms, but should run on many others as well. | < < < < < < < < < < < | | > | < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 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 183 184 185 186 187 188 189 190 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 | Platforms ========= ObjFW is known to work on the following platforms, but should run on many others as well. AmigaOS ------- * OS Versions: 3.1, 4.1 Final Edition Update 1 * Architectures: m68k, PowerPC * Compilers: GCC 6.4.1b (amiga-gcc), GCC 8.3.0 (adtools) * Runtimes: ObjFW Android ------- * OS Versions: 4.0.4, 4.1.2, 6.0.1 * Architectures: ARMv6, ARMv7, ARM64 * Compilers: Clang 3.3, Clang 3.8.0 * Runtimes: ObjFW Bare metal ARM Cortex-M4 ------------------------ * Architectures: ARMv7E-M * Compilers: Clang 3.5 * Runtimes: ObjFW * Notes: Bootloader, libc (newlib) and possibly external RAM required DOS --- * OS Versions: Windows XP DOS Emulation, DOSBox, MS-DOS 6.0, FreeDOS 1.2 * Architectures: x86 * Compilers: DJGPP GCC 4.7.3 (djdev204) * Runtimes: ObjFW DragonFlyBSD ------------ * OS Versions: 3.0, 3.3-DEVELOPMENT * Architectures: AMD64, x86 * Compilers: GCC 4.4.7 * Runtimes: ObjFW FreeBSD ------- * OS Versions: 9.1-rc3, 10.0 * Architectures: AMD64 * Compilers: Clang 3.1, Clang 3.3 * Runtimes: ObjFW GNU/Hurd -------- * OS Versions: 0.9 * Architectures: i686 * Compilers: Clang 14.0.6 * Runtimes: ObjFW Haiku ----- * OS version: r1-alpha4 * Architectures: x86 * Compilers: Clang 3.2, GCC 4.6.3 * Runtimes: ObjFW HP-UX ----- * OS versions: 11i v1, 11i v3 * Architectures: Itanium, PA-RISC 2.0 * Compilers: GCC 4.7.2, GCC 7.5.0 * Runtimes: ObjFW * Notes: Exception handling on Itanium in 32 bit mode is broken, you need to use 64 bit mode by passing `OBJC="gcc -mlp64"` to `configure`. iOS --- * Architectures: ARMv7, ARM64 * Compilers: Clang * Runtimes: Apple Linux ----- * Architectures: Alpha, AMD64, ARMv5, ARMv6, ARMv7, ARM64, Itanium, LoongArch 64, m68k, MIPS (O32), MIPS64 (N64), RISC-V 64, PA-RISC, PowerPC, PowerPC 64, S390x, SuperH-4, x86 * Compilers: Clang 3.0-18.1.1, GCC 4.6-14.1.1 * C libraries: glibc, musl * Runtimes: ObjFW macOS ----- * OS Versions: 10.5, 10.7-10.15, Darling * Architectures: AMD64, PowerPC, PowerPC64, x86 * Compilers: Clang 3.1-10.0, Apple GCC 4.0.1 & 4.2.1 * Runtimes: Apple, ObjFW MiNT ---- * OS Versions: FreeMiNT 1.19 * Architectures: m68k * Runtimes: ObjFW * Compilers: GCC 4.6.4 (MiNT 20130415) * Limitations: No shared libraries, no threads MorphOS ------- * OS Versions: 3.14 * Architectures: PowerPC * Compilers: GCC 9.3.0 * Runtimes: ObjFW NetBSD ------ * OS Versions: 5.1-9.0 * Architectures: AMD64, ARM, ARM (big endian, BE8 mode), MIPS (O32), PowerPC, SPARC, SPARC64, x86 * Compilers: Clang 3.0-3.2, GCC 4.1.3 & 4.5.3 & 7.4.0 * Runtimes: ObjFW Nintendo 3DS ------------ * OS Versions: 9.2.0-20E, 10.5.0-30E / Homebrew Channel 1.1.0 * Architectures: ARM (EABI) * Compilers: GCC 5.3.0 (devkitARM release 45) * Runtimes: ObjFW * Limitations: No threads Nintendo DS ----------- * Architectures: ARM (EABI) * Compilers: GCC 4.8.2 (devkitARM release 42) * Runtimes: ObjFW * Limitations: No threads, no sockets * Notes: File support requires an argv-compatible launcher (such as HBMenu) Nintendo Switch --------------- * OS Versions: yuzu 1093 * Architectures: AArch64 * Compilers: GCC 12.1.0 (devkitA64 release 19) * Runtimes: ObjFW * Limitations: No sockets, no shared libraries, not tested on real hardware OpenBSD ------- * OS Versions: 5.2-6.7 * Architectures: AMD64, MIPS64, PA-RISC, PowerPC, SPARC64 * Compilers: GCC 6.3.0, Clang 4.0 * Runtimes: ObjFW PlayStation Portable -------------------- * OS Versions: 5.00 M33-4 * Architectures: MIPS (EABI) * Compiler: GCC 4.6.2 (devkitPSP release 16) * Runtimes: ObjFW * Limitations: No threads, no sockets QNX --- * OS Versions: 6.5.0 * Architectures: x86 * Compilers: GCC 4.6.1 * Runtimes: ObjFW Solaris ------- * OS Versions: OpenIndiana 2015.03, OpenIndiana 2023.04, Oracle Solaris 11.4 * Architectures: AMD64, x86 * Compilers: Clang 3.4.2, Clang 11.0.0, Clang 13.0.1, GCC 4.8.3, GCC 10.4.0 * Runtimes: ObjFW Wii --- * OS Versions: 4.3E / Homebrew Channel 1.1.0 * Architectures: PowerPC * Compilers: GCC 4.6.3 (devkitPPC release 26) * Runtimes: ObjFW * Limitations: No threads Wii U ----- * OS Versions: Cemu 12.26.2f * Architectures: PowerPC * Compilers: gcc version 12.1.0 (devkitPPC release 41) * Runtimes: ObjFW * Limitations: No files, no threads, no sockets, no shared libraries, not tested on real hardware Windows ------- * OS Versions: 98 SE, NT 4.0, XP, 7, 8, 8.1, 10, 11, Wine * Architectures: AArch64, AMD64, x86 * Compilers: GCC 5.3.0 & 6.2.0 from msys2 (AMD64 & x86), Clang 3.9.0 from msys2 (x86), Clang 10.0 from msys2 (AMD64 & x86), Clang 14.0.4 from msys2 (AArch64) * Runtimes: ObjFW Others ------ Basically, it should run on any POSIX system to which GCC >= 4.6 or a recent Clang version has been ported. If not, please send an e-mail with a bug report. If you successfully ran ObjFW on a platform not listed here, please send an e-mail to js@nil.im so it can be added here! If you have a platform on which ObjFW does not work, please contact me as well! Forwarding ========== As forwarding needs hand-written assembly for each combination of CPU architecture, executable format and calling convention, it is only available for the following platforms (except resolveClassMethod: and |
︙ | ︙ |
Modified README.md from [e80110edc6] to [e9d18f461a].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 | ObjFW is a portable, lightweight framework for the Objective-C language. It enables you to write an application in Objective-C that will run on any platform supported by ObjFW without having to worry about differences between operating systems or various frameworks you would otherwise need if you want to be portable. It supports all modern Objective-C features when using Clang, but is also compatible with GCC ≥ 4.6 to allow maximum portability. ObjFW is intentionally incompatible with Foundation. You can read more about ObjFW on its [homepage](https://objfw.nil.im), including how to install and use it. |
Modified configure.ac from [63f2b5a434] to [14e4536633].
|
| | | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | AC_INIT(ObjFW, 1.1.7, js@nil.im, objfw, https://objfw.nil.im/) AC_CONFIG_SRCDIR(src) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(build-aux/m4) AC_DEFINE(OBJFW_VERSION_MAJOR, 1, [The major version of ObjFW]) AC_DEFINE(OBJFW_VERSION_MINOR, 1, [The minor version of ObjFW]) AC_SUBST(BUNDLE_VERSION, 1.1.7) AC_SUBST(BUNDLE_SHORT_VERSION, 1.1) for i in configure.ac build-aux/m4/*; do AS_IF([test $i -nt configure], [ AC_MSG_ERROR([$i is newer than configure! Run ./autogen.sh!]) ]) done |
︙ | ︙ | |||
301 302 303 304 305 306 307 308 309 310 311 312 313 314 | case "$host" in mips*-*-*) dnl Clang generates MIPS assembly not accepted by GNU as, dnl however, Clang's integrated assembler doesn't accept dnl everything used in ObjFW's assembly files. Therefore, use dnl the integrated assembler for ObjC files, but not for dnl assembly files. OBJCFLAGS="$OBJCFLAGS -integrated-as" OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -integrated-as" ;; i?86-*-darwin* | x86_64-*-darwin*) dnl Don't use -no-integrated-as on Darwin. It breaks building dnl for the iOS simulator. ;; | > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | case "$host" in mips*-*-*) dnl Clang generates MIPS assembly not accepted by GNU as, dnl however, Clang's integrated assembler doesn't accept dnl everything used in ObjFW's assembly files. Therefore, use dnl the integrated assembler for ObjC files, but not for dnl assembly files. ASFLAGS="$ASFLAGS -no-integrated-as" OBJCFLAGS="$OBJCFLAGS -integrated-as" OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -integrated-as" ;; i?86-*-darwin* | x86_64-*-darwin*) dnl Don't use -no-integrated-as on Darwin. It breaks building dnl for the iOS simulator. ;; |
︙ | ︙ | |||
837 838 839 840 841 842 843 844 845 846 847 848 849 850 | AC_MSG_RESULT($fp_endianess) AS_IF([test x"$fp_endianess" = x"unknown"], [ AC_MSG_ERROR( [Floating point implementation does not conform to IEEE 754!])]) case "$host_cpu" in arm* | earm*) AC_MSG_CHECKING(for VFP2 or above) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([], [ #if !defined(__arm64__) && !defined(__aarch64__) && \ !defined(__ARM64_ARCH_8__) __asm__ __volatile__ ( "vstmdb sp!, {d0-d7}" | > > > > > > > > > > > > > > > > > | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | AC_MSG_RESULT($fp_endianess) AS_IF([test x"$fp_endianess" = x"unknown"], [ AC_MSG_ERROR( [Floating point implementation does not conform to IEEE 754!])]) case "$host_cpu" in arm* | earm*) AC_MSG_CHECKING(for blx) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([], [ #if !defined(__arm64__) && !defined(__arch64__) && \ !defined(__ARM64_ARCH_8__) __asm__ __volatile__ ( "blx r12" ); #endif ]) ], [ AC_DEFINE(HAVE_BLX, 1, [Whether we have blx]) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for VFP2 or above) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([], [ #if !defined(__arm64__) && !defined(__aarch64__) && \ !defined(__ARM64_ARCH_8__) __asm__ __volatile__ ( "vstmdb sp!, {d0-d7}" |
︙ | ︙ | |||
2040 2041 2042 2043 2044 2045 2046 | ]) AS_IF([test x"$GOBJC" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith" AC_ARG_ENABLE(werror, AS_HELP_STRING([--disable-werror], [do not build with -Werror])) | | | 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 | ]) AS_IF([test x"$GOBJC" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith" AC_ARG_ENABLE(werror, AS_HELP_STRING([--disable-werror], [do not build with -Werror])) AS_IF([test x"$enable_werror" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Werror" ]) old_OBJCFLAGS="$OBJCFLAGS" OBJCFLAGS="$OBJCFLAGS -Werror" AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to GCC bugs) AC_COMPILE_IFELSE([ |
︙ | ︙ |
Modified extra.mk.in from [22670d3586] to [3b5b2d5c85].
1 2 3 4 5 | OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@ OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@ OBJFW_FRAMEWORK = @OBJFW_FRAMEWORK@ OBJFW_LIB_MAJOR = 1 OBJFW_LIB_MINOR = 1 | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | OBJFW_SHARED_LIB = @OBJFW_SHARED_LIB@ OBJFW_STATIC_LIB = @OBJFW_STATIC_LIB@ OBJFW_FRAMEWORK = @OBJFW_FRAMEWORK@ OBJFW_LIB_MAJOR = 1 OBJFW_LIB_MINOR = 1 OBJFW_LIB_PATCH = 4 OBJFW_LIB_MAJOR_MINOR = ${OBJFW_LIB_MAJOR}.${OBJFW_LIB_MINOR} OBJFWRT_SHARED_LIB = @OBJFWRT_SHARED_LIB@ OBJFWRT_STATIC_LIB = @OBJFWRT_STATIC_LIB@ OBJFWRT_FRAMEWORK = @OBJFWRT_FRAMEWORK@ OBJFWRT_LIB_MAJOR = 1 OBJFWRT_LIB_MINOR = 1 OBJFWRT_LIB_PATCH = 4 OBJFWRT_LIB_MAJOR_MINOR = ${OBJFWRT_LIB_MAJOR}.${OBJFWRT_LIB_MINOR} OBJFWBRIDGE_SHARED_LIB = @OBJFWBRIDGE_SHARED_LIB@ OBJFWBRIDGE_STATIC_LIB = @OBJFWBRIDGE_STATIC_LIB@ OBJFWBRIDGE_FRAMEWORK = @OBJFWBRIDGE_FRAMEWORK@ OBJFWBRIDGE_LIB_MAJOR = 1 OBJFWBRIDGE_LIB_MINOR = 0 |
︙ | ︙ |
Modified generators/unicode/TableGenerator.m from [4286c92f40] to [49e6ad1d3f].
︙ | ︙ | |||
208 209 210 211 212 213 214 | void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#include \"config.h\"\n" @"\n" | | > | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#include \"config.h\"\n" @"\n" @"#import \"unicode.h\"\n" @"\n" @"static const OFUnichar emptyPage[0x100] = { 0 };\n" @"\n"]; /* Write uppercasePage%u */ for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; |
︙ | ︙ | |||
379 380 381 382 383 384 385 | * But from now on, we need the size. */ _uppercaseTableSize++; _lowercaseTableSize++; _titlecaseTableSize++; _caseFoldingTableSize++; | | | | | | | | | | 380 381 382 383 384 385 386 387 388 389 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 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | * But from now on, we need the size. */ _uppercaseTableSize++; _lowercaseTableSize++; _titlecaseTableSize++; _caseFoldingTableSize++; /* Write _OFUnicodeUppercaseTable */ [file writeFormat: @"const OFUnichar *const " @"_OFUnicodeUppercaseTable[0x%X] = {\n\t", _uppercaseTableSize]; for (OFUnichar i = 0; i < _uppercaseTableSize; i++) { if (_uppercaseTableUsed[i]) [file writeFormat: @"uppercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _uppercaseTableSize) { if ((i + 1) % 4 == 0) [file writeString: @",\n\t"]; else [file writeString: @", "]; } } [file writeString: @"\n};\n\n"]; /* Write _OFUnicodeLowercaseTable */ [file writeFormat: @"const OFUnichar *const " @"_OFUnicodeLowercaseTable[0x%X] = {\n\t", _lowercaseTableSize]; for (OFUnichar i = 0; i < _lowercaseTableSize; i++) { if (_lowercaseTableUsed[i]) [file writeFormat: @"lowercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _lowercaseTableSize) { if ((i + 1) % 4 == 0) [file writeString: @",\n\t"]; else [file writeString: @", "]; } } [file writeString: @"\n};\n\n"]; /* Write _OFUnicodeTitlecaseTable */ [file writeFormat: @"const OFUnichar *const " @"_OFUnicodeTitlecaseTable[0x%X] = {\n\t", _titlecaseTableSize]; for (OFUnichar i = 0; i < _titlecaseTableSize; i++) { if (_titlecaseTableUsed[i] == 1) [file writeFormat: @"titlecasePage%u", i]; else if (_titlecaseTableUsed[i] == 2) [file writeFormat: @"uppercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _titlecaseTableSize) { if ((i + 1) % 4 == 0) [file writeString: @",\n\t"]; else [file writeString: @", "]; } } [file writeString: @"\n};\n\n"]; /* Write _OFUnicodeCaseFoldingTable */ [file writeFormat: @"const OFUnichar *const " @"_OFUnicodeCaseFoldingTable[0x%X] = {\n\t", _caseFoldingTableSize]; for (OFUnichar i = 0; i < _caseFoldingTableSize; i++) { if (_caseFoldingTableUsed[i] == 1) [file writeFormat: @"caseFoldingPage%u", i]; else if (_caseFoldingTableUsed[i] == 2) [file writeFormat: @"lowercasePage%u", i]; |
︙ | ︙ | |||
480 481 482 483 484 485 486 | OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#import \"OFString.h\"\n\n"]; [file writeFormat: | | | | | | > | > | > | > | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#import \"OFString.h\"\n\n"]; [file writeFormat: @"#define _OFUnicodeUppercaseTableSize 0x%X\n" @"#define _OFUnicodeLowercaseTableSize 0x%X\n" @"#define _OFUnicodeTitlecaseTableSize 0x%X\n" @"#define _OFUnicodeCaseFoldingTableSize 0x%X\n\n", _uppercaseTableSize, _lowercaseTableSize, _titlecaseTableSize, _caseFoldingTableSize]; [file writeString: @"#ifdef __cplusplus\n" @"extern \"C\" {\n" @"#endif\n" @"extern const OFUnichar *const _Nonnull\n" @" _OFUnicodeUppercaseTable[_OFUnicodeUppercaseTableSize] " @"OF_VISIBILITY_HIDDEN;\n" @"extern const OFUnichar *const _Nonnull\n" @" _OFUnicodeLowercaseTable[_OFUnicodeLowercaseTableSize] " @"OF_VISIBILITY_HIDDEN;\n" @"extern const OFUnichar *const _Nonnull\n" @" _OFUnicodeTitlecaseTable[_OFUnicodeTitlecaseTableSize] " @"OF_VISIBILITY_HIDDEN;\n" @"extern const OFUnichar *const _Nonnull\n" @" _OFUnicodeCaseFoldingTable[_OFUnicodeCaseFoldingTableSize]\n" @" OF_VISIBILITY_HIDDEN;\n" @"#ifdef __cplusplus\n" @"}\n" @"#endif\n"]; objc_autoreleasePoolPop(pool); } @end |
Modified src/OFASPrintF.h from [e19f4f7099] to [934e8a3e26].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFVASPrintF( char *_Nullable *_Nonnull, const char *_Nonnull, va_list) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFASPrintF.m from [e60e10983b] to [862e4e73cc].
︙ | ︙ | |||
419 420 421 422 423 424 425 | if (ctx->lengthModifier != lengthModifierNone) return false; ctx->subformat[ctx->subformatLen - 1] = 's'; { char buffer[5]; | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | if (ctx->lengthModifier != lengthModifierNone) return false; ctx->subformat[ctx->subformatLen - 1] = 's'; { char buffer[5]; size_t len = _OFUTF8StringEncode( va_arg(ctx->arguments, OFUnichar), buffer); if (len == 0) return false; buffer[len] = 0; tmpLen = asprintf(&tmp, ctx->subformat, buffer); |
︙ | ︙ | |||
450 451 452 453 454 455 456 | return false; if ((buffer = malloc((len * 4) + 1)) == NULL) return false; j = 0; for (size_t i = 0; i < len; i++) { | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | return false; if ((buffer = malloc((len * 4) + 1)) == NULL) return false; j = 0; for (size_t i = 0; i < len; i++) { size_t clen = _OFUTF8StringEncode(arg[i], buffer + j); if (clen == 0) { free(buffer); return false; } |
︙ | ︙ | |||
755 756 757 758 759 760 761 | formatFlagsState, formatFieldWidthState, formatLengthModifierState, formatConversionSpecifierState }; int | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | formatFlagsState, formatFieldWidthState, formatLengthModifierState, formatConversionSpecifierState }; int _OFVASPrintF(char **string, const char *format, va_list arguments) { struct Context ctx; ctx.format = format; ctx.formatLen = strlen(format); memset(ctx.subformat, 0, maxSubformatLen + 1); ctx.subformatLen = 0; |
︙ | ︙ |
Modified src/OFApplication.m from [f87eabe4cc] to [a1d7561a5b].
︙ | ︙ | |||
110 111 112 113 114 115 116 | [delegate release]; [[OFNotificationCenter defaultCenter] postNotification: notification]; #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_SOCKETS) && \ defined(OF_AMIGAOS) && !defined(OF_MORPHOS) | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | [delegate release]; [[OFNotificationCenter defaultCenter] postNotification: notification]; #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_SOCKETS) && \ defined(OF_AMIGAOS) && !defined(OF_MORPHOS) _OFSocketDeinit(); #endif } int OFApplicationMain(int *argc, char **argv[], id <OFApplicationDelegate> delegate) { [OFLocale currentLocale]; |
︙ | ︙ |
Modified src/OFArchiveIRIHandler.h from [4bae7280e5] to [e82e471b8d].
︙ | ︙ | |||
23 24 25 26 27 28 29 | @interface OFArchiveIRIHandler: OFIRIHandler @end #ifdef __cplusplus extern "C" { #endif | | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | @interface OFArchiveIRIHandler: OFIRIHandler @end #ifdef __cplusplus extern "C" { #endif extern OFIRI *_OFArchiveIRIHandlerIRIForFileInArchive(OFString *, OFString *, OFIRI *) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFArchiveIRIHandler.m from [0a5674435c] to [4da1115176].
︙ | ︙ | |||
191 192 193 194 195 196 197 | { return (character != '!' && _characterIsMember(_characterSet, @selector(characterIsMember:), character)); } @end OFIRI * | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | { return (character != '!' && _characterIsMember(_characterSet, @selector(characterIsMember:), character)); } @end OFIRI * _OFArchiveIRIHandlerIRIForFileInArchive(OFString *scheme, OFString *pathInArchive, OFIRI *archiveIRI) { static OFOnceControl onceControl = OFOnceControlInitValue; OFMutableIRI *ret = [OFMutableIRI IRIWithScheme: scheme]; void *pool = objc_autoreleasePoolPush(); OFOnce(&onceControl, initPathAllowedCharacters); |
︙ | ︙ |
Modified src/OFBase64.h from [c69641ab41] to [2f3db0b163].
︙ | ︙ | |||
30 31 32 33 34 35 36 | @class OFString; @class OFMutableData; #ifdef __cplusplus extern "C" { #endif | | | > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | @class OFString; @class OFMutableData; #ifdef __cplusplus extern "C" { #endif extern OFString *_OFBase64Encode(const void *, size_t) OF_VISIBILITY_HIDDEN; extern bool _OFBase64Decode(OFMutableData *, const char *, size_t) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFBase64.m from [1bbfb68f90] to [2e8e2f6efd].
︙ | ︙ | |||
39 40 41 42 43 44 45 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 }; OFString * | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 }; OFString * _OFBase64Encode(const void *data, size_t length) { OFMutableString *ret = [OFMutableString string]; uint8_t *buffer = (uint8_t *)data; size_t i; uint8_t rest; char tb[4]; uint32_t sb; |
︙ | ︙ | |||
95 96 97 98 99 100 101 | [ret makeImmutable]; return ret; } bool | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | [ret makeImmutable]; return ret; } bool _OFBase64Decode(OFMutableData *data, const char *string, size_t length) { const uint8_t *buffer = (const uint8_t *)string; size_t i; if ((length & 3) != 0) return false; |
︙ | ︙ |
Modified src/OFBlock.m from [e8eabc79e2] to [22b6fb4345].
︙ | ︙ | |||
128 129 130 131 132 133 134 | 0, NULL, 3, 0, { &_NSConcreteStackBlock, &_NSConcreteGlobalBlock, &_NSConcreteMallocBlock, NULL } }; | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | 0, NULL, 3, 0, { &_NSConcreteStackBlock, &_NSConcreteGlobalBlock, &_NSConcreteMallocBlock, NULL } }; static struct _objc_module module = { 8, sizeof(module), NULL, (struct objc_symtab *)&symtab }; OF_CONSTRUCTOR() { __objc_exec_class(&module); } |
︙ | ︙ |
Modified src/OFCRC16.h from [3f16abe72b] to [53c7fedb47].
︙ | ︙ | |||
25 26 27 28 29 30 31 | #endif #import "macros.h" #ifdef __cplusplus extern "C" { #endif | | | | 25 26 27 28 29 30 31 32 33 34 35 36 | #endif #import "macros.h" #ifdef __cplusplus extern "C" { #endif extern uint16_t _OFCRC16(uint16_t crc, const void *_Nonnull bytes, size_t length) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif |
Modified src/OFCRC16.m from [84c30fd412] to [d62b8e5364].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "config.h" #import "OFCRC16.h" static const uint16_t CRC16Magic = 0xA001; uint16_t | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #import "OFCRC16.h" static const uint16_t CRC16Magic = 0xA001; uint16_t _OFCRC16(uint16_t CRC, const void *bytes_, size_t length) { const unsigned char *bytes = bytes_; for (size_t i = 0; i < length; i++) { CRC ^= bytes[i]; for (uint8_t j = 0; j < 8; j++) |
︙ | ︙ |
Modified src/OFCRC32.h from [8d31bcaac4] to [24126b7a03].
︙ | ︙ | |||
25 26 27 28 29 30 31 | #endif #import "macros.h" #ifdef __cplusplus extern "C" { #endif | | | | 25 26 27 28 29 30 31 32 33 34 35 36 | #endif #import "macros.h" #ifdef __cplusplus extern "C" { #endif extern uint32_t _OFCRC32(uint32_t crc, const void *_Nonnull bytes, size_t length) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif |
Modified src/OFCRC32.m from [9efe742312] to [033a9d1abd].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "config.h" #import "OFCRC32.h" static const uint32_t CRC32Magic = 0xEDB88320; uint32_t | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #import "OFCRC32.h" static const uint32_t CRC32Magic = 0xEDB88320; uint32_t _OFCRC32(uint32_t CRC, const void *bytes_, size_t length) { const unsigned char *bytes = bytes_; for (size_t i = 0; i < length; i++) { CRC ^= bytes[i]; for (uint8_t j = 0; j < 8; j++) |
︙ | ︙ |
Modified src/OFConcreteValue.m from [8933b62636] to [4982399c1c].
︙ | ︙ | |||
27 28 29 30 31 32 33 | - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType { self = [super initWithBytes: bytes objCType: objCType]; @try { _size = OFSizeOfTypeEncoding(objCType); | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType { self = [super initWithBytes: bytes objCType: objCType]; @try { _size = OFSizeOfTypeEncoding(objCType); _objCType = _OFStrDup(objCType); _bytes = OFAllocMemory(1, _size); memcpy(_bytes, bytes, _size); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/OFConstantString.m from [cde23b7b44] to [e20d1bfa3e].
︙ | ︙ | |||
93 94 95 96 97 98 99 | if ([self isMemberOfClass: [OFConstantUTF8String class]]) return; ivars = OFAllocZeroedMemory(1, sizeof(*ivars)); ivars->cString = _cString; ivars->cStringLength = _cStringLength; | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | if ([self isMemberOfClass: [OFConstantUTF8String class]]) return; ivars = OFAllocZeroedMemory(1, sizeof(*ivars)); ivars->cString = _cString; ivars->cStringLength = _cStringLength; switch (_OFUTF8StringCheck(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: ivars->isUTF8 = true; break; case -1: OFFreeMemory(ivars); @throw [OFInvalidEncodingException exception]; |
︙ | ︙ |
Modified src/OFDDPSocket.m from [9c71163b23] to [ff7f44acd0].
︙ | ︙ | |||
101 102 103 104 105 106 107 | #endif @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port protocolType: protocolType socket: self | | | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | #endif @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port protocolType: protocolType socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port protocolType: protocolType socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyAppleTalk; address.length = (socklen_t)sizeof(address.sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address.sockaddr, &address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node |
︙ | ︙ | |||
169 170 171 172 173 174 175 | struct ATInterfaceConfig), &config) != 0) @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port protocolType: protocolType socket: self | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | struct ATInterfaceConfig), &config) != 0) @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port protocolType: protocolType socket: self errNo: _OFSocketErrNo()]; OFSocketAddressSetAppleTalkNetwork(&address, config.address.s_net); OFSocketAddressSetAppleTalkNode(&address, config.address.s_node); #endif #if !defined(OF_MACOS) && !defined(OF_WINDOWS) _protocolType = protocolType; |
︙ | ︙ | |||
223 224 225 226 227 228 229 | if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if ((ret = recvmsg(_socket, &msg, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if ((ret = recvmsg(_socket, &msg, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; if (ret < 1 || protocolType != _protocolType) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: ENOMSG]; if (sender != NULL) { |
︙ | ︙ | |||
262 263 264 265 266 267 268 | @throw [OFNotOpenException exceptionWithObject: self]; if ((bytesWritten = sendmsg(_socket, &msg, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | @throw [OFNotOpenException exceptionWithObject: self]; if ((bytesWritten = sendmsg(_socket, &msg, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; if ((size_t)bytesWritten != length + 1) { bytesWritten--; if (bytesWritten < 0) bytesWritten = 0; |
︙ | ︙ |
Modified src/OFDNSResolver.m from [ae23ada8bd] to [8787fec7e7].
︙ | ︙ | |||
620 621 622 623 624 625 626 | @implementation OFDNSResolver #ifdef OF_AMIGAOS + (void)initialize { if (self != [OFDNSResolver class]) return; | | | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | @implementation OFDNSResolver #ifdef OF_AMIGAOS + (void)initialize { if (self != [OFDNSResolver class]) return; if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: self]; } #endif + (instancetype)resolver { |
︙ | ︙ |
Modified src/OFData+CryptographicHashing.h from [d846d34b23] to [5b986251d6].
︙ | ︙ | |||
22 23 24 25 26 27 28 | OF_ASSUME_NONNULL_BEGIN @class OFString; #ifdef __cplusplus extern "C" { #endif | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | OF_ASSUME_NONNULL_BEGIN @class OFString; #ifdef __cplusplus extern "C" { #endif extern int _OFData_CryptographicHashing_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFData (CryptographicHashing) /** * @brief The MD5 hash of the data as a string. |
︙ | ︙ |
Modified src/OFData+MessagePackParsing.h from [6de5acbf5d] to [958119ddca].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFData.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFData.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFData_MessagePackParsing_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFData (MessagePackParsing) /** * @brief The data interpreted as MessagePack representation and parsed as an |
︙ | ︙ |
Modified src/OFData.m from [4dc9cb934e] to [1f60c6d11f].
︙ | ︙ | |||
50 51 52 53 54 55 56 | Class isa; } placeholder; @interface OFPlaceholderData: OFString @end /* References for static linking */ | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | Class isa; } placeholder; @interface OFPlaceholderData: OFString @end /* References for static linking */ void OF_VISIBILITY_HIDDEN _references_to_categories_of_OFData(void) { _OFData_CryptographicHashing_reference = 1; _OFData_MessagePackParsing_reference = 1; } @implementation OFPlaceholderData |
︙ | ︙ | |||
401 402 403 404 405 406 407 | { void *pool = objc_autoreleasePoolPush(); OFMutableData *data; @try { data = [OFMutableData data]; | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | { void *pool = objc_autoreleasePoolPush(); OFMutableData *data; @try { data = [OFMutableData data]; if (!_OFBase64Decode(data, [string cStringWithEncoding: OFStringEncodingASCII], [string cStringLengthWithEncoding: OFStringEncodingASCII])) @throw [OFInvalidFormatException exception]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
621 622 623 624 625 626 627 | [ret makeImmutable]; return ret; } - (OFString *)stringByBase64Encoding { | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | [ret makeImmutable]; return ret; } - (OFString *)stringByBase64Encoding { return _OFBase64Encode(self.items, self.count * self.itemSize); } - (OFRange)rangeOfData: (OFData *)data options: (OFDataSearchOptions)options range: (OFRange)range { const unsigned char *items = self.items; |
︙ | ︙ |
Modified src/OFDatagramSocket.m from [65c253c5c9] to [9ad188ca92].
︙ | ︙ | |||
56 57 58 59 60 61 62 | @synthesize delegate = _delegate; + (void)initialize { if (self != [OFDatagramSocket class]) return; | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | @synthesize delegate = _delegate; + (void)initialize { if (self != [OFDatagramSocket class]) return; if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (instancetype)socket { return [[[self alloc] init] autorelease]; |
︙ | ︙ | |||
132 133 134 135 136 137 138 | _canBlock = canBlock; #elif defined(OF_WINDOWS) u_long v = !canBlock; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithObject: self | | | | | 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 | _canBlock = canBlock; #elif defined(OF_WINDOWS) u_long v = !canBlock; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; _canBlock = canBlock; #else OF_UNRECOGNIZED_SELECTOR #endif } - (void)setCanSendToBroadcastAddresses: (bool)canSendToBroadcastAddresses { int v = canSendToBroadcastAddresses; if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; #ifdef OF_WII _canSendToBroadcastAddresses = canSendToBroadcastAddresses; #endif } - (bool)canSendToBroadcastAddresses { #ifndef OF_WII int v; socklen_t len = sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; return v; #else return _canSendToBroadcastAddresses; #endif } |
︙ | ︙ | |||
192 193 194 195 196 197 198 | #ifndef OF_WINDOWS if ((ret = recvfrom(_socket, buffer, length, 0, (sender != NULL ? (struct sockaddr *)&sender->sockaddr : NULL), (sender != NULL ? &sender->length : NULL))) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length | | | | 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 | #ifndef OF_WINDOWS if ((ret = recvfrom(_socket, buffer, length, 0, (sender != NULL ? (struct sockaddr *)&sender->sockaddr : NULL), (sender != NULL ? &sender->length : NULL))) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recvfrom(_socket, buffer, (int)length, 0, (sender != NULL ? (struct sockaddr *)&sender->sockaddr : NULL), (sender != NULL ? &sender->length : NULL))) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #endif if (sender != NULL) { struct sockaddr *sa = (struct sockaddr *)&sender->sockaddr; if (sender->length >= (socklen_t)sizeof(sa->sa_family)) { switch (sa->sa_family) { |
︙ | ︙ | |||
310 311 312 313 314 315 316 | if ((bytesWritten = sendto(_socket, (void *)buffer, length, 0, (struct sockaddr *)&receiver->sockaddr, receiver->length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 | | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | if ((bytesWritten = sendto(_socket, (void *)buffer, length, 0, (struct sockaddr *)&receiver->sockaddr, receiver->length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #else int bytesWritten; if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = sendto(_socket, buffer, (int)length, 0, (struct sockaddr *)&receiver->sockaddr, receiver->length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #endif if ((size_t)bytesWritten != length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: bytesWritten errNo: 0]; |
︙ | ︙ |
Modified src/OFDate.m from [ae00d275b0] to [ddae0ab707].
︙ | ︙ | |||
275 276 277 278 279 280 281 | if (seconds == 0) { static OFOnceControl once = OFOnceControlInitValue; OFOnce(&once, initZeroDate); return (id)zeroDate; } #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | if (seconds == 0) { static OFOnceControl once = OFOnceControlInitValue; OFOnce(&once, initZeroDate); return (id)zeroDate; } #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX value = OFFromBigEndian64(OFBitConvertDoubleToUInt64( OFToBigEndianDouble(seconds))); /* Almost all dates fall into this range. */ if (value & (UINT64_C(4) << 60)) { id ret = [OFTaggedPointerDate dateWithUInt64TimeIntervalSince1970: value]; if (ret != nil) |
︙ | ︙ | |||
411 412 413 414 415 416 417 | format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; short tz = 0; | | | | | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; short tz = 0; if (_OFStrPTime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, tz)]; } - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; /* * _OFStrPTime() can never set this to SHRT_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ short tz = SHRT_MAX; OFTimeInterval seconds; if (_OFStrPTime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; if (tz == SHRT_MAX) { #ifdef OF_WINDOWS if (_mktime64FuncPtr != NULL) { if ((seconds = _mktime64FuncPtr(&tm)) == -1) |
︙ | ︙ | |||
689 690 691 692 693 694 695 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { | | | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { if (_OFStrFTime(buffer, pageSize, format.UTF8String, &tm, 0) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { OFFreeMemory(buffer); } |
︙ | ︙ | |||
738 739 740 741 742 743 744 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { | | | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { if (_OFStrFTime(buffer, pageSize, format.UTF8String, &tm, 0) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { OFFreeMemory(buffer); } |
︙ | ︙ |
Modified src/OFEmbeddedIRIHandler.m from [0aa22bc193] to [275cbe280f].
︙ | ︙ | |||
31 32 33 34 35 36 37 | #import "OFOpenItemFailedException.h" #ifdef OF_HAVE_THREADS # import "OFOnce.h" # import "OFPlainMutex.h" #endif | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #import "OFOpenItemFailedException.h" #ifdef OF_HAVE_THREADS # import "OFOnce.h" # import "OFPlainMutex.h" #endif static struct EmbeddedFile { OFString *path; const uint8_t *bytes; size_t size; } *embeddedFiles = NULL; static size_t numEmbeddedFiles = 0; #ifdef OF_HAVE_THREADS static OFPlainMutex mutex; static OFOnceControl mutexOnceControl = OFOnceControlInitValue; static void initMutex(void) { |
︙ | ︙ |
Modified src/OFGZIPStream.m from [ba433e4a1c] to [7c25979fa6].
︙ | ︙ | |||
244 245 246 247 248 249 250 | initWithStream: _stream]; if (!_inflateStream.atEndOfStream) { size_t bytesRead = [_inflateStream readIntoBuffer: buffer length: length]; | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | initWithStream: _stream]; if (!_inflateStream.atEndOfStream) { size_t bytesRead = [_inflateStream readIntoBuffer: buffer length: length]; _CRC32 = _OFCRC32(_CRC32, buffer, bytesRead); _uncompressedSize += bytesRead; return bytesRead; } [_inflateStream release]; _inflateStream = nil; |
︙ | ︙ |
Modified src/OFHTTPServer.m from [61bb060e07] to [c0539be083].
︙ | ︙ | |||
121 122 123 124 125 126 127 | - (void)stop; @end #endif static OFString * normalizedKey(OFString *key) { | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | - (void)stop; @end #endif static OFString * normalizedKey(OFString *key) { char *cString = _OFStrDup(key.UTF8String); unsigned char *tmp = (unsigned char *)cString; bool firstLetter = true; OFString *ret; while (*tmp != '\0') { if (!OFASCIIIsAlpha(*tmp)) { firstLetter = true; |
︙ | ︙ |
Modified src/OFHuffmanTree.h from [3269a83550] to [e004c2a98a].
︙ | ︙ | |||
29 30 31 32 33 34 35 | typedef struct _OFHuffmanTree { struct _OFHuffmanTree *_Nullable leaves[2]; uint16_t value; } *OFHuffmanTree; /* Inlined for performance. */ static OF_INLINE bool | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | typedef struct _OFHuffmanTree { struct _OFHuffmanTree *_Nullable leaves[2]; uint16_t value; } *OFHuffmanTree; /* Inlined for performance. */ static OF_INLINE bool _OFHuffmanTreeWalk(id _Nullable stream, bool (*bitReader)(id _Nullable, uint16_t *_Nonnull, uint8_t), OFHuffmanTree _Nonnull *_Nonnull tree, uint16_t *_Nonnull value) { OFHuffmanTree iter = *tree; uint16_t bits; while (iter->value == 0xFFFF) { |
︙ | ︙ | |||
55 56 57 58 59 60 61 | *value = iter->value; return true; } #ifdef __cplusplus extern "C" { #endif | | | | > | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | *value = iter->value; return true; } #ifdef __cplusplus extern "C" { #endif extern OFHuffmanTree _Nonnull _OFHuffmanTreeNew(uint8_t lengths[_Nonnull], uint16_t count) OF_VISIBILITY_HIDDEN; extern OFHuffmanTree _Nonnull _OFHuffmanTreeNewSingle(uint16_t value) OF_VISIBILITY_HIDDEN; extern void _OFHuffmanTreeFree(OFHuffmanTree _Nonnull tree) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFHuffmanTree.m from [7caeda826b] to [02fde5269c].
︙ | ︙ | |||
54 55 56 57 58 59 60 | tree = tree->leaves[bit]; } tree->value = value; } OFHuffmanTree | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | tree = tree->leaves[bit]; } tree->value = value; } OFHuffmanTree _OFHuffmanTreeNew(uint8_t lengths[], uint16_t count) { OFHuffmanTree tree; uint16_t *lengthCount = NULL; uint16_t code, maxCode = 0, *nextCode = NULL; uint_fast8_t maxBit = 0; @try { |
︙ | ︙ | |||
109 110 111 112 113 114 115 | OFFreeMemory(nextCode); } return tree; } OFHuffmanTree | | | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | OFFreeMemory(nextCode); } return tree; } OFHuffmanTree _OFHuffmanTreeNewSingle(uint16_t value) { OFHuffmanTree tree = newTree(); tree->value = value; return tree; } void _OFHuffmanTreeFree(OFHuffmanTree tree) { for (uint_fast8_t i = 0; i < 2; i++) if OF_LIKELY (tree->leaves[i] != NULL) _OFHuffmanTreeFree(tree->leaves[i]); OFFreeMemory(tree); } |
Modified src/OFINICategory.m from [0e47b76592] to [06ae24a12e].
︙ | ︙ | |||
47 48 49 50 51 52 53 | { OFMutableString *mutableString; /* FIXME: Optimize */ if (![string hasPrefix: @" "] && ![string hasPrefix: @"\t"] && ![string hasPrefix: @"\f"] && ![string hasSuffix: @" "] && ![string hasSuffix: @"\t"] && ![string hasSuffix: @"\f"] && | | < < < < < < < < < < < < < < < < < < < < < < | 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 72 73 74 | { OFMutableString *mutableString; /* FIXME: Optimize */ if (![string hasPrefix: @" "] && ![string hasPrefix: @"\t"] && ![string hasPrefix: @"\f"] && ![string hasSuffix: @" "] && ![string hasSuffix: @"\t"] && ![string hasSuffix: @"\f"] && ![string containsString: @"\""] && ![string containsString: @"="]) return string; mutableString = [[string mutableCopy] autorelease]; [mutableString replaceOccurrencesOfString: @"\\" withString: @"\\\\"]; [mutableString replaceOccurrencesOfString: @"\f" withString: @"\\f"]; [mutableString replaceOccurrencesOfString: @"\r" withString: @"\\r"]; [mutableString replaceOccurrencesOfString: @"\n" withString: @"\\n"]; [mutableString replaceOccurrencesOfString: @"\"" withString: @"\\\""]; [mutableString insertString: @"\"" atIndex: 0]; [mutableString appendString: @"\""]; [mutableString makeImmutable]; return mutableString; } @implementation OFINICategoryPair - (void)dealloc |
︙ | ︙ | |||
147 148 149 150 151 152 153 154 | - (void)dealloc { [_name release]; [_lines release]; [super dealloc]; } | | > > | > | | > > > > | > > | | | > > | > | | | > | | | > > > > > > > > > | > | > > > > > > > | > > | > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | 125 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 183 184 185 186 187 188 189 190 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 256 257 258 259 260 261 | - (void)dealloc { [_name release]; [_lines release]; [super dealloc]; } static void parseQuoted(const char **cString, const char **start, size_t *length) { bool inEscape = false; (*cString)++; *start = *cString; while (**cString != '\0') { if (inEscape) inEscape = false; else { if (**cString == '\\') inEscape = true; else if (**cString == '"') break; } (*cString)++; } if (**cString == '\0') @throw [OFInvalidFormatException exception]; *length = *cString - *start; (*cString)++; while (OFASCIIIsSpace(**cString)) (*cString)++; } static void unescapeMutableString(OFMutableString *string) { [string replaceOccurrencesOfString: @"\\f" withString: @"\f"]; [string replaceOccurrencesOfString: @"\\r" withString: @"\r"]; [string replaceOccurrencesOfString: @"\\n" withString: @"\n"]; [string replaceOccurrencesOfString: @"\\\"" withString: @"\""]; [string replaceOccurrencesOfString: @"\\\\" withString: @"\\"]; } - (void)of_parseLine: (OFString *)line { void *pool = objc_autoreleasePoolPush(); const char *cString = line.UTF8String; bool keyIsQuoted = false, valueIsQuoted = false; const char *keyStart, *valueStart; size_t keyLength, valueLength; OFMutableString *key, *value; OFINICategoryPair *pair; while (OFASCIIIsSpace(*cString)) cString++; if (*cString == ';' || *cString == '#') { OFINICategoryComment *comment = [[[OFINICategoryComment alloc] init] autorelease]; comment->_comment = [line copy]; [_lines addObject: comment]; return; } if (*cString == '"') { keyIsQuoted = true; parseQuoted(&cString, &keyStart, &keyLength); } else { keyStart = cString; while (*cString != '=' && *cString != '\0') cString++; keyLength = cString - keyStart; } if (*cString != '=') @throw [OFInvalidFormatException exception]; cString++; while (OFASCIIIsSpace(*cString)) cString++; if (*cString == '"') { valueIsQuoted = true; parseQuoted(&cString, &valueStart, &valueLength); } else { valueStart = cString; while (*cString != '\0') cString++; valueLength = cString - valueStart; } while (*cString != '\0') { if (!OFASCIIIsSpace(*cString)) @throw [OFInvalidFormatException exception]; cString++; } key = [OFMutableString stringWithUTF8String: keyStart length: keyLength]; value = [OFMutableString stringWithUTF8String: valueStart length: valueLength]; if (keyIsQuoted) unescapeMutableString(key); else [key deleteEnclosingWhitespaces]; if (valueIsQuoted) unescapeMutableString(value); else [value deleteEnclosingWhitespaces]; [key makeImmutable]; [value makeImmutable]; pair = [[[OFINICategoryPair alloc] init] autorelease]; pair->_key = [key copy]; pair->_value = [value copy]; [_lines addObject: pair]; objc_autoreleasePoolPop(pool); } - (OFString *)stringValueForKey: (OFString *)key { return [self stringValueForKey: key defaultValue: nil]; } |
︙ | ︙ | |||
475 476 477 478 479 480 481 | - (bool)of_writeToStream: (OFStream *)stream encoding: (OFStringEncoding)encoding first: (bool)first { if (_lines.count == 0) return false; | > | | | | > | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | - (bool)of_writeToStream: (OFStream *)stream encoding: (OFStringEncoding)encoding first: (bool)first { if (_lines.count == 0) return false; if (_name.length > 0) { if (first) [stream writeFormat: @"[%@]\r\n", _name]; else [stream writeFormat: @"\r\n[%@]\r\n", _name]; } for (id line in _lines) { if ([line isKindOfClass: [OFINICategoryComment class]]) { OFINICategoryComment *comment = line; [stream writeFormat: @"%@\r\n", comment->_comment]; } else if ([line isKindOfClass: [OFINICategoryPair class]]) { OFINICategoryPair *pair = line; |
︙ | ︙ |
Modified src/OFINIFile.m from [8879da27e2] to [ff94a45bd6].
︙ | ︙ | |||
75 76 77 78 79 80 81 | } - (instancetype)initWithIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { self = [super init]; @try { | | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | } - (instancetype)initWithIRI: (OFIRI *)IRI encoding: (OFStringEncoding)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] initWithObject: [[[OFINICategory alloc] of_initWithName: @""] autorelease]]; [self of_parseIRI: IRI encoding: encoding]; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 | OFString *categoryName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: OFMakeRange(1, line.length - 2)]; category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) | > > > | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | OFString *categoryName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: OFMakeRange(1, line.length - 2)]; if (categoryName.length == 0) @throw [OFInvalidFormatException exception]; category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) category = [self categoryForName: @""]; [category of_parseLine: line]; } } objc_autoreleasePoolPop(pool); } |
︙ | ︙ |
Modified src/OFIPXSocket.m from [71dcaf90af] to [a4ad2996ac].
︙ | ︙ | |||
65 66 67 68 69 70 71 | SOCK_DGRAM | SOCK_CLOEXEC, protocol)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: packetType socket: self | | | | | | 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 | SOCK_DGRAM | SOCK_CLOEXEC, protocol)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: packetType socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: packetType socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyIPX; address.length = (socklen_t)sizeof(address.sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address.sockaddr, &address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node |
︙ | ︙ |
Modified src/OFIRI.h from [46c48a2808] to [6f424a4bd0].
︙ | ︙ | |||
407 408 409 410 411 412 413 | */ + (OFCharacterSet *)IRIFragmentAllowedCharacterSet; @end #ifdef __cplusplus extern "C" { #endif | | | > | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | */ + (OFCharacterSet *)IRIFragmentAllowedCharacterSet; @end #ifdef __cplusplus extern "C" { #endif extern bool _OFIRIIsIPv6Host(OFString *host) OF_VISIBILITY_HIDDEN; extern void _OFIRIVerifyIsEscaped(OFString *, OFCharacterSet *, bool) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END #import "OFMutableIRI.h" |
Modified src/OFIRI.m from [8ff2bb9721] to [47f2aa9acb].
︙ | ︙ | |||
116 117 118 119 120 121 122 | initIRIFragmentAllowedCharacterSet(void) { IRIFragmentAllowedCharacterSet = [[OFIRIFragmentAllowedCharacterSet alloc] init]; } bool | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | initIRIFragmentAllowedCharacterSet(void) { IRIFragmentAllowedCharacterSet = [[OFIRIFragmentAllowedCharacterSet alloc] init]; } bool _OFIRIIsIPv6Host(OFString *host) { const char *UTF8String = host.UTF8String; bool hasColon = false; while (*UTF8String != '\0') { if (!OFASCIIIsDigit(*UTF8String) && *UTF8String != ':' && (*UTF8String < 'a' || *UTF8String > 'f') && |
︙ | ︙ | |||
417 418 419 420 421 422 423 | { return (character != '%' && !_characterIsMember(_characterSet, @selector(characterIsMember:), character)); } @end void | | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | { return (character != '%' && !_characterIsMember(_characterSet, @selector(characterIsMember:), character)); } @end void _OFIRIVerifyIsEscaped(OFString *string, OFCharacterSet *characterSet, bool allowPercent) { void *pool = objc_autoreleasePoolPush(); if (allowPercent) characterSet = [[[OFInvertedCharacterSetWithoutPercent alloc] initWithCharacterSet: characterSet] autorelease]; |
︙ | ︙ | |||
540 541 542 543 544 545 546 | self->_percentEncodedUser = [[OFString alloc] initWithUTF8String: UTF8String length: colon - UTF8String]; self->_percentEncodedPassword = [[OFString alloc] initWithUTF8String: colon + 1 length: length - (colon - UTF8String) - 1]; | | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | self->_percentEncodedUser = [[OFString alloc] initWithUTF8String: UTF8String length: colon - UTF8String]; self->_percentEncodedPassword = [[OFString alloc] initWithUTF8String: colon + 1 length: length - (colon - UTF8String) - 1]; _OFIRIVerifyIsEscaped(self->_percentEncodedPassword, [OFCharacterSet IRIPasswordAllowedCharacterSet], true); } else self->_percentEncodedUser = [[OFString alloc] initWithUTF8String: UTF8String length: length]; _OFIRIVerifyIsEscaped(self->_percentEncodedUser, [OFCharacterSet IRIUserAllowedCharacterSet], true); } static void parseHostPort(OFIRI *self, const char *UTF8String, size_t length) { OFString *portString; |
︙ | ︙ | |||
593 594 595 596 597 598 599 | initWithUTF8String: UTF8String length: length]; UTF8String += length; length = 0; } | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | initWithUTF8String: UTF8String length: length]; UTF8String += length; length = 0; } _OFIRIVerifyIsEscaped(self->_percentEncodedHost, [OFCharacterSet IRIHostAllowedCharacterSet], true); } if (length == 0) return; if (length <= 1 || *UTF8String != ':') |
︙ | ︙ | |||
653 654 655 656 657 658 659 | const char *fragment, *query; if ((fragment = memchr(UTF8String, '#', length)) != NULL) { *fragmentString = [OFString stringWithUTF8String: fragment + 1 length: length - (fragment - UTF8String) - 1]; | | | | | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | const char *fragment, *query; if ((fragment = memchr(UTF8String, '#', length)) != NULL) { *fragmentString = [OFString stringWithUTF8String: fragment + 1 length: length - (fragment - UTF8String) - 1]; _OFIRIVerifyIsEscaped(*fragmentString, [OFCharacterSet IRIQueryAllowedCharacterSet], true); length = fragment - UTF8String; } if ((query = memchr(UTF8String, '?', length)) != NULL) { *queryString = [OFString stringWithUTF8String: query + 1 length: length - (query - UTF8String) - 1]; _OFIRIVerifyIsEscaped(*queryString, [OFCharacterSet IRIFragmentAllowedCharacterSet], true); length = query - UTF8String; } *pathString = [OFString stringWithUTF8String: UTF8String length: length]; _OFIRIVerifyIsEscaped(*pathString, [OFCharacterSet IRIPathAllowedCharacterSet], true); } - (instancetype)initWithString: (OFString *)string { self = [super init]; |
︙ | ︙ | |||
696 697 698 699 700 701 702 | colon - UTF8String < 1 || !OFASCIIIsAlpha(UTF8String[0])) @throw [OFInvalidFormatException exception]; _scheme = [[[OFString stringWithUTF8String: UTF8String length: colon - UTF8String] lowercaseString] copy]; | | | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | colon - UTF8String < 1 || !OFASCIIIsAlpha(UTF8String[0])) @throw [OFInvalidFormatException exception]; _scheme = [[[OFString stringWithUTF8String: UTF8String length: colon - UTF8String] lowercaseString] copy]; _OFIRIVerifyIsEscaped(_scheme, [OFCharacterSet IRISchemeAllowedCharacterSet], false); length -= colon - UTF8String + 1; UTF8String = colon + 1; if (length >= 2 && UTF8String[0] == '/' && UTF8String[1] == '/') { |
︙ | ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | - (OFString *)host { if ([_percentEncodedHost hasPrefix: @"["] && [_percentEncodedHost hasSuffix: @"]"]) { OFString *host = [_percentEncodedHost substringWithRange: OFMakeRange(1, _percentEncodedHost.length - 2)]; | | | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | - (OFString *)host { if ([_percentEncodedHost hasPrefix: @"["] && [_percentEncodedHost hasSuffix: @"]"]) { OFString *host = [_percentEncodedHost substringWithRange: OFMakeRange(1, _percentEncodedHost.length - 2)]; if (!_OFIRIIsIPv6Host(host)) @throw [OFInvalidArgumentException exception]; return host; } return _percentEncodedHost.stringByRemovingPercentEncoding; } |
︙ | ︙ |
Modified src/OFInflateStream.m from [5f2d55b677] to [ee0deaa4d9].
︙ | ︙ | |||
160 161 162 163 164 165 166 | for (uint16_t i = 144; i <= 255; i++) lengths[i] = 9; for (uint16_t i = 256; i <= 279; i++) lengths[i] = 7; for (uint16_t i = 280; i <= 287; i++) lengths[i] = 8; | | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | for (uint16_t i = 144; i <= 255; i++) lengths[i] = 9; for (uint16_t i = 256; i <= 279; i++) lengths[i] = 7; for (uint16_t i = 280; i <= 287; i++) lengths[i] = 8; fixedLitLenTree = _OFHuffmanTreeNew(lengths, 288); for (uint16_t i = 0; i <= 31; i++) lengths[i] = 5; fixedDistTree = _OFHuffmanTreeNew(lengths, 32); } + (instancetype)streamWithStream: (OFStream *)stream { return [[[self alloc] initWithStream: stream] autorelease]; } |
︙ | ︙ | |||
213 214 215 216 217 218 219 | OFFreeMemory(_slidingWindow); if (_state == stateHuffmanTree) { OFFreeMemory(_context.huffmanTree.lengths); if (_context.huffmanTree.codeLenTree != NULL) | | | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | OFFreeMemory(_slidingWindow); if (_state == stateHuffmanTree) { OFFreeMemory(_context.huffmanTree.lengths); if (_context.huffmanTree.codeLenTree != NULL) _OFHuffmanTreeFree(_context.huffmanTree.codeLenTree); } if (_state == stateHuffmanTree || _state == stateHuffmanBlock) { if (_context.huffman.litLenTree != fixedLitLenTree) _OFHuffmanTreeFree(_context.huffman.litLenTree); if (_context.huffman.distTree != fixedDistTree) _OFHuffmanTreeFree(_context.huffman.distTree); } [super dealloc]; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length |
︙ | ︙ | |||
391 392 393 394 395 396 397 | CTX.receivedCount = i; return bytesWritten; } CTX.lengths[codeLengthsOrder[i]] = bits; } | | | | 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 420 421 422 423 | CTX.receivedCount = i; return bytesWritten; } CTX.lengths[codeLengthsOrder[i]] = bits; } CTX.codeLenTree = _OFHuffmanTreeNew(CTX.lengths, 19); CTX.treeIter = CTX.codeLenTree; OFFreeMemory(CTX.lengths); CTX.lengths = NULL; CTX.receivedCount = 0; CTX.value = 0xFF; } if OF_LIKELY (CTX.lengths == NULL) CTX.lengths = OFAllocMemory( 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) { if OF_UNLIKELY (!_OFHuffmanTreeWalk(self, tryReadBits, &CTX.treeIter, &value)) { CTX.receivedCount = i; return bytesWritten; } CTX.treeIter = CTX.codeLenTree; |
︙ | ︙ | |||
476 477 478 479 480 481 482 | for (j = 0; j < count; j++) CTX.lengths[i++] = value; CTX.value = 0xFF; } | | | | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | for (j = 0; j < count; j++) CTX.lengths[i++] = value; CTX.value = 0xFF; } _OFHuffmanTreeFree(CTX.codeLenTree); CTX.codeLenTree = NULL; CTX.litLenTree = _OFHuffmanTreeNew(CTX.lengths, CTX.litLenCodesCount + 257); CTX.distTree = _OFHuffmanTreeNew( CTX.lengths + CTX.litLenCodesCount + 257, CTX.distCodesCount + 1); OFFreeMemory(CTX.lengths); /* * litLenTree and distTree are at the same location in |
︙ | ︙ | |||
533 534 535 536 537 538 539 | CTX.state = huffmanStateAwaitDistance; CTX.treeIter = CTX.distTree; } /* Distance of length distance pair */ if (CTX.state == huffmanStateAwaitDistance) { | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | CTX.state = huffmanStateAwaitDistance; CTX.treeIter = CTX.distTree; } /* Distance of length distance pair */ if (CTX.state == huffmanStateAwaitDistance) { if OF_UNLIKELY (!_OFHuffmanTreeWalk(self, tryReadBits, &CTX.treeIter, &value)) return bytesWritten; if OF_UNLIKELY (value >= numDistanceCodes) @throw [OFInvalidFormatException exception]; |
︙ | ︙ | |||
597 598 599 600 601 602 603 | _slidingWindowMask; } CTX.state = huffmanStateAwaitCode; CTX.treeIter = CTX.litLenTree; } | | | | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | _slidingWindowMask; } CTX.state = huffmanStateAwaitCode; CTX.treeIter = CTX.litLenTree; } if OF_UNLIKELY (!_OFHuffmanTreeWalk(self, tryReadBits, &CTX.treeIter, &value)) return bytesWritten; /* End of block */ if OF_UNLIKELY (value == 256) { if (CTX.litLenTree != fixedLitLenTree) _OFHuffmanTreeFree(CTX.litLenTree); if (CTX.distTree != fixedDistTree) _OFHuffmanTreeFree(CTX.distTree); _state = stateBlockHeader; goto start; } /* Literal byte */ if OF_LIKELY (value < 256) { |
︙ | ︙ |
Modified src/OFKernelEventObserver.m from [c5333a4c56] to [370fb61e6e].
︙ | ︙ | |||
62 63 64 65 66 67 68 | #endif + (void)initialize { if (self != [OFKernelEventObserver class]) return; | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #endif + (void)initialize { if (self != [OFKernelEventObserver class]) return; if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (instancetype)observer { return [[[self alloc] init] autorelease]; |
︙ | ︙ | |||
128 129 130 131 132 133 134 | # if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) if (bind(_cancelFD[0], (struct sockaddr *)&_cancelAddr, sizeof(_cancelAddr)) != 0) @throw [OFInitializationFailedException exceptionWithClass: self.class]; cancelAddrLen = sizeof(_cancelAddr); | | | | 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 | # if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) if (bind(_cancelFD[0], (struct sockaddr *)&_cancelAddr, sizeof(_cancelAddr)) != 0) @throw [OFInitializationFailedException exceptionWithClass: self.class]; cancelAddrLen = sizeof(_cancelAddr); if (_OFGetSockName(_cancelFD[0], (struct sockaddr *)&_cancelAddr, &cancelAddrLen) != 0) @throw [OFInitializationFailedException exceptionWithClass: self.class]; # else for (;;) { uint16_t rnd = 0; int ret; while (rnd < 1024) rnd = (uint16_t)rand(); _cancelAddr.sin_port = OFToBigEndian16(rnd); ret = bind(_cancelFD[0], (struct sockaddr *)&_cancelAddr, sizeof(_cancelAddr)); if (ret == 0) break; if (_OFSocketErrNo() != EADDRINUSE) @throw [OFInitializationFailedException exceptionWithClass: self.class]; } # endif #endif } @catch (id e) { [self release]; |
︙ | ︙ | |||
262 263 264 265 266 267 268 | if (_waitingTask != NULL) { Signal(_waitingTask, (1ul << _cancelSignal)); _waitingTask = NULL; } Permit(); #elif defined(OF_HAVE_PIPE) | > | > > > > > | | > > > > > | | > > > > | 262 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 | if (_waitingTask != NULL) { Signal(_waitingTask, (1ul << _cancelSignal)); _waitingTask = NULL; } Permit(); #elif defined(OF_HAVE_PIPE) do { if (write(_cancelFD[1], "", 1) == 1) break; OFEnsure(errno == EINTR); } while (true); #elif defined(OF_WII) do { if (sendto(_cancelFD[1], "", 1, 0, (struct sockaddr *)&_cancelAddr, 8) == 1) break; OFEnsure(_OFSocketErrNo() == EINTR); } while (true); #else do { if (sendto(_cancelFD[1], (void *)"", 1, 0, (struct sockaddr *)&_cancelAddr, sizeof(_cancelAddr)) == 1) break; OFEnsure(_OFSocketErrNo() == EINTR); } while (true); #endif } @end |
Modified src/OFLHAArchive.m from [3329a01d33] to [784284b8aa].
︙ | ︙ | |||
97 98 99 100 101 102 103 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { return _OFArchiveIRIHandlerIRIForFileInArchive(@"lha", path, IRI); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ | |||
407 408 409 410 411 412 413 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; _CRC16 = _OFCRC16(_CRC16, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; if (_CRC16 != _entry.CRC16) { OFString *actualChecksum = [OFString stringWithFormat: @"%04" @PRIX16, _CRC16]; |
︙ | ︙ | |||
562 563 564 565 566 567 568 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (uint64_t)e.bytesWritten; | | | | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (uint64_t)e.bytesWritten; _CRC16 = _OFCRC16(_CRC16, buffer, e.bytesWritten); if (e.errNo == EWOULDBLOCK || e.errNo == EAGAIN) return e.bytesWritten; @throw e; } _bytesWritten += (uint64_t)length; _CRC16 = _OFCRC16(_CRC16, buffer, length); return length; } - (bool)lowlevelIsAtEndOfStream { if (_stream == nil) |
︙ | ︙ |
Modified src/OFLHAArchiveEntry.m from [14cbf19d20] to [9d58a40bb8].
︙ | ︙ | |||
838 839 840 841 842 843 844 | if (headerSize > UINT16_MAX) @throw [OFOutOfRangeException exception]; /* Now fill in the size and CRC16 for the entire header */ tmp16 = OFToLittleEndian16(headerSize); memcpy([data mutableItemAtIndex: 0], &tmp16, sizeof(tmp16)); | | | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | if (headerSize > UINT16_MAX) @throw [OFOutOfRangeException exception]; /* Now fill in the size and CRC16 for the entire header */ tmp16 = OFToLittleEndian16(headerSize); memcpy([data mutableItemAtIndex: 0], &tmp16, sizeof(tmp16)); tmp16 = _OFCRC16(0, data.items, data.count); tmp16 = OFToLittleEndian16(tmp16); memcpy([data mutableItemAtIndex: 27], &tmp16, sizeof(tmp16)); [stream writeData: data]; objc_autoreleasePoolPop(pool); } |
︙ | ︙ |
Modified src/OFLHADecompressingStream.m from [83126d0266] to [7c63af9a2f].
︙ | ︙ | |||
124 125 126 127 128 129 130 | { if (_stream != nil) [self close]; OFFreeMemory(_slidingWindow); if (_codeLenTree != NULL) | | | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | { if (_stream != nil) [self close]; OFFreeMemory(_slidingWindow); if (_codeLenTree != NULL) _OFHuffmanTreeFree(_codeLenTree); if (_litLenTree != NULL) _OFHuffmanTreeFree(_litLenTree); if (_distTree != NULL) _OFHuffmanTreeFree(_distTree); OFFreeMemory(_codesLengths); [super dealloc]; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ |
︙ | ︙ | |||
222 223 224 225 226 227 228 | if OF_UNLIKELY (bits == 7) { _currentIsExtendedLength = true; continue; } else _codesReceived++; } | | | | | 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 256 257 258 | if OF_UNLIKELY (bits == 7) { _currentIsExtendedLength = true; continue; } else _codesReceived++; } _codeLenTree = _OFHuffmanTreeNew(_codesLengths, _codesCount); OFFreeMemory(_codesLengths); _codesLengths = NULL; _state = stateLitLenCodesCount; goto start; case stateCodeLenTreeSingle: if OF_UNLIKELY (!tryReadBits(self, &bits, 5)) return bytesWritten; _codeLenTree = _OFHuffmanTreeNewSingle(bits); _state = stateLitLenCodesCount; goto start; case stateLitLenCodesCount: if OF_UNLIKELY (!tryReadBits(self, &bits, 9)) return bytesWritten; if OF_UNLIKELY (bits > 510) @throw [OFInvalidFormatException exception]; if OF_UNLIKELY (bits == 0) { _OFHuffmanTreeFree(_codeLenTree); _codeLenTree = NULL; _state = stateLitLenTreeSingle; goto start; } _codesCount = bits; |
︙ | ︙ | |||
298 299 300 301 302 303 304 | for (uint_fast16_t j = 0; j < skipCount; j++) _codesLengths[_codesReceived++] = 0; _skip = false; continue; } | | | | | | 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 332 333 334 335 336 337 338 | for (uint_fast16_t j = 0; j < skipCount; j++) _codesLengths[_codesReceived++] = 0; _skip = false; continue; } if (!_OFHuffmanTreeWalk(self, tryReadBits, &_treeIter, &value)) return bytesWritten; _treeIter = _codeLenTree; if (value < 3) { _codesLengths[_codesReceived] = value; _skip = true; } else _codesLengths[_codesReceived++] = value - 2; } _litLenTree = _OFHuffmanTreeNew(_codesLengths, _codesCount); OFFreeMemory(_codesLengths); _codesLengths = NULL; _OFHuffmanTreeFree(_codeLenTree); _codeLenTree = NULL; _state = stateDistCodesCount; goto start; case stateLitLenTreeSingle: if OF_UNLIKELY (!tryReadBits(self, &bits, 9)) return bytesWritten; _litLenTree = _OFHuffmanTreeNewSingle(bits); _state = stateDistCodesCount; goto start; case stateDistCodesCount: if OF_UNLIKELY (!tryReadBits(self, &bits, _distanceBits)) return bytesWritten; |
︙ | ︙ | |||
375 376 377 378 379 380 381 | if OF_UNLIKELY (bits == 7) { _currentIsExtendedLength = true; continue; } else _codesReceived++; } | | | | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | if OF_UNLIKELY (bits == 7) { _currentIsExtendedLength = true; continue; } else _codesReceived++; } _distTree = _OFHuffmanTreeNew(_codesLengths, _codesCount); OFFreeMemory(_codesLengths); _codesLengths = NULL; _treeIter = _litLenTree; _state = stateBlockLitLen; goto start; case stateDistTreeSingle: if OF_UNLIKELY (!tryReadBits(self, &bits, _distanceBits)) return bytesWritten; _distTree = _OFHuffmanTreeNewSingle(bits); _treeIter = _litLenTree; _state = stateBlockLitLen; goto start; case stateBlockLitLen: if OF_UNLIKELY (_symbolsLeft == 0) { _OFHuffmanTreeFree(_litLenTree); _OFHuffmanTreeFree(_distTree); _litLenTree = _distTree = NULL; _state = stateBlockHeader; /* * We must return here, as there is no indication * whether this was the last block. Whoever called this |
︙ | ︙ | |||
422 423 424 425 426 427 428 | return bytesWritten; } if OF_UNLIKELY (length == 0) return bytesWritten; | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | return bytesWritten; } if OF_UNLIKELY (length == 0) return bytesWritten; if OF_UNLIKELY (!_OFHuffmanTreeWalk(self, tryReadBits, &_treeIter, &value)) return bytesWritten; if OF_LIKELY (value < 256) { buffer[bytesWritten++] = value; length--; |
︙ | ︙ | |||
444 445 446 447 448 449 450 | _length = value - 253; _treeIter = _distTree; _state = stateBlockDistLength; } goto start; case stateBlockDistLength: | | | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | _length = value - 253; _treeIter = _distTree; _state = stateBlockDistLength; } goto start; case stateBlockDistLength: if OF_UNLIKELY (!_OFHuffmanTreeWalk(self, tryReadBits, &_treeIter, &value)) return bytesWritten; _distance = value; _state = (value < 2 ? stateBlockLenDistPair : stateBlockDistLengthExtra); |
︙ | ︙ |
Modified src/OFLocale.m from [86262efe96] to [8fa54b1d3c].
︙ | ︙ | |||
58 59 60 61 62 63 64 | } #ifndef OF_AMIGAOS static void parseLocale(char *locale, OFStringEncoding *encoding, OFString **languageCode, OFString **countryCode) { | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | } #ifndef OF_AMIGAOS static void parseLocale(char *locale, OFStringEncoding *encoding, OFString **languageCode, OFString **countryCode) { locale = _OFStrDup(locale); @try { OFStringEncoding enc = OFStringEncodingASCII; char *tmp; /* We don't care for extras behind the @ */ if ((tmp = strrchr(locale, '@')) != NULL) |
︙ | ︙ |
Modified src/OFMatrix4x4.m from [a90d32dcbf] to [c9b2db710c].
︙ | ︙ | |||
314 315 316 317 318 319 320 | { unsigned long hash; OFHashInit(&hash); for (uint_fast8_t i = 0; i < 4; i++) for (uint_fast8_t j = 0; j < 4; j++) | | > | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | { unsigned long hash; OFHashInit(&hash); for (uint_fast8_t i = 0; i < 4; i++) for (uint_fast8_t j = 0; j < 4; j++) OFHashAddHash(&hash, OFBitConvertFloatToUInt32(_values[i][j])); OFHashFinalize(&hash); return hash; } - (void)multiplyWithMatrix: (OFMatrix4x4 *)matrix |
︙ | ︙ |
Modified src/OFMutableIRI.m from [0e3da0ee00] to [e9bc07b350].
︙ | ︙ | |||
63 64 65 66 67 68 69 | { void *pool = objc_autoreleasePoolPush(); OFString *old = _scheme; if (scheme.length < 1 || !OFASCIIIsAlpha(*scheme.UTF8String)) @throw [OFInvalidFormatException exception]; | | | | | | 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 | { void *pool = objc_autoreleasePoolPush(); OFString *old = _scheme; if (scheme.length < 1 || !OFASCIIIsAlpha(*scheme.UTF8String)) @throw [OFInvalidFormatException exception]; _OFIRIVerifyIsEscaped(scheme, [OFCharacterSet IRISchemeAllowedCharacterSet], false); _scheme = [scheme.lowercaseString copy]; [old release]; objc_autoreleasePoolPop(pool); } - (void)setHost: (OFString *)host { void *pool = objc_autoreleasePoolPush(); OFString *old = _percentEncodedHost; if (_OFIRIIsIPv6Host(host)) _percentEncodedHost = [[OFString alloc] initWithFormat: @"[%@]", host]; else _percentEncodedHost = [[host stringByAddingPercentEncodingWithAllowedCharacters: [OFCharacterSet IRIHostAllowedCharacterSet]] copy]; [old release]; objc_autoreleasePoolPop(pool); } - (void)setPercentEncodedHost: (OFString *)percentEncodedHost { OFString *old; if ([percentEncodedHost hasPrefix: @"["] && [percentEncodedHost hasSuffix: @"]"]) { if (!_OFIRIIsIPv6Host([percentEncodedHost substringWithRange: OFMakeRange(1, percentEncodedHost.length - 2)])) @throw [OFInvalidFormatException exception]; } else if (percentEncodedHost != nil) _OFIRIVerifyIsEscaped(percentEncodedHost, [OFCharacterSet IRIHostAllowedCharacterSet], true); old = _percentEncodedHost; _percentEncodedHost = [percentEncodedHost copy]; [old release]; } |
︙ | ︙ | |||
139 140 141 142 143 144 145 | } - (void)setPercentEncodedUser: (OFString *)percentEncodedUser { OFString *old; if (percentEncodedUser != nil) | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | } - (void)setPercentEncodedUser: (OFString *)percentEncodedUser { OFString *old; if (percentEncodedUser != nil) _OFIRIVerifyIsEscaped(percentEncodedUser, [OFCharacterSet IRIUserAllowedCharacterSet], true); old = _percentEncodedUser; _percentEncodedUser = [percentEncodedUser copy]; [old release]; } |
︙ | ︙ | |||
166 167 168 169 170 171 172 | } - (void)setPercentEncodedPassword: (OFString *)percentEncodedPassword { OFString *old; if (percentEncodedPassword != nil) | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | } - (void)setPercentEncodedPassword: (OFString *)percentEncodedPassword { OFString *old; if (percentEncodedPassword != nil) _OFIRIVerifyIsEscaped(percentEncodedPassword, [OFCharacterSet IRIPasswordAllowedCharacterSet], true); old = _percentEncodedPassword; _percentEncodedPassword = [percentEncodedPassword copy]; [old release]; } |
︙ | ︙ | |||
192 193 194 195 196 197 198 | objc_autoreleasePoolPop(pool); } - (void)setPercentEncodedPath: (OFString *)percentEncodedPath { OFString *old; | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | objc_autoreleasePoolPop(pool); } - (void)setPercentEncodedPath: (OFString *)percentEncodedPath { OFString *old; _OFIRIVerifyIsEscaped(percentEncodedPath, [OFCharacterSet IRIPathAllowedCharacterSet], true); old = _percentEncodedPath; _percentEncodedPath = [percentEncodedPath copy]; [old release]; } |
︙ | ︙ | |||
238 239 240 241 242 243 244 | } - (void)setPercentEncodedQuery: (OFString *)percentEncodedQuery { OFString *old; if (percentEncodedQuery != nil) | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | } - (void)setPercentEncodedQuery: (OFString *)percentEncodedQuery { OFString *old; if (percentEncodedQuery != nil) _OFIRIVerifyIsEscaped(percentEncodedQuery, [OFCharacterSet IRIQueryAllowedCharacterSet], true); old = _percentEncodedQuery; _percentEncodedQuery = [percentEncodedQuery copy]; [old release]; } |
︙ | ︙ | |||
305 306 307 308 309 310 311 | } - (void)setPercentEncodedFragment: (OFString *)percentEncodedFragment { OFString *old; if (percentEncodedFragment != nil) | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | } - (void)setPercentEncodedFragment: (OFString *)percentEncodedFragment { OFString *old; if (percentEncodedFragment != nil) _OFIRIVerifyIsEscaped(percentEncodedFragment, [OFCharacterSet IRIFragmentAllowedCharacterSet], true); old = _percentEncodedFragment; _percentEncodedFragment = [percentEncodedFragment copy]; [old release]; } |
︙ | ︙ |
Modified src/OFMutableString.m from [f4575ddf27] to [152dfafa6a].
︙ | ︙ | |||
349 350 351 352 353 354 355 | { char *UTF8String; int UTF8StringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; | | | | | | | | | | | | | | | 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 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | { char *UTF8String; int UTF8StringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; if ((UTF8StringLength = _OFVASPrintF(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { [self appendUTF8String: UTF8String length: UTF8StringLength]; } @finally { free(UTF8String); } } #ifdef OF_HAVE_UNICODE_TABLES - (void)uppercase { [self of_convertWithWordStartTable: _OFUnicodeUppercaseTable wordMiddleTable: _OFUnicodeUppercaseTable wordStartTableSize: _OFUnicodeUppercaseTableSize wordMiddleTableSize: _OFUnicodeUppercaseTableSize]; } - (void)lowercase { [self of_convertWithWordStartTable: _OFUnicodeLowercaseTable wordMiddleTable: _OFUnicodeLowercaseTable wordStartTableSize: _OFUnicodeLowercaseTableSize wordMiddleTableSize: _OFUnicodeLowercaseTableSize]; } - (void)capitalize { [self of_convertWithWordStartTable: _OFUnicodeTitlecaseTable wordMiddleTable: _OFUnicodeLowercaseTable wordStartTableSize: _OFUnicodeTitlecaseTableSize wordMiddleTableSize: _OFUnicodeLowercaseTableSize]; } #else - (void)uppercase { convert(self, OFASCIIToUpper, OFASCIIToUpper); } |
︙ | ︙ |
Modified src/OFMutableUTF8String.m from [3ea1ecdd6c] to [dda54dd86e].
︙ | ︙ | |||
117 118 119 120 121 122 123 | table = startTable; tableSize = middleTableSize; } else { table = middleTable; tableSize = middleTableSize; } | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | table = startTable; tableSize = middleTableSize; } else { table = middleTable; tableSize = middleTableSize; } cLen = _OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c); if (cLen <= 0 || c > 0x10FFFF) { OFFreeMemory(unicodeString); @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
163 164 165 166 167 168 169 | } j = 0; for (i = 0; i < unicodeLen; i++) { size_t d; | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | } j = 0; for (i = 0; i < unicodeLen; i++) { size_t d; if ((d = _OFUTF8StringEncode(unicodeString[i], newCString + j)) == 0) { OFFreeMemory(unicodeString); OFFreeMemory(newCString); @throw [OFInvalidEncodingException exception]; } j += d; } |
︙ | ︙ | |||
196 197 198 199 200 201 202 | { char buffer[4]; OFUnichar c; size_t lenNew; ssize_t lenOld; if (_s->isUTF8) | | | | | 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 | { char buffer[4]; OFUnichar c; size_t lenNew; ssize_t lenOld; if (_s->isUTF8) idx = _OFUTF8StringIndexToPosition(_s->cString, idx, _s->cStringLength); if (idx >= _s->cStringLength) @throw [OFOutOfRangeException exception]; /* Shortcut if old and new character both are ASCII */ if (character < 0x80 && !(_s->cString[idx] & 0x80)) { _s->hasHash = false; _s->cString[idx] = character; return; } if ((lenNew = _OFUTF8StringEncode(character, buffer)) == 0) @throw [OFInvalidEncodingException exception]; if ((lenOld = _OFUTF8StringDecode(_s->cString + idx, _s->cStringLength - idx, &c)) <= 0) @throw [OFInvalidEncodingException exception]; _s->hasHash = false; if (lenNew == (size_t)lenOld) memcpy(_s->cString + idx, buffer, lenNew); |
︙ | ︙ | |||
266 267 268 269 270 271 272 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, &length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
295 296 297 298 299 300 301 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, &length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | objc_autoreleasePoolPop(pool); } } - (void)appendString: (OFString *)string { size_t UTF8StringLength; if (string == nil) @throw [OFInvalidArgumentException exception]; UTF8StringLength = string.UTF8StringLength; _s->hasHash = false; _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + UTF8StringLength + 1, 1); | > > | < | > > > | > > > > > | > | 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 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | objc_autoreleasePoolPop(pool); } } - (void)appendString: (OFString *)string { const char *UTF8String; size_t UTF8StringLength; if (string == nil) @throw [OFInvalidArgumentException exception]; UTF8String = string.UTF8String; UTF8StringLength = string.UTF8StringLength; _s->hasHash = false; _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + UTF8StringLength + 1, 1); memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength); _s->cStringLength += UTF8StringLength; _s->length += string.length; _s->cString[_s->cStringLength] = 0; if ([string isKindOfClass: [OFUTF8String class]] || [string isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)string)->_s->isUTF8) _s->isUTF8 = true; } else { switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, NULL)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } } } - (void)appendCharacters: (const OFUnichar *)characters length: (size_t)length { char *tmp = OFAllocMemory((length * 4) + 1, 1); @try { size_t j = 0; bool isUTF8 = false; for (size_t i = 0; i < length; i++) { size_t len = _OFUTF8StringEncode(characters[i], tmp + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) isUTF8 = true; |
︙ | ︙ | |||
413 414 415 416 417 418 419 | { char *UTF8String; int UTF8StringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; | | > | | > > > | | | | < | > > > | > > > > > | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 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 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | { char *UTF8String; int UTF8StringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; if ((UTF8StringLength = _OFVASPrintF(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { [self appendUTF8String: UTF8String length: UTF8StringLength]; } @finally { free(UTF8String); } } - (void)insertString: (OFString *)string atIndex: (size_t)idx { const char *UTF8String; size_t UTF8StringLength, newCStringLength; if (idx > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) idx = _OFUTF8StringIndexToPosition(_s->cString, idx, _s->cStringLength); UTF8String = string.UTF8String; UTF8StringLength = string.UTF8StringLength; newCStringLength = _s->cStringLength + UTF8StringLength; _s->hasHash = false; _s->cString = OFResizeMemory(_s->cString, newCStringLength + 1, 1); memmove(_s->cString + idx + UTF8StringLength, _s->cString + idx, _s->cStringLength - idx); memcpy(_s->cString + idx, UTF8String, UTF8StringLength); _s->cString[newCStringLength] = '\0'; _s->cStringLength = newCStringLength; _s->length += string.length; if ([string isKindOfClass: [OFUTF8String class]] || [string isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)string)->_s->isUTF8) _s->isUTF8 = true; } else { switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, NULL)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } } } - (void)deleteCharactersInRange: (OFRange)range { size_t start = range.location; size_t end = range.location + range.length; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { start = _OFUTF8StringIndexToPosition(_s->cString, start, _s->cStringLength); end = _OFUTF8StringIndexToPosition(_s->cString, end, _s->cStringLength); } memmove(_s->cString + start, _s->cString + end, _s->cStringLength - end); _s->hasHash = false; _s->length -= range.length; |
︙ | ︙ | |||
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | - (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { size_t start = range.location; size_t end = range.location + range.length; size_t newCStringLength, newLength; if (replacement == nil) @throw [OFInvalidArgumentException exception]; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; newLength = _s->length - range.length + replacement.length; if (_s->isUTF8) { | > > | | > > > | | | | | < | > > > | > > > > > | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | - (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { size_t start = range.location; size_t end = range.location + range.length; size_t newCStringLength, newLength; const char *replacementString; size_t replacementLength; if (replacement == nil) @throw [OFInvalidArgumentException exception]; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; newLength = _s->length - range.length + replacement.length; if (_s->isUTF8) { start = _OFUTF8StringIndexToPosition(_s->cString, start, _s->cStringLength); end = _OFUTF8StringIndexToPosition(_s->cString, end, _s->cStringLength); } replacementString = replacement.UTF8String; replacementLength = replacement.UTF8StringLength; newCStringLength = _s->cStringLength - (end - start) + replacementLength; _s->hasHash = false; /* * If the new string is bigger, we need to resize it first so we can * memmove() the rest of the string to the end. * * We must not resize the string if the new string is smaller, because * then we can't memmove() the rest of the string forward as the rest is * lost due to the resize! */ if (newCStringLength > _s->cStringLength) _s->cString = OFResizeMemory(_s->cString, newCStringLength + 1, 1); memmove(_s->cString + start + replacementLength, _s->cString + end, _s->cStringLength - end); memcpy(_s->cString + start, replacementString, replacementLength); _s->cString[newCStringLength] = '\0'; /* * If the new string is smaller, we can safely resize it now as we're * done with memmove(). */ if (newCStringLength < _s->cStringLength) _s->cString = OFResizeMemory(_s->cString, newCStringLength + 1, 1); _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFUTF8String class]] || [replacement isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)replacement)->_s->isUTF8) _s->isUTF8 = true; } else { switch (_OFUTF8StringCheck(replacementString, replacementLength, NULL)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } } } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options range: (OFRange)range { |
︙ | ︙ | |||
569 570 571 572 573 574 575 | @throw [OFInvalidArgumentException exception]; if (range.length > SIZE_MAX - range.location || range.location + range.length > self.length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { | | | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | @throw [OFInvalidArgumentException exception]; if (range.length > SIZE_MAX - range.location || range.location + range.length > self.length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { range.location = _OFUTF8StringIndexToPosition(_s->cString, range.location, _s->cStringLength); range.length = _OFUTF8StringIndexToPosition( _s->cString + range.location, range.length, _s->cStringLength - range.location); } if (string.UTF8StringLength > range.length) return; |
︙ | ︙ | |||
630 631 632 633 634 635 636 | _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFUTF8String class]] || [replacement isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)replacement)->_s->isUTF8) _s->isUTF8 = true; | | > > > | > > > > > | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFUTF8String class]] || [replacement isKindOfClass: [OFMutableUTF8String class]]) { if (((OFMutableUTF8String *)replacement)->_s->isUTF8) _s->isUTF8 = true; } else { switch (_OFUTF8StringCheck(replacementString, replacementLength, NULL)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } } } - (void)deleteLeadingWhitespaces { size_t i; for (i = 0; i < _s->cStringLength; i++) |
︙ | ︙ |
Modified src/OFObject+KeyValueCoding.h from [0118a5fa63] to [2c8a0862b7].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFKeyValueCoding.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFKeyValueCoding.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFObject_KeyValueCoding_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFObject (KeyValueCoding) <OFKeyValueCoding> @end |
︙ | ︙ |
Modified src/OFObject.h from [08353423b4] to [7b8537b8d6].
︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | const void *_Nonnull key, id _Nullable value, objc_associationPolicy policy); extern id _Nullable objc_getAssociatedObject(id _Nonnull object, const void *_Nonnull key); extern void objc_removeAssociatedObjects(id _Nonnull object); # endif #endif extern id OFAllocObject(Class class_, size_t extraSize, size_t extraAlignment, void *_Nullable *_Nullable extra); extern void OF_NO_RETURN_FUNC OFMethodNotFound(id self, SEL _cmd); /** * @brief Initializes the specified hash. * * @param hash A pointer to the hash to initialize */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | const void *_Nonnull key, id _Nullable value, objc_associationPolicy policy); extern id _Nullable objc_getAssociatedObject(id _Nonnull object, const void *_Nonnull key); extern void objc_removeAssociatedObjects(id _Nonnull object); # endif #endif /** * @brief Allocates a new object. * * This is useful to override @ref OFObject#alloc in a subclass that can then * allocate extra memory in the same memory allocation. * * @param class_ The class of which to allocate an object * @param extraSize Extra space after the ivars to allocate * @param extraAlignment Alignment of the extra space after the ivars * @param extra A pointer to set to a pointer to the extra space * @return The allocated object */ extern id OFAllocObject(Class class_, size_t extraSize, size_t extraAlignment, void *_Nullable *_Nullable extra); /** * @brief This function is called when a method is not found. * * It can also be called intentionally to indicate that a method is not * implemetned, for example in an abstract method. However, instead of calling * OFMethodNotFound directly, it is preferred to do the following: * * - (void)abstractMethod * { * OF_UNRECOGNIZED_SELECTOR * } * * However, do not use this for init methods. Instead, use the following: * * - (instancetype)init * { * OF_INVALID_INIT_METHOD * } * * @param self The object which does not have the method * @param _cmd The selector of the method that does not exist */ extern void OF_NO_RETURN_FUNC OFMethodNotFound(id self, SEL _cmd); /** * @brief Initializes the specified hash. * * @param hash A pointer to the hash to initialize */ |
︙ | ︙ |
Modified src/OFObject.m from [aac1ccf77b] to [8a5a49c0ca].
︙ | ︙ | |||
491 492 493 494 495 496 497 | const char * _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: [OFLocale encoding]]; } /* References for static linking */ | | | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | const char * _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: [OFLocale encoding]]; } /* References for static linking */ void OF_VISIBILITY_HIDDEN _references_to_categories_of_OFObject(void) { _OFObject_KeyValueCoding_reference = 1; } @implementation OFObject + (void)load |
︙ | ︙ |
Modified src/OFPlainCondition.h from [bbdacbeb4f] to [2b26bbac16].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No conditions available! #endif /* For OFTimeInterval */ #import "OFObject.h" #import "OFPlainMutex.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_cond_t OFPlainCondition; #elif defined(OF_WINDOWS) # include <windows.h> typedef struct { HANDLE event; volatile int count; } OFPlainCondition; #elif defined(OF_AMIGAOS) # include <exec/tasks.h> typedef struct { | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 50 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No conditions available! #endif /* For OFTimeInterval */ #import "OFObject.h" #import "OFPlainMutex.h" /** @file */ #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_cond_t OFPlainCondition; #elif defined(OF_WINDOWS) # include <windows.h> typedef struct { HANDLE event; volatile int count; } OFPlainCondition; #elif defined(OF_AMIGAOS) # include <exec/tasks.h> typedef struct { struct _OFPlainConditionWaitingTask { struct Task *task; unsigned char sigBit; struct _OFPlainConditionWaitingTask *next; } *waitingTasks; } OFPlainCondition; #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Creates a new plain condition. * * A plain condition is similar to an @ref OFCondition, but does not use * exceptions and can be used from pure C code. * * @param condition A pointer to the condition to create * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionNew(OFPlainCondition *condition); /** * @brief Signals the specified condition. * * @param condition A pointer to the condition to signal * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionSignal(OFPlainCondition *condition); /** * @brief Broadcasts the specified condition, meaning it will be signaled to * everyone waiting. * * @param condition A pointer to the condition to broadcast * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionBroadcast(OFPlainCondition *condition); /** * @brief Waits on the specified condition with the specified mutex. * * @param condition A pointer to the condition to wait on * @param mutex The mutex to wait with * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionWait(OFPlainCondition *condition, OFPlainMutex *mutex); /** * @brief Waits on the specified condition with the specified mutex with a * timeout. * * @param condition A pointer to the condition to wait on * @param mutex The mutex to wait with * @param timeout The timeout after which to give up * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionTimedWait(OFPlainCondition *condition, OFPlainMutex *mutex, OFTimeInterval timeout); #if defined(OF_AMIGAOS) || defined(DOXYGEN) /** * @brief Waits on the specified condition with the specified mutex or the * specified Exec signal. * * @param condition A pointer to the condition to wait on * @param mutex The mutex to wait with * @param signalMask The Exec signal mask to wait for * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, ULONG *signalMask); /** * @brief Waits on the specified condition with the specified mutex or the * specified Exec signal, up until the timeout is reached. * * @param condition A pointer to the condition to wait on * @param mutex The mutex to wait with * @param signalMask The Exec signal mask to wait for * @param timeout The timeout after which to give up * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionTimedWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, OFTimeInterval timeout, ULONG *signalMask); #endif /** * @brief Destroys the specified plain condition. * * @param condition A pointer to the condition to destroy * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainConditionFree(OFPlainCondition *condition); #ifdef __cplusplus } #endif |
Modified src/OFPlainMutex.h from [b1091dda6a] to [b6a04ba6c6].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No mutexes available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_mutex_t OFPlainMutex; #elif defined(OF_WINDOWS) # include <windows.h> typedef CRITICAL_SECTION OFPlainMutex; | > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No mutexes available! #endif #import "macros.h" /** @file */ #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_mutex_t OFPlainMutex; #elif defined(OF_WINDOWS) # include <windows.h> typedef CRITICAL_SECTION OFPlainMutex; |
︙ | ︙ | |||
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 123 124 125 126 127 128 129 130 131 132 133 | OFTLSKey count; } OFPlainRecursiveMutex; #endif #ifdef __cplusplus extern "C" { #endif extern int OFPlainMutexNew(OFPlainMutex *mutex); extern int OFPlainMutexLock(OFPlainMutex *mutex); extern int OFPlainMutexTryLock(OFPlainMutex *mutex); extern int OFPlainMutexUnlock(OFPlainMutex *mutex); extern int OFPlainMutexFree(OFPlainMutex *mutex); extern int OFPlainRecursiveMutexNew(OFPlainRecursiveMutex *rmutex); extern int OFPlainRecursiveMutexLock(OFPlainRecursiveMutex *rmutex); extern int OFPlainRecursiveMutexTryLock(OFPlainRecursiveMutex *rmutex); extern int OFPlainRecursiveMutexUnlock(OFPlainRecursiveMutex *rmutex); extern int OFPlainRecursiveMutexFree(OFPlainRecursiveMutex *rmutex); #ifdef __cplusplus } #endif /* Spinlocks are inlined for performance. */ static OF_INLINE void OFYieldThread(void) { #if defined(OF_HAVE_SCHED_YIELD) sched_yield(); #elif defined(OF_WINDOWS) Sleep(0); #endif } static OF_INLINE int OFSpinlockNew(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; return 0; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_init(spinlock, 0); #else return OFPlainMutexNew(spinlock); #endif } static OF_INLINE int OFSpinlockTryLock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) if (OFAtomicIntCompareAndSwap(spinlock, 0, 1)) { OFAcquireMemoryBarrier(); return 0; } return EBUSY; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_trylock(spinlock); #else return OFPlainMutexTryLock(spinlock); #endif } static OF_INLINE int OFSpinlockLock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) size_t i; for (i = 0; i < 10; i++) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 123 124 125 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 183 184 185 186 187 188 189 190 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 | OFTLSKey count; } OFPlainRecursiveMutex; #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Creates a new plain mutex. * * A plain mutex is similar to an @ref OFMutex, but does not use exceptions and * is just a lightweight wrapper around the system's mutex implementation. * * @param mutex A pointer to the mutex to create * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainMutexNew(OFPlainMutex *mutex); /** * @brief Locks the specified mutex. * * @param mutex A pointer to the mutex to lock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainMutexLock(OFPlainMutex *mutex); /** * @brief Tries to lock the specified mutex without blocking. * * @param mutex A pointer to the mutex to try to lock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainMutexTryLock(OFPlainMutex *mutex); /** * @brief Unlocks the specified mutex. * * @param mutex A pointer to the mutex to unlock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainMutexUnlock(OFPlainMutex *mutex); /** * @brief Destroys the specified mutex * * @param mutex A pointer to the mutex to destruct * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainMutexFree(OFPlainMutex *mutex); /** * @brief Creates a new plain recursive mutex. * * A plain recursive mutex is similar to an @ref OFRecursiveMutex, but does not * use exceptions and is just a lightweight wrapper around the system's * recursive mutex implementation (or lacking that, a simple implementation of * recursive mutexes via regular mutexes). * * @param rmutex A pointer to the recursive mutex to create * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainRecursiveMutexNew(OFPlainRecursiveMutex *rmutex); /** * @brief Locks the specified recursive mutex. * * @param rmutex A pointer to the recursive mutex to lock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainRecursiveMutexLock(OFPlainRecursiveMutex *rmutex); /** * @brief Tries to lock the specified recursive mutex without blocking. * * @param rmutex A pointer to the recursive mutex to try to lock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainRecursiveMutexTryLock(OFPlainRecursiveMutex *rmutex); /** * @brief Unlocks the specified recursive mutex. * * @param rmutex A pointer to the recursive mutex to unlock * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainRecursiveMutexUnlock(OFPlainRecursiveMutex *rmutex); /** * @brief Destroys the specified recursive mutex * * @param rmutex A pointer to the recursive mutex to destruct * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainRecursiveMutexFree(OFPlainRecursiveMutex *rmutex); #ifdef __cplusplus } #endif /* Spinlocks are inlined for performance. */ /** * @brief Yield the current thread, indicating to the OS that another thread * should execute instead. */ static OF_INLINE void OFYieldThread(void) { #if defined(OF_HAVE_SCHED_YIELD) sched_yield(); #elif defined(OF_WINDOWS) Sleep(0); #endif } /** * @brief Creates a new spinlock. * * @param spinlock A pointer to the spinlock to create * @return 0 on success, or an error number from `<errno.h>` on error */ static OF_INLINE int OFSpinlockNew(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; return 0; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_init(spinlock, 0); #else return OFPlainMutexNew(spinlock); #endif } /** * @brief Tries to lock a spinlock. * * @param spinlock A pointer to the spinlock to try to lock * @return 0 on success, or an error number from `<errno.h>` on error */ static OF_INLINE int OFSpinlockTryLock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) if (OFAtomicIntCompareAndSwap(spinlock, 0, 1)) { OFAcquireMemoryBarrier(); return 0; } return EBUSY; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_trylock(spinlock); #else return OFPlainMutexTryLock(spinlock); #endif } /** * @brief Locks a spinlock. * * @param spinlock A pointer to the spinlock to lock * @return 0 on success, or an error number from `<errno.h>` on error */ static OF_INLINE int OFSpinlockLock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) size_t i; for (i = 0; i < 10; i++) |
︙ | ︙ | |||
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 | #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_lock(spinlock); #else return OFPlainMutexLock(spinlock); #endif } static OF_INLINE int OFSpinlockUnlock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) bool ret = OFAtomicIntCompareAndSwap(spinlock, 1, 0); OFReleaseMemoryBarrier(); return (ret ? 0 : EINVAL); #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_unlock(spinlock); #else return OFPlainMutexUnlock(spinlock); #endif } static OF_INLINE int OFSpinlockFree(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) return 0; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_destroy(spinlock); #else return OFPlainMutexFree(spinlock); #endif } | > > > > > > > > > > > > > > | 242 243 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 286 287 288 289 | #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_lock(spinlock); #else return OFPlainMutexLock(spinlock); #endif } /** * @brief Unlocks a spinlock. * * @param spinlock A pointer to the spinlock to unlock * @return 0 on success, or an error number from `<errno.h>` on error */ static OF_INLINE int OFSpinlockUnlock(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) bool ret = OFAtomicIntCompareAndSwap(spinlock, 1, 0); OFReleaseMemoryBarrier(); return (ret ? 0 : EINVAL); #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_unlock(spinlock); #else return OFPlainMutexUnlock(spinlock); #endif } /** * @brief Destroys a spinlock. * * @param spinlock A pointer to the spinlock to destroy * @return 0 on success, or an error number from `<errno.h>` on error */ static OF_INLINE int OFSpinlockFree(OFSpinlock *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) (void)spinlock; return 0; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return pthread_spin_destroy(spinlock); #else return OFPlainMutexFree(spinlock); #endif } |
Modified src/OFPlainThread.h from [3654325ef3] to [3b3df80df6].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No threads available! #endif #import "OFObject.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_t OFPlainThread; #elif defined(OF_WINDOWS) # include <windows.h> typedef HANDLE OFPlainThread; | > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No threads available! #endif #import "OFObject.h" /** @file */ #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_t OFPlainThread; #elif defined(OF_WINDOWS) # include <windows.h> typedef HANDLE OFPlainThread; |
︙ | ︙ | |||
49 50 51 52 53 54 55 | #endif typedef struct { float priority; size_t stackSize; } OFPlainThreadAttributes; | | > > > > > > > > > > > | 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 | #endif typedef struct { float priority; size_t stackSize; } OFPlainThreadAttributes; #if defined(OF_HAVE_PTHREADS) || defined(DOXYGEN) /** * @brief Returns the current plain thread. * * @return The current plain thread */ static OF_INLINE OFPlainThread OFCurrentPlainThread(void) { return pthread_self(); } /** * @brief Returns whether the specified plain thread is the current thread. * * @param thread The thread to check * @return Whether the specified plain thread is the current thread */ static OF_INLINE bool OFPlainThreadIsCurrent(OFPlainThread thread) { return pthread_equal(thread, pthread_self()); } #elif defined(OF_WINDOWS) static OF_INLINE OFPlainThread |
︙ | ︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | extern OFPlainThread OFCurrentPlainThread(void); extern bool OFPlainThreadIsCurrent(OFPlainThread); #endif #ifdef __cplusplus extern "C" { #endif extern int OFPlainThreadAttributesInit(OFPlainThreadAttributes *attr); extern int OFPlainThreadNew(OFPlainThread *thread, const char *name, void (*function)(id), id object, const OFPlainThreadAttributes *attr); extern void OFSetThreadName(const char *name); extern int OFPlainThreadJoin(OFPlainThread thread); extern int OFPlainThreadDetach(OFPlainThread thread); #ifdef __cplusplus } #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | extern OFPlainThread OFCurrentPlainThread(void); extern bool OFPlainThreadIsCurrent(OFPlainThread); #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Initializes the specified thread attributes. * * @param attr A pointer to the thread attributes to initialize * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainThreadAttributesInit(OFPlainThreadAttributes *attr); /** * @brief Creates a new plain thread. * * A plain thread is similar to @ref OFThread, but does not use exceptions and * is just a lightweight wrapper around the system's thread implementation. * * @param thread A pointer to the thread to create * @param name A name for the thread * @param function The function the thread should execute * @param object The object to pass to the thread as an argument * @param attr Thread attributes * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainThreadNew(OFPlainThread *thread, const char *name, void (*function)(id), id object, const OFPlainThreadAttributes *attr); /** * @brief Sets the name of the current thread. * * @param name The name for the current thread */ extern void OFSetThreadName(const char *name); /** * @brief Joins the specified thread. * * @param thread The thread to join * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainThreadJoin(OFPlainThread thread); /** * @brief Detaches the specified thread. * * @param thread The thread to detach * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFPlainThreadDetach(OFPlainThread thread); #ifdef __cplusplus } #endif |
Modified src/OFSPXSocket.m from [007210b145] to [6998eecec7].
︙ | ︙ | |||
190 191 192 193 194 195 196 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { | | | | 190 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 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { *errNo = _OFSocketErrNo(); return false; } #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } - (bool)of_connectSocketToAddress: (const OFSocketAddress *)address errNo: (int *)errNo { if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (connect(_socket, (struct sockaddr *)&address->sockaddr, address->length) != 0) { *errNo = _OFSocketErrNo(); return false; } return true; } - (void)of_closeSocket |
︙ | ︙ | |||
336 337 338 339 340 341 342 | OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self | | | | | | 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 | OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyIPX; address.length = (socklen_t)sizeof(address.sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address.sockaddr, &address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node |
︙ | ︙ |
Modified src/OFSPXStreamSocket.m from [90372031f9] to [a3f34f0fcf].
︙ | ︙ | |||
192 193 194 195 196 197 198 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { | | | | 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 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { *errNo = _OFSocketErrNo(); return false; } #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } - (bool)of_connectSocketToAddress: (const OFSocketAddress *)address errNo: (int *)errNo { if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (connect(_socket, (struct sockaddr *)&address->sockaddr, address->length) != 0) { *errNo = _OFSocketErrNo(); return false; } return true; } - (void)of_closeSocket |
︙ | ︙ | |||
337 338 339 340 341 342 343 | SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self | | | | | | 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 | SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node port: port packetType: SPXPacketType socket: self errNo: errNo]; } memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyIPX; address.length = (socklen_t)sizeof(address.sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address.sockaddr, &address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network node: node |
︙ | ︙ |
Modified src/OFScrypt.h from [76bac8d2f2] to [b9cb45c890].
︙ | ︙ | |||
61 62 63 64 65 66 67 | /** @brief Whether data may be stored in swappable memory. */ bool allowsSwappableMemory; } OFScryptParameters; #ifdef __cplusplus extern "C" { #endif | > | | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /** @brief Whether data may be stored in swappable memory. */ bool allowsSwappableMemory; } OFScryptParameters; #ifdef __cplusplus extern "C" { #endif /* No OF_VISIBILITY_HIDDEN so tests can call it. */ extern void _OFSalsa20_8Core(uint32_t buffer[_Nonnull 16]); extern void _OFScryptBlockMix(uint32_t *output, const uint32_t *input, size_t blockSize); extern void _OFScryptROMix(uint32_t *buffer, size_t blockSize, size_t costFactor, uint32_t *tmp); /** * @brief Derives a key from a password and a salt using scrypt. * * @param parameters The parameters to use */ |
︙ | ︙ |
Modified src/OFScrypt.m from [94500350d8] to [480d9e7945].
︙ | ︙ | |||
27 28 29 30 31 32 33 | #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFScrypt.h" #import "OFPBKDF2.h" void | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFScrypt.h" #import "OFPBKDF2.h" void _OFSalsa20_8Core(uint32_t buffer[16]) { uint32_t tmp[16]; for (uint_fast8_t i = 0; i < 16; i++) tmp[i] = OFToLittleEndian32(buffer[i]); for (uint_fast8_t i = 0; i < 8; i += 2) { |
︙ | ︙ | |||
77 78 79 80 81 82 83 | buffer[i] = OFToLittleEndian32(OFFromLittleEndian32(buffer[i]) + tmp[i]); OFZeroMemory(tmp, sizeof(tmp)); } void | | | | | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | buffer[i] = OFToLittleEndian32(OFFromLittleEndian32(buffer[i]) + tmp[i]); OFZeroMemory(tmp, sizeof(tmp)); } void _OFScryptBlockMix(uint32_t *output, const uint32_t *input, size_t blockSize) { uint32_t tmp[16]; /* Check defined here and executed in OFScrypt() */ #define OVERFLOW_CHECK_1 \ if (param.blockSize > SIZE_MAX / 2 || \ 2 * param.blockSize - 1 > SIZE_MAX / 16) \ @throw [OFOutOfRangeException exception]; memcpy(tmp, input + (2 * blockSize - 1) * 16, 64); for (size_t i = 0; i < 2 * blockSize; i++) { for (size_t j = 0; j < 16; j++) tmp[j] ^= input[i * 16 + j]; _OFSalsa20_8Core(tmp); /* * Even indices are stored in the first half and odd ones in * the second. */ memcpy(output + ((i / 2) + (i & 1) * blockSize) * 16, tmp, 64); } OFZeroMemory(tmp, sizeof(tmp)); } void _OFScryptROMix(uint32_t *buffer, size_t blockSize, size_t costFactor, uint32_t *tmp) { /* Check defined here and executed in OFScrypt() */ #define OVERFLOW_CHECK_2 \ if (param.blockSize > SIZE_MAX / 128 / param.costFactor) \ @throw [OFOutOfRangeException exception]; uint32_t *tmp2 = tmp + 32 * blockSize; memcpy(tmp, buffer, 128 * blockSize); for (size_t i = 0; i < costFactor; i++) { memcpy(tmp2 + i * 32 * blockSize, tmp, 128 * blockSize); _OFScryptBlockMix(tmp, tmp2 + i * 32 * blockSize, blockSize); } for (size_t i = 0; i < costFactor; i++) { uint32_t j = OFFromLittleEndian32( tmp[(2 * blockSize - 1) * 16]) & (costFactor - 1); for (size_t k = 0; k < 32 * blockSize; k++) tmp[k] ^= tmp2[j * 32 * blockSize + k]; _OFScryptBlockMix(buffer, tmp, blockSize); if (i < costFactor - 1) memcpy(tmp, buffer, 128 * blockSize); } } void |
︙ | ︙ | |||
196 197 198 199 200 201 202 | .key = (unsigned char *)bufferItems, .keyLength = param.parallelization * 128 * param.blockSize, .allowsSwappableMemory = param.allowsSwappableMemory }); for (size_t i = 0; i < param.parallelization; i++) | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | .key = (unsigned char *)bufferItems, .keyLength = param.parallelization * 128 * param.blockSize, .allowsSwappableMemory = param.allowsSwappableMemory }); for (size_t i = 0; i < param.parallelization; i++) _OFScryptROMix(bufferItems + i * 32 * param.blockSize, param.blockSize, param.costFactor, tmpItems); OFPBKDF2((OFPBKDF2Parameters){ .HMAC = HMAC, .iterations = 1, .salt = (unsigned char *)bufferItems, .saltLength = param.parallelization * 128 * |
︙ | ︙ |
Modified src/OFSelectKernelEventObserver.m from [93d2c09c3e] to [5b2b3251fe].
︙ | ︙ | |||
238 239 240 241 242 243 244 | events = select(_maxFD + 1, &readFDs, &writeFDs, NULL, (timeInterval != -1 ? &timeout : NULL)); #endif if (events < 0) @throw [OFObserveKernelEventsFailedException exceptionWithObserver: self | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | events = select(_maxFD + 1, &readFDs, &writeFDs, NULL, (timeInterval != -1 ? &timeout : NULL)); #endif if (events < 0) @throw [OFObserveKernelEventsFailedException exceptionWithObserver: self errNo: _OFSocketErrNo()]; #ifdef OF_AMIGAOS if (execSignalMask != 0 && [_delegate respondsToSelector: @selector(execSignalWasReceived:)]) [_delegate execSignalWasReceived: execSignalMask]; #else if (FD_ISSET(_cancelFD[0], &readFDs)) { |
︙ | ︙ |
Modified src/OFSequencedPacketSocket.m from [ccecd9e1f0] to [93df6d6776].
︙ | ︙ | |||
52 53 54 55 56 57 58 | @synthesize listening = _listening, delegate = _delegate; + (void)initialize { if (self != [OFSequencedPacketSocket class]) return; | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | @synthesize listening = _listening, delegate = _delegate; + (void)initialize { if (self != [OFSequencedPacketSocket class]) return; if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (instancetype)socket { return [[[self alloc] init] autorelease]; |
︙ | ︙ | |||
98 99 100 101 102 103 104 | - (int)of_socketError { int errNo; socklen_t len = sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - (int)of_socketError { int errNo; socklen_t len = sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) return _OFSocketErrNo(); return errNo; } #endif - (id)copy { |
︙ | ︙ | |||
139 140 141 142 143 144 145 | _canBlock = canBlock; #elif defined(OF_WINDOWS) u_long v = !canBlock; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithObject: self | | | | | 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 | _canBlock = canBlock; #elif defined(OF_WINDOWS) u_long v = !canBlock; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; _canBlock = canBlock; #else OF_UNRECOGNIZED_SELECTOR #endif } - (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS if ((ret = recv(_socket, buffer, length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recv(_socket, buffer, (int)length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #endif return ret; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { |
︙ | ︙ | |||
237 238 239 240 241 242 243 | @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, (void *)buffer, length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 | | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, (void *)buffer, length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #else int bytesWritten; if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, buffer, (int)length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #endif if ((size_t)bytesWritten != length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: bytesWritten errNo: 0]; |
︙ | ︙ | |||
310 311 312 313 314 315 316 | if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (listen(_socket, backlog) == -1) @throw [OFListenOnSocketFailedException exceptionWithSocket: self backlog: backlog | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (listen(_socket, backlog) == -1) @throw [OFListenOnSocketFailedException exceptionWithSocket: self backlog: backlog errNo: _OFSocketErrNo()]; _listening = true; } - (instancetype)accept { OFSequencedPacketSocket *client; |
︙ | ︙ | |||
338 339 340 341 342 343 344 | #if defined(HAVE_PACCEPT) && defined(SOCK_CLOEXEC) if ((client->_socket = paccept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, NULL, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self | | | | | 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 | #if defined(HAVE_PACCEPT) && defined(SOCK_CLOEXEC) if ((client->_socket = paccept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, NULL, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; #elif defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) if ((client->_socket = accept4(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; #else if ((client->_socket = accept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; # if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(client->_socket, F_GETFD, 0)) != -1) fcntl(client->_socket, F_SETFD, flags | FD_CLOEXEC); # endif #endif |
︙ | ︙ |
Modified src/OFSocket+Private.h from [85d93768ea] to [3e7201b279].
︙ | ︙ | |||
54 55 56 57 58 59 60 | # endif # include <sys/filio.h> # define closesocket(sock) CloseSocket(sock) # define ioctlsocket(fd, req, arg) IoctlSocket(fd, req, arg) # define hstrerror(err) "unknown (no hstrerror)" # define SOCKET_ERROR -1 # if defined(OF_HAVE_THREADS) && !defined(OF_MORPHOS) | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # endif # include <sys/filio.h> # define closesocket(sock) CloseSocket(sock) # define ioctlsocket(fd, req, arg) IoctlSocket(fd, req, arg) # define hstrerror(err) "unknown (no hstrerror)" # define SOCKET_ERROR -1 # if defined(OF_HAVE_THREADS) && !defined(OF_MORPHOS) # define SocketBase ((struct Library *)OFTLSKeyGet(_OFSocketBaseKey)) # ifdef OF_AMIGAOS4 # define ISocket ((struct SocketIFace *)OFTLSKeyGet(_OFSocketInterfaceKey)) # endif # endif # ifdef OF_MORPHOS typedef uint32_t in_addr_t; # endif #elif !defined(OF_WINDOWS) && !defined(OF_WII) # define closesocket(sock) close(sock) |
︙ | ︙ |
Modified src/OFSocket.h from [5622251aeb] to [48d578681c].
︙ | ︙ | |||
439 440 441 442 443 444 445 | * * @param address The address on which to get the port * @return The port of the address */ extern uint8_t OFSocketAddressAppleTalkPort( const OFSocketAddress *_Nonnull address); | | | | | | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | * * @param address The address on which to get the port * @return The port of the address */ extern uint8_t OFSocketAddressAppleTalkPort( const OFSocketAddress *_Nonnull address); extern bool _OFSocketInit(void) OF_VISIBILITY_HIDDEN; #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) extern void _OFSocketDeinit(void) OF_VISIBILITY_HIDDEN; #endif extern int _OFSocketErrNo(void) OF_VISIBILITY_HIDDEN; #if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) extern int _OFGetSockName(OFSocketHandle sock, struct sockaddr *restrict addr, socklen_t *restrict addrLen) OF_VISIBILITY_HIDDEN; #endif #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) extern OFTLSKey _OFSocketBaseKey OF_VISIBILITY_HIDDEN; # ifdef OF_AMIGAOS4 extern OFTLSKey _OFSocketInterfaceKey OF_VISIBILITY_HIDDEN; # endif #endif #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFSocket.m from [b9e69c4209] to [0dcfbd34b6].
︙ | ︙ | |||
84 85 86 87 88 89 90 | #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static bool initSuccessful = false; #endif #ifdef OF_AMIGAOS # if defined(OF_HAVE_THREADS) && !defined(OF_MORPHOS) | | | | | | 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 | #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static bool initSuccessful = false; #endif #ifdef OF_AMIGAOS # if defined(OF_HAVE_THREADS) && !defined(OF_MORPHOS) OFTLSKey _OFSocketBaseKey; # ifdef OF_AMIGAOS4 OFTLSKey _OFSocketInterfaceKey; # endif # else struct Library *SocketBase; # ifdef OF_AMIGAOS4 struct SocketIFace *ISocket = NULL; # endif # endif #endif #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) OF_CONSTRUCTOR() { if (OFTLSKeyNew(&_OFSocketBaseKey) != 0) @throw [OFInitializationFailedException exception]; # ifdef OF_AMIGAOS4 if (OFTLSKeyNew(&_OFSocketInterfaceKey) != 0) @throw [OFInitializationFailedException exception]; # endif } #endif #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static void |
︙ | ︙ | |||
172 173 174 175 176 177 178 | if (SocketBase != NULL) CloseLibrary(SocketBase); # endif } #endif bool | | | | | | | | | > | | 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 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 | if (SocketBase != NULL) CloseLibrary(SocketBase); # endif } #endif bool _OFSocketInit(void) { #if !defined(OF_AMIGAOS) || defined(OF_MORPHOS) || !defined(OF_HAVE_THREADS) static OFOnceControl onceControl = OFOnceControlInitValue; OFOnce(&onceControl, init); return initSuccessful; #else struct Library *socketBase; # ifdef OF_AMIGAOS4 struct SocketIFace *socketInterface; # endif # ifdef OF_AMIGAOS4 if ((socketInterface = OFTLSKeyGet(_OFSocketInterfaceKey)) != NULL) # else if ((socketBase = OFTLSKeyGet(_OFSocketBaseKey)) != NULL) # endif return true; if ((socketBase = OpenLibrary("bsdsocket.library", 4)) == NULL) return false; # ifdef OF_AMIGAOS4 if ((socketInterface = (struct SocketIFace *) GetInterface(socketBase, "main", 1, NULL)) == NULL) { CloseLibrary(socketBase); return false; } # endif if (OFTLSKeySet(_OFSocketBaseKey, socketBase) != 0) { CloseLibrary(socketBase); # ifdef OF_AMIGAOS4 DropInterface((struct Interface *)socketInterface); # endif return false; } # ifdef OF_AMIGAOS4 if (OFTLSKeySet(_OFSocketInterfaceKey, socketInterface) != 0) { CloseLibrary(socketBase); DropInterface((struct Interface *)socketInterface); return false; } # endif return true; #endif } #if defined(OF_HAVE_THREADS) && defined(OF_AMIGAOS) && !defined(OF_MORPHOS) void _OFSocketDeinit(void) { struct Library *socketBase = OFTLSKeyGet(_OFSocketBaseKey); # ifdef OF_AMIGAOS4 struct SocketIFace *socketInterface = OFTLSKeyGet(_OFSocketInterfaceKey); if (socketInterface != NULL) DropInterface((struct Interface *)socketInterface); # endif if (socketBase != NULL) CloseLibrary(socketBase); } #endif int _OFSocketErrNo(void) { #if defined(OF_WINDOWS) switch (WSAGetLastError()) { case WSAEACCES: return EACCES; case WSAEADDRINUSE: return EADDRINUSE; |
︙ | ︙ | |||
342 343 344 345 346 347 348 | #else return errno; #endif } #ifndef OF_WII int | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | #else return errno; #endif } #ifndef OF_WII int _OFGetSockName(OFSocketHandle sock, struct sockaddr *restrict addr, socklen_t *restrict addrLen) { int ret; # if defined(OF_HAVE_THREADS) && (!defined(OF_AMIGAOS) || defined(OF_MORPHOS)) [mutex lock]; # endif |
︙ | ︙ |
Modified src/OFStrFTime.h from [6360971f27] to [7b37c32abd].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern size_t _OFStrFTime(char *buffer, size_t bufferLen, const char *format, struct tm *tm, short tz) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFStrFTime.m from [c155cb6b03] to [91040bd990].
︙ | ︙ | |||
30 31 32 33 34 35 36 | }; static const char monthNames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; size_t | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | }; static const char monthNames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; size_t _OFStrFTime(char *buffer, size_t bufferLen, const char *format, struct tm *tm, short tz) { enum { stateSearchConversionSpecifier, stateInConversionSpecifier } state = stateSearchConversionSpecifier; size_t j, formatLen; |
︙ | ︙ |
Modified src/OFStrPTime.h from [8d156c2ae2] to [2f70689b01].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | > | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "macros.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif /* No OF_VISIBILITY_HIDDEN so tests can call it. */ extern const char *_Nullable _OFStrPTime(const char *buffer, const char *format, struct tm *tm, short *_Nullable tz); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFStrPTime.m from [7d3b878a87] to [88f29fe94b].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #include <string.h> #import "OFStrPTime.h" #import "macros.h" const char * | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <string.h> #import "OFStrPTime.h" #import "macros.h" const char * _OFStrPTime(const char *buffer, const char *format, struct tm *tm, short *tz) { enum { stateSearchConversionSpecifier, stateInConversionSpecifier } state = stateSearchConversionSpecifier; size_t j, bufferLen, formatLen; |
︙ | ︙ |
Modified src/OFStream.m from [4f4737a0de] to [f7de880ff7].
︙ | ︙ | |||
1176 1177 1178 1179 1180 1181 1182 | { char *UTF8String; int length; if (format == nil) @throw [OFInvalidArgumentException exception]; | | | 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | { char *UTF8String; int length; if (format == nil) @throw [OFInvalidArgumentException exception]; if ((length = _OFVASPrintF(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { [self writeBuffer: UTF8String length: length]; } @finally { free(UTF8String); |
︙ | ︙ |
Modified src/OFStreamSocket.m from [a8d59e0323] to [83fbf8313f].
︙ | ︙ | |||
55 56 57 58 59 60 61 | @synthesize listening = _listening; + (void)initialize { if (self != [OFStreamSocket class]) return; | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | @synthesize listening = _listening; + (void)initialize { if (self != [OFStreamSocket class]) return; if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (instancetype)socket { return [[[self alloc] init] autorelease]; |
︙ | ︙ | |||
115 116 117 118 119 120 121 | @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS if ((ret = recv(_socket, buffer, length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS if ((ret = recv(_socket, buffer, length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recv(_socket, buffer, (int)length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: _OFSocketErrNo()]; #endif if (ret == 0) _atEndOfStream = true; return ret; } |
︙ | ︙ | |||
149 150 151 152 153 154 155 | @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, (void *)buffer, length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 | | | | | 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 183 184 185 186 187 188 189 190 191 192 193 | @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, (void *)buffer, length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #else int bytesWritten; if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = send(_socket, buffer, (int)length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: _OFSocketErrNo()]; #endif return (size_t)bytesWritten; } #if defined(OF_WINDOWS) || defined(OF_AMIGAOS) - (void)setCanBlock: (bool)canBlock { # ifdef OF_WINDOWS u_long v = !canBlock; # else char v = !canBlock; # endif if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; _canBlock = canBlock; } #endif - (int)fileDescriptorForReading { |
︙ | ︙ | |||
223 224 225 226 227 228 229 | - (int)of_socketError { int errNo; socklen_t len = sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) | | | | 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 256 257 | - (int)of_socketError { int errNo; socklen_t len = sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) return _OFSocketErrNo(); return errNo; } #endif - (void)listen { [self listenWithBacklog: SOMAXCONN]; } - (void)listenWithBacklog: (int)backlog { if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (listen(_socket, backlog) == -1) @throw [OFListenOnSocketFailedException exceptionWithSocket: self backlog: backlog errNo: _OFSocketErrNo()]; _listening = true; } - (instancetype)accept { OFStreamSocket *client; |
︙ | ︙ | |||
271 272 273 274 275 276 277 | #if defined(HAVE_PACCEPT) && defined(SOCK_CLOEXEC) if ((client->_socket = paccept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, NULL, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self | | | | | 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 | #if defined(HAVE_PACCEPT) && defined(SOCK_CLOEXEC) if ((client->_socket = paccept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, NULL, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; #elif defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) if ((client->_socket = accept4(_socket, (struct sockaddr * )&client->_remoteAddress.sockaddr, &client->_remoteAddress.length, SOCK_CLOEXEC)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; #else if ((client->_socket = accept(_socket, (struct sockaddr *)&client->_remoteAddress.sockaddr, &client->_remoteAddress.length)) == OFInvalidSocketHandle) @throw [OFAcceptSocketFailedException exceptionWithSocket: self errNo: _OFSocketErrNo()]; # if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(client->_socket, F_GETFD, 0)) != -1) fcntl(client->_socket, F_SETFD, flags | FD_CLOEXEC); # endif #endif |
︙ | ︙ |
Modified src/OFString+CryptographicHashing.h from [3d01f675bb] to [fa228a3cf2].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_CryptographicHashing_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (CryptographicHashing) /** * @brief The MD5 hash of the string as a string. |
︙ | ︙ |
Modified src/OFString+JSONParsing.h from [eb9d46998c] to [db00c1631e].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_JSONParsing_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (JSONParsing) /** * @brief The string interpreted as JSON and parsed as an object. |
︙ | ︙ |
Modified src/OFString+JSONParsing.m from [b1d14c6372] to [16ebad3f2c].
︙ | ︙ | |||
205 206 207 208 209 210 211 | if ((c1 & 0xFC00) == 0xDC00) { OFFreeMemory(buffer); return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { | | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | if ((c1 & 0xFC00) == 0xDC00) { OFFreeMemory(buffer); return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { l = _OFUTF8StringEncode(c1, buffer + i); if (l == 0) { OFFreeMemory(buffer); return nil; } i += l; *pointer += 5; |
︙ | ︙ | |||
231 232 233 234 235 236 237 | OFFreeMemory(buffer); return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | OFFreeMemory(buffer); return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; l = _OFUTF8StringEncode(c, buffer + i); if (l == 0) { OFFreeMemory(buffer); return nil; } i += l; *pointer += 11; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | if ((c1 & 0xFC00) == 0xDC00) { OFFreeMemory(buffer); return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | if ((c1 & 0xFC00) == 0xDC00) { OFFreeMemory(buffer); return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { l = _OFUTF8StringEncode(c1, buffer + i); if (l == 0) { OFFreeMemory(buffer); return nil; } i += l; *pointer += 5; |
︙ | ︙ | |||
352 353 354 355 356 357 358 | if (c2 == 0xFFFF) { OFFreeMemory(buffer); return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | if (c2 == 0xFFFF) { OFFreeMemory(buffer); return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; l = _OFUTF8StringEncode(c, buffer + i); if (l == 0) { OFFreeMemory(buffer); return nil; } i += l; *pointer += 11; |
︙ | ︙ |
Modified src/OFString+PathAdditions.h from [da8b9e10be] to [a5a01edfc3].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_PathAdditions_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (PathAdditions) /** * @brief Whether the path is an absolute path. |
︙ | ︙ |
Modified src/OFString+PercentEncoding.h from [31b4cb4844] to [10eac820fb].
︙ | ︙ | |||
22 23 24 25 26 27 28 | OF_ASSUME_NONNULL_BEGIN @class OFCharacterSet; #ifdef __cplusplus extern "C" { #endif | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | OF_ASSUME_NONNULL_BEGIN @class OFCharacterSet; #ifdef __cplusplus extern "C" { #endif extern int _OFString_PercentEncoding_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (PercentEncoding) /** * @brief The string with percent encoding removed. |
︙ | ︙ |
Modified src/OFString+PercentEncoding.m from [a22716408b] to [e783c0987e].
︙ | ︙ | |||
50 51 52 53 54 55 56 | if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) [ret appendCharacters: &c length: 1]; else { char buffer[4]; size_t bufferLen; | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) [ret appendCharacters: &c length: 1]; else { char buffer[4]; size_t bufferLen; if ((bufferLen = _OFUTF8StringEncode(c, buffer)) == 0) @throw [OFInvalidEncodingException exception]; for (size_t j = 0; j < bufferLen; j++) { unsigned char byte = buffer[j]; unsigned char high = byte >> 4; unsigned char low = byte & 0x0F; char escaped[3]; |
︙ | ︙ |
Modified src/OFString+PropertyListParsing.h from [6464166de9] to [1f14e12c20].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_PropertyListParsing_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (PropertyListParsing) /** * @brief The string interpreted as a property list and parsed as an object. |
︙ | ︙ |
Modified src/OFString+XMLEscaping.h from [e61bc93090] to [b627ccd424].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_XMLEscaping_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif @interface OFString (XMLEscaping) /** * @brief The string in a form escaped for use in an XML document. |
︙ | ︙ |
Modified src/OFString+XMLUnescaping.h from [5e3aafdb56] to [a3d8075ac3].
︙ | ︙ | |||
22 23 24 25 26 27 28 | OF_ASSUME_NONNULL_BEGIN /** @file */ #ifdef __cplusplus extern "C" { #endif | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | OF_ASSUME_NONNULL_BEGIN /** @file */ #ifdef __cplusplus extern "C" { #endif extern int _OFString_XMLUnescaping_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif #ifdef OF_HAVE_BLOCKS /** * @brief A block which is called to replace unknown XML entities in an XML |
︙ | ︙ |
Modified src/OFString+XMLUnescaping.m from [0faab389ff] to [faf5398fe6].
︙ | ︙ | |||
64 65 66 67 68 69 70 | if (entity[i] >= '0' && entity[i] <= '9') c = (c * 10) + (entity[i] - '0'); else return nil; } } | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | if (entity[i] >= '0' && entity[i] <= '9') c = (c * 10) + (entity[i] - '0'); else return nil; } } if ((i = _OFUTF8StringEncode(c, buffer)) == 0) return nil; buffer[i] = 0; return [OFString stringWithUTF8String: buffer length: i]; } static OFString * |
︙ | ︙ |
Modified src/OFString.h from [4b582c4c17] to [5ec6a2e4f7].
︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | * @brief Returns the name of the specified OFStringEncoding. * * @param encoding The encoding for which to return the name * @return The name of the specified OFStringEncoding */ extern OFString *_Nullable OFStringEncodingName(OFStringEncoding encoding); | | | > | > > | > > > > > > > | > > > > > | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | * @brief Returns the name of the specified OFStringEncoding. * * @param encoding The encoding for which to return the name * @return The name of the specified OFStringEncoding */ extern OFString *_Nullable OFStringEncodingName(OFStringEncoding encoding); /** * @brief Returns the length of the specified UTF-16 string. * * @param string The UTF-16 string * @return The length of the specified UTF-16 string */ extern size_t OFUTF16StringLength(const OFChar16 *string); /** * @brief Returns the length of the specified UTF-32 string. * * @param string The UTF-32 string * @return The length of the specified UTF-32 string */ extern size_t OFUTF32StringLength(const OFChar32 *string); extern char *_Nullable _OFStrDup(const char *_Nonnull) OF_VISIBILITY_HIDDEN; extern size_t _OFUTF8StringEncode(OFUnichar, char *) OF_VISIBILITY_HIDDEN; extern ssize_t _OFUTF8StringDecode(const char *, size_t, OFUnichar *) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END #import "OFConstantString.h" |
︙ | ︙ |
Modified src/OFString.m from [a5a923c44c] to [7205f31b8d].
︙ | ︙ | |||
100 101 102 103 104 105 106 | of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options depth: (size_t)depth; @end @interface OFPlaceholderString: OFString @end | | | | | | | | | | | | | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options depth: (size_t)depth; @end @interface OFPlaceholderString: OFString @end extern bool _OFUnicodeToISO8859_2(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToISO8859_3(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToISO8859_15(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToWindows1251(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToWindows1252(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToCodepage437(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToCodepage850(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToCodepage858(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToMacRoman(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToKOI8R(const OFUnichar *, unsigned char *, size_t, bool); extern bool _OFUnicodeToKOI8U(const OFUnichar *, unsigned char *, size_t, bool); /* References for static linking */ void OF_VISIBILITY_HIDDEN _references_to_categories_of_OFString(void) { _OFString_CryptographicHashing_reference = 1; _OFString_JSONParsing_reference = 1; #ifdef OF_HAVE_FILES _OFString_PathAdditions_reference = 1; #endif _OFString_PercentEncoding_reference = 1; _OFString_PropertyListParsing_reference = 1; _OFString_XMLEscaping_reference = 1; _OFString_XMLUnescaping_reference = 1; } void OF_VISIBILITY_HIDDEN _reference_to_OFConstantString(void) { [OFConstantString class]; } OFStringEncoding OFStringEncodingParseName(OFString *string) |
︙ | ︙ | |||
239 240 241 242 243 244 245 | return @"autodetect"; } return nil; } size_t | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | return @"autodetect"; } return nil; } size_t _OFUTF8StringEncode(OFUnichar character, char *buffer) { if (character < 0x80) { buffer[0] = character; return 1; } else if (character < 0x800) { buffer[0] = 0xC0 | (character >> 6); buffer[1] = 0x80 | (character & 0x3F); |
︙ | ︙ | |||
265 266 267 268 269 270 271 | return 4; } return 0; } ssize_t | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | return 4; } return 0; } ssize_t _OFUTF8StringDecode(const char *buffer_, size_t length, OFUnichar *ret) { const unsigned char *buffer = (const unsigned char *)buffer_; if (!(*buffer & 0x80)) { *ret = buffer[0]; return 1; } |
︙ | ︙ | |||
337 338 339 340 341 342 343 | while (*string++ != 0) length++; return length; } char * | | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | while (*string++ != 0) length++; return length; } char * _OFStrDup(const char *string) { size_t length = strlen(string); char *copy = (char *)OFAllocMemory(1, length + 1); memcpy(copy, string, length + 1); return copy; } |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | switch (encoding) { case OFStringEncodingUTF8:; size_t j = 0; for (i = 0; i < length; i++) { char buffer[4]; | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | switch (encoding) { case OFStringEncodingUTF8:; size_t j = 0; for (i = 0; i < length; i++) { char buffer[4]; size_t len = _OFUTF8StringEncode(characters[i], buffer); /* * Check for one more than the current index, as we * need one for the terminating zero. */ if (j + len >= maxLength) @throw [OFOutOfRangeException exception]; |
︙ | ︙ | |||
1130 1131 1132 1133 1134 1135 1136 | return length; #ifdef HAVE_ISO_8859_2 case OFStringEncodingISO8859_2: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; | | | | | | | | | | | | | | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 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 | return length; #ifdef HAVE_ISO_8859_2 case OFStringEncodingISO8859_2: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToISO8859_2(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_ISO_8859_3 case OFStringEncodingISO8859_3: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToISO8859_3(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_ISO_8859_15 case OFStringEncodingISO8859_15: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToISO8859_15(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_WINDOWS_1251 case OFStringEncodingWindows1251: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToWindows1251(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_WINDOWS_1252 case OFStringEncodingWindows1252: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToWindows1252(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_437 case OFStringEncodingCodepage437: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToCodepage437(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_850 case OFStringEncodingCodepage850: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToCodepage850(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_858 case OFStringEncodingCodepage858: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToCodepage858(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_MAC_ROMAN case OFStringEncodingMacRoman: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToMacRoman(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_KOI8_R case OFStringEncodingKOI8R: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToKOI8R(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif #ifdef HAVE_KOI8_U case OFStringEncodingKOI8U: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!_OFUnicodeToKOI8U(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; #endif |
︙ | ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | size_t length, UTF8StringLength = 0; characters = self.characters; length = self.length; for (size_t i = 0; i < length; i++) { char buffer[4]; | | | 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 | size_t length, UTF8StringLength = 0; characters = self.characters; length = self.length; for (size_t i = 0; i < length; i++) { char buffer[4]; size_t len = _OFUTF8StringEncode(characters[i], buffer); if (len == 0) @throw [OFInvalidEncodingException exception]; UTF8StringLength += len; } |
︙ | ︙ | |||
1550 1551 1552 1553 1554 1555 1556 | minimumLength = (length > otherLength ? otherLength : length); for (size_t i = 0; i < minimumLength; i++) { OFUnichar c = characters[i]; OFUnichar oc = otherCharacters[i]; #ifdef OF_HAVE_UNICODE_TABLES | | | | | | 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | minimumLength = (length > otherLength ? otherLength : length); for (size_t i = 0; i < minimumLength; i++) { OFUnichar c = characters[i]; OFUnichar oc = otherCharacters[i]; #ifdef OF_HAVE_UNICODE_TABLES if (c >> 8 < _OFUnicodeCaseFoldingTableSize) { OFUnichar tc = _OFUnicodeCaseFoldingTable[c >> 8][c & 0xFF]; if (tc) c = tc; } if (oc >> 8 < _OFUnicodeCaseFoldingTableSize) { OFUnichar tc = _OFUnicodeCaseFoldingTable[oc >> 8][oc & 0xFF]; if (tc) oc = tc; } #else c = OFASCIIToUpper(c); oc = OFASCIIToUpper(oc); |
︙ | ︙ |
Modified src/OFTCPSocket.m from [80e19ef290] to [21bc19a6d7].
︙ | ︙ | |||
145 146 147 148 149 150 151 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket( ((struct sockaddr *)&address->sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) { | | | | 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 | if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket( ((struct sockaddr *)&address->sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) { *errNo = _OFSocketErrNo(); return false; } #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif return true; } - (bool)of_connectSocketToAddress: (const OFSocketAddress *)address errNo: (int *)errNo { if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; /* Cast needed for AmigaOS, where the argument is declared non-const */ if (connect(_socket, (struct sockaddr *)&address->sockaddr, address->length) != 0) { *errNo = _OFSocketErrNo(); return false; } return true; } - (void)of_closeSocket |
︙ | ︙ | |||
319 320 321 322 323 324 325 | if ((_socket = socket( ((struct sockaddr *)&address.sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self | | | | 319 320 321 322 323 324 325 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 | if ((_socket = socket( ((struct sockaddr *)&address.sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&one, (socklen_t)sizeof(one)); #if defined(OF_HPUX) || defined(OF_WII) || defined(OF_NINTENDO_3DS) if (port != 0) { #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port |
︙ | ︙ | |||
363 364 365 366 367 368 369 | OFSocketAddressSetIPPort(&address, rnd); if ((ret = bind(_socket, (struct sockaddr *)&address.sockaddr, address.length)) == 0) break; | | | | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | OFSocketAddressSetIPPort(&address, rnd); if ((ret = bind(_socket, (struct sockaddr *)&address.sockaddr, address.length)) == 0) break; if (_OFSocketErrNo() != EADDRINUSE) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self errNo: errNo]; } } } #endif #if !defined(OF_HPUX) && !defined(OF_WII) && !defined(OF_NINTENDO_3DS) memset(&address, 0, sizeof(address)); address.length = (socklen_t)sizeof(address.sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address.sockaddr, &address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self |
︙ | ︙ | |||
431 432 433 434 435 436 437 | { int v = sendsKeepAlives; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithObject: self | | | | | | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 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 484 | { int v = sendsKeepAlives; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; } - (bool)sendsKeepAlives { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; return v; } #endif #ifndef OF_WII - (void)setCanDelaySendingSegments: (bool)canDelaySendingSegments { int v = !canDelaySendingSegments; if (setsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; } - (bool)canDelaySendingSegments { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self errNo: _OFSocketErrNo()]; return !v; } #endif - (void)close { |
︙ | ︙ |
Modified src/OFTLSKey.h from [0f3980a25d] to [4742ef8bb4].
︙ | ︙ | |||
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 50 51 52 53 54 55 56 57 58 59 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No thread-local storage available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_key_t OFTLSKey; #elif defined(OF_WINDOWS) # include <windows.h> typedef DWORD OFTLSKey; #elif defined(OF_MORPHOS) # include <proto/exec.h> typedef ULONG OFTLSKey; #elif defined(OF_AMIGAOS) typedef struct _OFTLSKey { struct objc_hashtable *table; struct _OFTLSKey *next, *previous; } *OFTLSKey; #endif #ifdef __cplusplus extern "C" { #endif extern int OFTLSKeyNew(OFTLSKey *key); extern int OFTLSKeyFree(OFTLSKey key); #ifdef __cplusplus } #endif /* TLS keys are inlined for performance. */ | > > > > > > > > > > > > > > > | > > > > > > > > > > > > | | | | | | | | 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 50 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No thread-local storage available! #endif #import "macros.h" /** @file */ #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_key_t OFTLSKey; #elif defined(OF_WINDOWS) # include <windows.h> typedef DWORD OFTLSKey; #elif defined(OF_MORPHOS) # include <proto/exec.h> typedef ULONG OFTLSKey; #elif defined(OF_AMIGAOS) typedef struct _OFTLSKey { struct objc_hashtable *table; struct _OFTLSKey *next, *previous; } *OFTLSKey; #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Creates a new Thread Local Storage key. * * @param key A pointer to the key to create * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFTLSKeyNew(OFTLSKey *key); /** * @brief Destroys the specified Thread Local Storage key. * * @param key A pointer to the key to destroy * @return 0 on success, or an error number from `<errno.h>` on error */ extern int OFTLSKeyFree(OFTLSKey key); #ifdef __cplusplus } #endif /* TLS keys are inlined for performance. */ #if defined(OF_HAVE_PTHREADS) || defined(DOXYGEN) /** * @brief Returns the current value for the specified Thread Local Storage key. * * @param key A pointer to the key whose value to return * @return The current value for the specified Thread Local Storage key */ static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return pthread_getspecific(key); } /** * @brief Sets the current value for the specified Thread Local Storage key. * * @param key A pointer to the key whose value to set * @param value The new value for the key */ static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *value) { return pthread_setspecific(key, value); } #elif defined(OF_WINDOWS) static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return TlsGetValue(key); } static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *value) { return (TlsSetValue(key, value) ? 0 : EINVAL); } #elif defined(OF_MORPHOS) static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return (void *)TLSGetValue(key); } static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *value) { return (TLSSetValue(key, (APTR)value) ? 0 : EINVAL); } #elif defined(OF_AMIGAOS) /* Those are too big too inline. */ # ifdef __cplusplus extern "C" { # endif extern void *OFTLSKeyGet(OFTLSKey key); extern int OFTLSKeySet(OFTLSKey key, void *value); # ifdef __cplusplus } # endif #endif |
Modified src/OFTLSStream.m from [cdc1005db6] to [9bf5b732e6].
︙ | ︙ | |||
37 38 39 40 41 42 43 | static const OFRunLoopMode handshakeRunLoopMode = @"OFTLSStreamHandshakeRunLoopMode"; /* * References to exceptions. This is needed because they are only used by * subclasses that are in a different library. */ | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | static const OFRunLoopMode handshakeRunLoopMode = @"OFTLSStreamHandshakeRunLoopMode"; /* * References to exceptions. This is needed because they are only used by * subclasses that are in a different library. */ void OF_VISIBILITY_HIDDEN _references_to_exceptions_of_OFTLSStream(void) { _OFTLSHandshakeFailedException_reference = 1; } OFString * OFTLSStreamErrorCodeDescription(OFTLSStreamErrorCode errorCode) |
︙ | ︙ |
Modified src/OFTaggedPointerDate.m from [3a7c65c57a] to [d646100367].
︙ | ︙ | |||
36 37 38 39 40 41 42 | - (OFTimeInterval)timeIntervalSince1970 { uint64_t value = (uint64_t)object_getTaggedPointerValue(self); value |= UINT64_C(4) << 60; | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - (OFTimeInterval)timeIntervalSince1970 { uint64_t value = (uint64_t)object_getTaggedPointerValue(self); value |= UINT64_C(4) << 60; return OFFromBigEndianDouble(OFBitConvertUInt64ToDouble(OFToBigEndian64( value))); } OF_SINGLETON_METHODS @end #endif |
Modified src/OFTarArchive.m from [67f03e487e] to [300800373d].
︙ | ︙ | |||
88 89 90 91 92 93 94 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { return _OFArchiveIRIHandlerIRIForFileInArchive(@"tar", path, IRI); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ |
Modified src/OFThread.m from [c590c3dc16] to [f0b78222ad].
︙ | ︙ | |||
123 124 125 126 127 128 129 | OFSetThreadName( [name cStringWithEncoding: [OFLocale encoding]]); else OFSetThreadName(object_getClassName(thread)); #if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | OFSetThreadName( [name cStringWithEncoding: [OFLocale encoding]]); else OFSetThreadName(object_getClassName(thread)); #if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) if (!_OFSocketInit()) @throw [OFInitializationFailedException exceptionWithClass: thread.class]; #endif /* * Nasty workaround for thread implementations which can't return a * pointer on join, or don't have a way to exit a thread. |
︙ | ︙ | |||
151 152 153 154 155 156 157 | objc_autoreleasePoolPop((void *)(uintptr_t)-1); #else objc_autoreleasePoolPop(thread->_pool); #endif #if defined(OF_AMIGAOS) && !defined(OF_MORPHOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | objc_autoreleasePoolPop((void *)(uintptr_t)-1); #else objc_autoreleasePoolPop(thread->_pool); #endif #if defined(OF_AMIGAOS) && !defined(OF_MORPHOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) _OFSocketDeinit(); #endif thread->_running = OFThreadStateWaitingForJoin; [thread release]; } |
︙ | ︙ |
Modified src/OFUDPSocket.m from [d9b5e328f7] to [b9116525f2].
︙ | ︙ | |||
58 59 60 61 62 63 64 | if ((_socket = socket( ((struct sockaddr *)&address->sockaddr)->sa_family, SOCK_DGRAM | SOCK_CLOEXEC | extraType, 0)) == OFInvalidSocketHandle) @throw [OFBindIPSocketFailedException exceptionWithHost: OFSocketAddressString(address) port: OFSocketAddressIPPort(address) socket: self | | | | 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 | if ((_socket = socket( ((struct sockaddr *)&address->sockaddr)->sa_family, SOCK_DGRAM | SOCK_CLOEXEC | extraType, 0)) == OFInvalidSocketHandle) @throw [OFBindIPSocketFailedException exceptionWithHost: OFSocketAddressString(address) port: OFSocketAddressIPPort(address) socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) /* {} needed to avoid warning with Clang 10 if next #if is false. */ if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) { fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); } #endif #if defined(OF_HPUX) || defined(OF_WII) || defined(OF_NINTENDO_3DS) if (OFSocketAddressIPPort(address) != 0) { #endif if (bind(_socket, (struct sockaddr *)&address->sockaddr, address->length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException exceptionWithHost: OFSocketAddressString(address) port: OFSocketAddressIPPort(address) |
︙ | ︙ | |||
101 102 103 104 105 106 107 | OFSocketAddressSetIPPort(address, rnd); if ((ret = bind(_socket, (struct sockaddr *)&address->sockaddr, address->length)) == 0) break; | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | OFSocketAddressSetIPPort(address, rnd); if ((ret = bind(_socket, (struct sockaddr *)&address->sockaddr, address->length)) == 0) break; if (_OFSocketErrNo() != EADDRINUSE) { int errNo = _OFSocketErrNo(); OFString *host = OFSocketAddressString(address); uint16_t port = OFSocketAddressIPPort(address); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException |
︙ | ︙ | |||
126 127 128 129 130 131 132 | #if !defined(OF_HPUX) && !defined(OF_WII) && !defined(OF_NINTENDO_3DS) host = OFSocketAddressString(address); port = OFSocketAddressIPPort(address); memset(address, 0, sizeof(*address)); address->length = (socklen_t)sizeof(address->sockaddr); | | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | #if !defined(OF_HPUX) && !defined(OF_WII) && !defined(OF_NINTENDO_3DS) host = OFSocketAddressString(address); port = OFSocketAddressIPPort(address); memset(address, 0, sizeof(*address)); address->length = (socklen_t)sizeof(address->sockaddr); if (_OFGetSockName(_socket, (struct sockaddr *)&address->sockaddr, &address->length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self |
︙ | ︙ |
Modified src/OFUNIXDatagramSocket.m from [2627547b65] to [bf02eb42d7].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | */ #include "config.h" #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #import "OFUNIXDatagramSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyOpenException.h" #import "OFBindUNIXSocketFailedException.h" @implementation OFUNIXDatagramSocket @dynamic delegate; - (OFSocketAddress)bindToPath: (OFString *)path { OFSocketAddress address; | > > > | | | | | | > > > > > > > > > > | 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 50 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 93 94 95 96 97 98 | */ #include "config.h" #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #include <errno.h> #import "OFUNIXDatagramSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyOpenException.h" #import "OFBindUNIXSocketFailedException.h" @implementation OFUNIXDatagramSocket @dynamic delegate; - (OFSocketAddress)bindToPath: (OFString *)path { #ifndef OF_HURD OFSocketAddress address; # if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; # endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if (path != nil) address = OFSocketAddressMakeUNIX(path); else { address.family = OFSocketAddressFamilyUnknown; address.length = 0; } if ((_socket = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self errNo: _OFSocketErrNo()]; _canBlock = true; # if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); # endif if (path != nil) { if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self errNo: errNo]; } } return address; #else /* * Datagram UNIX sockets on Hurd are broken and don't return the sender * correctly when using recvfrom(). */ @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self errNo: EAFNOSUPPORT]; #endif } @end |
Modified src/OFUNIXStreamSocket.m from [3bba9beb8b] to [fdc5ad3c80].
︙ | ︙ | |||
48 49 50 51 52 53 54 | address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path socket: self | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (connect(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path socket: self |
︙ | ︙ | |||
88 89 90 91 92 93 94 | address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self | | | | 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 | address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self errNo: _OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (bind(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = _OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFBindUNIXSocketFailedException exceptionWithPath: path socket: self errNo: errNo]; } } @end |
Modified src/OFUTF8String.h from [cef941820b] to [a9510f1ddf].
︙ | ︙ | |||
42 43 44 45 46 47 48 | struct OFUTF8StringIvars _storage; } @end #ifdef __cplusplus extern "C" { #endif | | > | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | struct OFUTF8StringIvars _storage; } @end #ifdef __cplusplus extern "C" { #endif extern int _OFUTF8StringCheck(const char *, size_t, size_t *_Nullable) OF_VISIBILITY_HIDDEN; extern size_t _OFUTF8StringIndexToPosition(const char *, size_t, size_t) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFUTF8String.m from [720c0708e2] to [3e5753e6f2].
︙ | ︙ | |||
39 40 41 42 43 44 45 | #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "unicode.h" | | | | | | | | | | | | | | | | | | | | | | | | 39 40 41 42 43 44 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 71 72 73 74 | #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "unicode.h" extern const OFChar16 _OFISO8859_2Table[]; extern const size_t _OFISO8859_2TableOffset; extern const OFChar16 _OFISO8859_3Table[]; extern const size_t _OFISO8859_3TableOffset; extern const OFChar16 _OFISO8859_15Table[]; extern const size_t _OFISO8859_15TableOffset; extern const OFChar16 _OFWindows1251Table[]; extern const size_t _OFWindows1251TableOffset; extern const OFChar16 _OFWindows1252Table[]; extern const size_t _OFWindows1252TableOffset; extern const OFChar16 _OFCodepage437Table[]; extern const size_t _OFCodepage437TableOffset; extern const OFChar16 _OFCodepage850Table[]; extern const size_t _OFCodepage850TableOffset; extern const OFChar16 _OFCodepage858Table[]; extern const size_t _OFCodepage858TableOffset; extern const OFChar16 _OFMacRomanTable[]; extern const size_t _OFMacRomanTableOffset; extern const OFChar16 _OFKOI8RTable[]; extern const size_t _OFKOI8RTableOffset; extern const OFChar16 _OFKOI8UTable[]; extern const size_t _OFKOI8UTableOffset; static inline int memcasecmp(const char *first, const char *second, size_t length) { for (size_t i = 0; i < length; i++) { unsigned char f = first[i]; unsigned char s = second[i]; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | return OFOrderedAscending; } return OFOrderedSame; } int | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | return OFOrderedAscending; } return OFOrderedSame; } int _OFUTF8StringCheck(const char *UTF8String, size_t UTF8Length, size_t *length) { size_t tmpLength = UTF8Length; int isUTF8 = 0; for (size_t i = 0; i < UTF8Length; i++) { /* No sign of UTF-8 here */ if OF_LIKELY (!(UTF8String[i] & 0x80)) |
︙ | ︙ | |||
148 149 150 151 152 153 154 | if (length != NULL) *length = tmpLength; return isUTF8; } | | | | 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 | if (length != NULL) *length = tmpLength; return isUTF8; } static size_t positionToIndex(const char *string, size_t position) { size_t idx = position; for (size_t i = 0; i < position; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) idx--; return idx; } size_t _OFUTF8StringIndexToPosition(const char *string, size_t idx, size_t length) { for (size_t i = 0; i <= idx; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) if (++idx > length) @throw [OFInvalidFormatException exception]; return idx; |
︙ | ︙ | |||
207 208 209 210 211 212 213 | } _s = &_storage; _s->cString = storage; _s->cStringLength = UTF8StringLength; | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | } _s = &_storage; _s->cString = storage; _s->cStringLength = UTF8StringLength; switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, &_s->length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
251 252 253 254 255 256 257 | _s->cString = OFAllocMemory(cStringLength + 1, 1); _s->cStringLength = cStringLength; _s->freeWhenDone = true; if (encoding == OFStringEncodingUTF8 || encoding == OFStringEncodingASCII) { | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | _s->cString = OFAllocMemory(cStringLength + 1, 1); _s->cStringLength = cStringLength; _s->freeWhenDone = true; if (encoding == OFStringEncodingUTF8 || encoding == OFStringEncodingASCII) { switch (_OFUTF8StringCheck(cString, cStringLength, &_s->length)) { case 1: if (encoding == OFStringEncodingASCII) @throw [OFInvalidEncodingException exception]; _s->isUTF8 = true; |
︙ | ︙ | |||
285 286 287 288 289 290 291 | if (!(cString[i] & 0x80)) { _s->cString[j++] = cString[i]; continue; } _s->isUTF8 = true; | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | if (!(cString[i] & 0x80)) { _s->cString[j++] = cString[i]; continue; } _s->isUTF8 = true; bytes = _OFUTF8StringEncode( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += bytes - 1; |
︙ | ︙ | |||
312 313 314 315 316 317 318 | switch (encoding) { #define CASE(encoding, var) \ case encoding: \ table = var; \ tableOffset = var##Offset; \ break; #ifdef HAVE_ISO_8859_2 | | | | | | | | | | | | | < < < < | > > > > > > > < > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 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 383 384 385 | switch (encoding) { #define CASE(encoding, var) \ case encoding: \ table = var; \ tableOffset = var##Offset; \ break; #ifdef HAVE_ISO_8859_2 CASE(OFStringEncodingISO8859_2, _OFISO8859_2Table) #endif #ifdef HAVE_ISO_8859_3 CASE(OFStringEncodingISO8859_3, _OFISO8859_3Table) #endif #ifdef HAVE_ISO_8859_15 CASE(OFStringEncodingISO8859_15, _OFISO8859_15Table) #endif #ifdef HAVE_WINDOWS_1251 CASE(OFStringEncodingWindows1251, _OFWindows1251Table) #endif #ifdef HAVE_WINDOWS_1252 CASE(OFStringEncodingWindows1252, _OFWindows1252Table) #endif #ifdef HAVE_CODEPAGE_437 CASE(OFStringEncodingCodepage437, _OFCodepage437Table) #endif #ifdef HAVE_CODEPAGE_850 CASE(OFStringEncodingCodepage850, _OFCodepage850Table) #endif #ifdef HAVE_CODEPAGE_858 CASE(OFStringEncodingCodepage858, _OFCodepage858Table) #endif #ifdef HAVE_MAC_ROMAN CASE(OFStringEncodingMacRoman, _OFMacRomanTable) #endif #ifdef HAVE_KOI8_R CASE(OFStringEncodingKOI8R, _OFKOI8RTable) #endif #ifdef HAVE_KOI8_U CASE(OFStringEncodingKOI8U, _OFKOI8UTable) #endif #undef CASE default: @throw [OFInvalidArgumentException exception]; } j = 0; for (size_t i = 0; i < cStringLength; i++) { unsigned char character = (unsigned char)cString[i]; OFUnichar unichar; char buffer[4]; size_t byteLength; if (character >= tableOffset) unichar = table[character - tableOffset]; else unichar = character; if (unichar == 0xFFFF) @throw [OFInvalidEncodingException exception]; if (unichar < 0x7F) { _s->cString[j++] = (char)unichar; continue; } _s->isUTF8 = true; byteLength = _OFUTF8StringEncode(unichar, buffer); if (byteLength == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += byteLength - 1; _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + 1, 1); |
︙ | ︙ | |||
413 414 415 416 417 418 419 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (_OFUTF8StringCheck(UTF8String, UTF8StringLength, &_s->length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
441 442 443 444 445 446 447 | { self = [super init]; @try { _s = &_storage; _s->cStringLength = string.UTF8StringLength; | < < < < < < < > > > > > > > > > > > > > > | 444 445 446 447 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 | { self = [super init]; @try { _s = &_storage; _s->cStringLength = string.UTF8StringLength; _s->length = string.length; _s->cString = OFAllocMemory(_s->cStringLength + 1, 1); memcpy(_s->cString, string.UTF8String, _s->cStringLength + 1); _s->freeWhenDone = true; if ([string isKindOfClass: [OFUTF8String class]] || [string isKindOfClass: [OFMutableUTF8String class]]) _s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8; else { switch (_OFUTF8StringCheck(_s->cString, _s->cStringLength, NULL)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } } } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
477 478 479 480 481 482 483 | _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { size_t len = _OFUTF8StringEncode(characters[i], _s->cString + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) _s->isUTF8 = true; |
︙ | ︙ | |||
563 564 565 566 567 568 569 | character = (((character & 0x3FF) << 10) | (nextCharacter & 0x3FF)) + 0x10000; i++; _s->length--; } | | | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | character = (((character & 0x3FF) << 10) | (nextCharacter & 0x3FF)) + 0x10000; i++; _s->length--; } len = _OFUTF8StringEncode(character, _s->cString + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) _s->isUTF8 = true; |
︙ | ︙ | |||
619 620 621 622 623 624 625 | _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { char buffer[4]; | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | _s->cString = OFAllocMemory((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 = _OFUTF8StringEncode((swap ? OFByteSwap32(characters[i]) : characters[i]), buffer); switch (len) { case 1: _s->cString[j++] = buffer[0]; |
︙ | ︙ | |||
672 673 674 675 676 677 678 | int cStringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; _s = &_storage; | | | | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | int cStringLength; if (format == nil) @throw [OFInvalidArgumentException exception]; _s = &_storage; if ((cStringLength = _OFVASPrintF(&tmp, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; _s->cStringLength = cStringLength; @try { switch (_OFUTF8StringCheck(tmp, cStringLength, &_s->length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
873 874 875 876 877 878 879 | i = j = 0; while (i < _s->cStringLength && j < otherCStringLength) { OFUnichar c1, c2; ssize_t l1, l2; | | | | | | | | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | i = j = 0; while (i < _s->cStringLength && j < otherCStringLength) { OFUnichar c1, c2; ssize_t l1, l2; l1 = _OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c1); l2 = _OFUTF8StringDecode(otherCString + j, otherCStringLength - j, &c2); if (l1 <= 0 || l2 <= 0 || c1 > 0x10FFFF || c2 > 0x10FFFF) @throw [OFInvalidEncodingException exception]; if (c1 >> 8 < _OFUnicodeCaseFoldingTableSize) { OFUnichar tc = _OFUnicodeCaseFoldingTable[c1 >> 8][c1 & 0xFF]; if (tc) c1 = tc; } if (c2 >> 8 < _OFUnicodeCaseFoldingTableSize) { OFUnichar tc = _OFUnicodeCaseFoldingTable[c2 >> 8][c2 & 0xFF]; if (tc) c2 = tc; } if (c1 > c2) return OFOrderedDescending; |
︙ | ︙ | |||
928 929 930 931 932 933 934 | OFHashInit(&hash); for (size_t i = 0; i < _s->cStringLength; i++) { OFUnichar c; ssize_t length; | | | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | OFHashInit(&hash); for (size_t i = 0; i < _s->cStringLength; i++) { OFUnichar c; ssize_t length; if ((length = _OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c)) <= 0) @throw [OFInvalidEncodingException exception]; OFHashAddByte(&hash, (c & 0xFF0000) >> 16); OFHashAddByte(&hash, (c & 0x00FF00) >> 8); OFHashAddByte(&hash, c & 0x0000FF); |
︙ | ︙ | |||
957 958 959 960 961 962 963 | if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) return _s->cString[idx]; | | | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) return _s->cString[idx]; idx = _OFUTF8StringIndexToPosition(_s->cString, idx, _s->cStringLength); if (_OFUTF8StringDecode(_s->cString + idx, _s->cStringLength - idx, &character) <= 0) @throw [OFInvalidEncodingException exception]; return character; } - (void)getCharacters: (OFUnichar *)buffer inRange: (OFRange)range |
︙ | ︙ | |||
995 996 997 998 999 1000 1001 | size_t rangeLocation, rangeLength; if (range.length > SIZE_MAX - range.location || range.location + range.length > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { | | | | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | size_t rangeLocation, rangeLength; if (range.length > SIZE_MAX - range.location || range.location + range.length > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { rangeLocation = _OFUTF8StringIndexToPosition( _s->cString, range.location, _s->cStringLength); rangeLength = _OFUTF8StringIndexToPosition( _s->cString + rangeLocation, range.length, _s->cStringLength - rangeLocation); } else { rangeLocation = range.location; rangeLength = range.length; } |
︙ | ︙ | |||
1069 1070 1071 1072 1073 1074 1075 | size_t start = range.location; size_t end = range.location + range.length; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { | | | | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | size_t start = range.location; size_t end = range.location + range.length; if (range.length > SIZE_MAX - range.location || end > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) { start = _OFUTF8StringIndexToPosition(_s->cString, start, _s->cStringLength); end = _OFUTF8StringIndexToPosition(_s->cString, end, _s->cStringLength); } return [OFString stringWithUTF8String: _s->cString + start length: end - start]; } |
︙ | ︙ | |||
1163 1164 1165 1166 1167 1168 1169 | size_t i = 0, j = 0; const OFUnichar *ret; while (i < _s->cStringLength) { OFUnichar c; ssize_t cLen; | | | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | size_t i = 0, j = 0; const OFUnichar *ret; while (i < _s->cStringLength) { OFUnichar c; ssize_t cLen; cLen = _OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c); if (cLen <= 0 || c > 0x10FFFF) { OFFreeMemory(buffer); @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | size_t i = 0, j = 0; const OFChar32 *ret; while (i < _s->cStringLength) { OFChar32 c; ssize_t cLen; | | | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | size_t i = 0, j = 0; const OFChar32 *ret; while (i < _s->cStringLength) { OFChar32 c; ssize_t cLen; cLen = _OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c); if (cLen <= 0 || c > 0x10FFFF) { OFFreeMemory(buffer); @throw [OFInvalidEncodingException exception]; } |
︙ | ︙ |
Modified src/OFZIPArchive.h from [f4b92af793] to [e571bce84b].
︙ | ︙ | |||
240 241 242 243 244 245 246 | */ - (void)close; @end #ifdef __cplusplus extern "C" { #endif | | | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | */ - (void)close; @end #ifdef __cplusplus extern "C" { #endif extern uint32_t _OFZIPArchiveReadField32(const uint8_t *_Nonnull *_Nonnull, uint16_t *_Nonnull) OF_VISIBILITY_HIDDEN; extern uint64_t _OFZIPArchiveReadField64(const uint8_t *_Nonnull *_Nonnull, uint16_t *_Nonnull) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/OFZIPArchive.m from [7c50e25802] to [b2947775a7].
︙ | ︙ | |||
117 118 119 120 121 122 123 | stream: (OFStream *)stream entry: (OFMutableZIPArchiveEntry *)entry CRC32Offset: (OFStreamOffset)CRC32Offset size64Offset: (OFStreamOffset)size64Offset; @end uint32_t | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | stream: (OFStream *)stream entry: (OFMutableZIPArchiveEntry *)entry CRC32Offset: (OFStreamOffset)CRC32Offset size64Offset: (OFStreamOffset)size64Offset; @end uint32_t _OFZIPArchiveReadField32(const uint8_t **data, uint16_t *size) { uint32_t field = 0; if (*size < 4) @throw [OFInvalidFormatException exception]; for (uint8_t i = 0; i < 4; i++) field |= (uint32_t)(*data)[i] << (i * 8); *data += 4; *size -= 4; return field; } uint64_t _OFZIPArchiveReadField64(const uint8_t **data, uint16_t *size) { uint64_t field = 0; if (*size < 8) @throw [OFInvalidFormatException exception]; for (uint8_t i = 0; i < 8; i++) |
︙ | ︙ | |||
199 200 201 202 203 204 205 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { return _OFArchiveIRIHandlerIRIForFileInArchive(@"zip", path, IRI); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ | |||
744 745 746 747 748 749 750 | if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) | | | | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = _OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) _compressedSize = _OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (ZIP64Size > 0) @throw [OFInvalidFormatException exception]; [extraField removeItemsInRange: range]; } |
︙ | ︙ | |||
920 921 922 923 924 925 926 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; | | | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; _CRC32 = _OFCRC32(_CRC32, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; if (~_CRC32 != _entry.CRC32) { OFString *actualChecksum = [OFString stringWithFormat: @"%08" PRIX32, ~_CRC32]; |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (unsigned long long)e.bytesWritten; | | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (unsigned long long)e.bytesWritten; _CRC32 = _OFCRC32(_CRC32, buffer, e.bytesWritten); if (e.errNo == EWOULDBLOCK || e.errNo == EAGAIN) return e.bytesWritten; @throw e; } _bytesWritten += (unsigned long long)length; _CRC32 = _OFCRC32(_CRC32, buffer, length); return length; } - (void)close { bool seekable; |
︙ | ︙ |
Modified src/OFZIPArchiveEntry.m from [ff7db8bf1d] to [d2d793d4fd].
︙ | ︙ | |||
244 245 246 247 248 249 250 | if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) | | | | > | | 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 | if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = _OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) _compressedSize = _OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (_localFileHeaderOffset == 0xFFFFFFFF) _localFileHeaderOffset = _OFZIPArchiveReadField64(&ZIP64, &ZIP64Size); if (_startDiskNumber == 0xFFFF) _startDiskNumber = _OFZIPArchiveReadField32( &ZIP64, &ZIP64Size); if (ZIP64Size > 0 || _localFileHeaderOffset < 0) @throw [OFInvalidFormatException exception]; [extraField removeItemsInRange: range]; } |
︙ | ︙ |
Modified src/OFZooArchive.m from [5083c851c9] to [8aedfeb877].
︙ | ︙ | |||
105 106 107 108 109 110 111 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode { return [[[self alloc] initWithIRI: IRI mode: mode] autorelease]; } + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI { return _OFArchiveIRIHandlerIRIForFileInArchive(@"zoo", path, IRI); } - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | ︙ | |||
305 306 307 308 309 310 311 | [_stream readIntoBuffer: buffer exactLength: _lastHeaderLength]; tmp32 = OFToLittleEndian32((uint32_t)offset); memcpy(buffer + 6, &tmp32, 4); tmp16 = OFToLittleEndian16( | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | [_stream readIntoBuffer: buffer exactLength: _lastHeaderLength]; tmp32 = OFToLittleEndian32((uint32_t)offset); memcpy(buffer + 6, &tmp32, 4); tmp16 = OFToLittleEndian16( _OFCRC16(0, buffer, _lastHeaderLength)); memcpy(buffer + 54, &tmp16, 2); [_stream seekToOffset: _lastHeaderOffset whence: OFSeekSet]; [_stream writeBuffer: buffer length: _lastHeaderLength]; [_stream seekToOffset: offset whence: OFSeekSet]; } @finally { |
︙ | ︙ | |||
491 492 493 494 495 496 497 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; | | | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | if (length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; _CRC16 = _OFCRC16(_CRC16, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; if (_CRC16 != _entry.CRC16) { OFString *actualChecksum = [OFString stringWithFormat: @"%04" @PRIX16, _CRC16]; |
︙ | ︙ | |||
602 603 604 605 606 607 608 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (uint32_t)e.bytesWritten; | | | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten <= length); _bytesWritten += (uint32_t)e.bytesWritten; _CRC16 = _OFCRC16(_CRC16, buffer, e.bytesWritten); if (e.errNo == EWOULDBLOCK || e.errNo == EAGAIN) return e.bytesWritten; @throw e; } _bytesWritten += (uint32_t)length; _CRC16 = _OFCRC16(_CRC16, buffer, length); return length; } - (bool)lowlevelIsAtEndOfStream { if (_stream == nil) |
︙ | ︙ |
Modified src/bridge/NSArray+OFObject.h from [7e0f2d7704] to [38325c709c].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif extern int _NSArray_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSArray (OFObject) \ * NSArray+OFObject.h ObjFWBridge/NSArray+OFObject.h |
︙ | ︙ |
Modified src/bridge/NSDictionary+OFObject.h from [cbb576e980] to [4026e868e8].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFDictionary OF_GENERIC(KeyType, ObjectType); #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFDictionary OF_GENERIC(KeyType, ObjectType); #ifdef __cplusplus extern "C" { #endif extern int _NSDictionary_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSDictionary (OFObject) \ * NSDictionary+OFObject.h ObjFWBridge/NSDictionary+OFObject.h |
︙ | ︙ |
Modified src/bridge/NSEnumerator+OFObject.h from [ab538c58f1] to [143ba9176b].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFEnumerator OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFEnumerator OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif extern int _NSEnumerator_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSEnumerator (OFObject) \ * NSEnumerator+OFObject.h ObjFWBridge/NSEnumerator+OFObject.h |
︙ | ︙ |
Modified src/bridge/NSNumber+OFObject.h from [40720010ad] to [e239036299].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFNumber; #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFNumber; #ifdef __cplusplus extern "C" { #endif extern int _NSNumber_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSNumber (OFObject) * NSNumber+OFObject.h ObjFWBridge/NSNumber+OFObject.h |
︙ | ︙ |
Modified src/bridge/NSSet+OFObject.h from [34c28f8121] to [5d09584e13].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFSet OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFSet OF_GENERIC(ObjectType); #ifdef __cplusplus extern "C" { #endif extern int _NSSet_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSSet (OFObject) * NSSet+OFObject.h ObjFWBridge/NSSet+OFObject.h |
︙ | ︙ |
Modified src/bridge/NSString+OFObject.h from [80a6874084] to [b85dde5f1c].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OF_ASSUME_NONNULL_BEGIN @class OFString; #ifdef __cplusplus extern "C" { #endif | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | OF_ASSUME_NONNULL_BEGIN @class OFString; #ifdef __cplusplus extern "C" { #endif extern int _NSString_OFObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category NSString (OFObject) * NSString+OFObject.h ObjFWBridge/NSString+OFObject.h |
︙ | ︙ |
Modified src/bridge/OFArray+NSObject.h from [3b8ba1cd06] to [8452e2cf90].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFArray_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFArray (NSObject) \ * OFArray+NSObject.h ObjFWBridge/OFArray+NSObject.h |
︙ | ︙ |
Modified src/bridge/OFDictionary+NSObject.h from [bebeef9986] to [7d3951e3ba].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFDictionary_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFDictionary (NSObject) \ * OFDictionary+NSObject.h ObjFWBridge/OFDictionary+NSObject.h |
︙ | ︙ |
Modified src/bridge/OFEnumerator+NSObject.h from [731ca967a3] to [9aadb90dd5].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFEnumerator_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFEnumerator (NSObject) \ * OFEnumerator+NSObject.h ObjFWBridge/OFEnumerator+NSObject.h |
︙ | ︙ |
Modified src/bridge/OFNumber+NSObject.h from [fadb7d7a45] to [7b4d5234a4].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFNumber_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFNumber (NSObject) \ * OFNumber+NSObject.h ObjFWBridge/OFNumber+NSObject.h |
︙ | ︙ |
Modified src/bridge/OFSet+NSObject.h from [5726564da5] to [3b2725d99a].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFSet_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFSet (NSObject) \ * OFSet+NSObject.h ObjFWBridge/OFSet+NSObject.h |
︙ | ︙ |
Modified src/bridge/OFString+NSObject.h from [cb39a1ef91] to [287ae0c0ff].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFBridging.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFString_NSObject_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @category OFString (NSObject) \ * OFString+NSObject.h ObjFWBridge/OFString+NSObject.h |
︙ | ︙ |
Modified src/encodings/codepage-437.m from [9f118a4c02] to [0e1d4e03c0].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFCodepage437Table[] OF_VISIBILITY_HIDDEN = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; const size_t _OFCodepage437TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFCodepage437Table) / sizeof(*_OFCodepage437Table)); static const unsigned char page0[] = { 0xFF, 0xAD, 0x9B, 0x9C, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x00, 0xA6, 0xAE, 0xAA, 0x00, 0x00, 0x00, 0xF8, 0xF1, 0xFD, 0x00, 0x00, 0xE6, 0x00, 0xFA, 0x00, 0x00, 0xA7, 0xAF, 0xAC, 0xAB, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x8F, 0x92, 0x80, |
︙ | ︙ | |||
128 129 130 131 132 133 134 | 0xDB, 0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0xDE, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; | | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | 0xDB, 0x00, 0x00, 0x00, 0xDD, 0x00, 0x00, 0x00, 0xDE, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; bool OF_VISIBILITY_HIDDEN _OFUnicodeToCodepage437(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/codepage-850.m from [1d1a09a45c] to [116375a4bc].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | < | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFCodepage850Table[] OF_VISIBILITY_HIDDEN = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; const size_t _OFCodepage850TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFCodepage850Table) / sizeof(*_OFCodepage850Table)); static const unsigned char page0[] = { 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, |
︙ | ︙ | |||
104 105 106 107 108 109 110 | 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; bool OF_VISIBILITY_HIDDEN _OFUnicodeToCodepage850(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/codepage-858.m from [4aa1a82036] to [0a443ea671].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | < | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFCodepage858Table[] OF_VISIBILITY_HIDDEN = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x20AC, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; const size_t _OFCodepage858TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFCodepage858Table) / sizeof(*_OFCodepage858Table)); static const unsigned char page0[] = { 0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, 0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, 0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, 0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, 0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, |
︙ | ︙ | |||
110 111 112 113 114 115 116 | 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; | | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xB1, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE }; static const uint8_t page25Start = 0x00; bool OF_VISIBILITY_HIDDEN _OFUnicodeToCodepage858(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/iso-8859-15.m from [21daaed653] to [25e41edd49].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFISO8859_15Table[] OF_VISIBILITY_HIDDEN = { 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; const size_t _OFISO8859_15TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFISO8859_15Table) / sizeof(*_OFISO8859_15Table)); static const unsigned char page0[] = { 0x00, 0xA5, 0x00, 0xA7, 0x00, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0x00, 0xB5, 0xB6, 0xB7, 0x00, 0xB9, 0xBA, 0xBB, 0x00, 0x00, 0x00 }; |
︙ | ︙ | |||
59 60 61 62 63 64 65 | static const uint8_t page1Start = 0x52; static const unsigned char page20[] = { 0xA4 }; static const uint8_t page20Start = 0xAC; | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | static const uint8_t page1Start = 0x52; static const unsigned char page20[] = { 0xA4 }; static const uint8_t page20Start = 0xAC; bool OF_VISIBILITY_HIDDEN _OFUnicodeToISO8859_15(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/iso-8859-2.m from [8986e3bb39] to [bd3f7dada7].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFISO8859_2Table[] OF_VISIBILITY_HIDDEN = { 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; const size_t _OFISO8859_2TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFISO8859_2Table) / sizeof(*_OFISO8859_2Table)); static const unsigned char page0[] = { 0xA0, 0x00, 0x00, 0x00, 0xA4, 0x00, 0x00, 0xA7, 0xA8, 0x00, 0x00, 0x00, 0x00, 0xAD, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0xC2, 0x00, 0xC4, 0x00, 0x00, 0xC7, |
︙ | ︙ | |||
79 80 81 82 83 84 85 | static const unsigned char page2[] = { 0xB7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0xFF, 0x00, 0xB2, 0x00, 0xBD }; static const uint8_t page2Start = 0xC7; | | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | static const unsigned char page2[] = { 0xB7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0xFF, 0x00, 0xB2, 0x00, 0xBD }; static const uint8_t page2Start = 0xC7; bool OF_VISIBILITY_HIDDEN _OFUnicodeToISO8859_2(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/iso-8859-3.m from [2126ec415a] to [bc9ab876ae].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFISO8859_3Table[] OF_VISIBILITY_HIDDEN = { 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFF, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFF, 0x017B, 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFF, 0x017C, 0x00C0, 0x00C1, 0x00C2, 0xFFFF, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0xFFFF, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0xFFFF, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0xFFFF, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 }; const size_t _OFISO8859_3TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFISO8859_3Table) / sizeof(*_OFISO8859_3Table)); static const unsigned char page0[] = { 0xA0, 0x00, 0x00, 0xA3, 0xA4, 0x00, 0x00, 0xA7, 0xA8, 0x00, 0x00, 0x00, 0x00, 0xAD, 0x00, 0x00, 0xB0, 0x00, 0xB2, 0xB3, 0xB4, 0xB5, 0x00, 0xB7, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x00, 0x00, 0xC0, 0xC1, 0xC2, 0x00, 0xC4, 0x00, 0x00, 0xC7, |
︙ | ︙ | |||
76 77 78 79 80 81 82 | static const uint8_t page1Start = 0x08; static const unsigned char page2[] = { 0xA2, 0xFF }; static const uint8_t page2Start = 0xD8; | | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | static const uint8_t page1Start = 0x08; static const unsigned char page2[] = { 0xA2, 0xFF }; static const uint8_t page2Start = 0xD8; bool OF_VISIBILITY_HIDDEN _OFUnicodeToISO8859_3(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/koi8-r.m from [2c4f09a0dd] to [7d684b26ac].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFKOI8RTable[] OF_VISIBILITY_HIDDEN = { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A }; const size_t _OFKOI8RTableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFKOI8RTable) / sizeof(*_OFKOI8RTable)); static const unsigned char page0[] = { 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
︙ | ︙ | |||
114 115 116 117 118 119 120 | 0x8D, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x8F, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94 }; static const uint8_t page25Start = 0x00; | | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | 0x8D, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x8F, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94 }; static const uint8_t page25Start = 0x00; bool OF_VISIBILITY_HIDDEN _OFUnicodeToKOI8R(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/koi8-u.m from [9252bda863] to [0f9ae48dcf].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFKOI8UTable[] OF_VISIBILITY_HIDDEN = { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, 0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A }; const size_t _OFKOI8UTableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFKOI8UTable) / sizeof(*_OFKOI8UTable)); static const unsigned char page0[] = { 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
︙ | ︙ | |||
122 123 124 125 126 127 128 | 0x8D, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x8F, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94 }; static const uint8_t page25Start = 0x00; | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 0x8D, 0x00, 0x00, 0x00, 0x8E, 0x00, 0x00, 0x00, 0x8F, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94 }; static const uint8_t page25Start = 0x00; bool OF_VISIBILITY_HIDDEN _OFUnicodeToKOI8U(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/mac-roman.m from [d6ebb30db7] to [48622afc6e].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFMacRomanTable[] OF_VISIBILITY_HIDDEN = { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7 }; const size_t _OFMacRomanTableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFMacRomanTable) / sizeof(*_OFMacRomanTable)); static const unsigned char page0[] = { 0xCA, 0xC1, 0xA2, 0xA3, 0x00, 0xB4, 0x00, 0xA4, 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8, 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1, 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0, 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, |
︙ | ︙ | |||
148 149 150 151 152 153 154 | static const uint8_t pageF8Start = 0xFF; static const unsigned char pageFB[] = { 0xDE, 0xDF }; static const uint8_t pageFBStart = 0x01; | | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | static const uint8_t pageF8Start = 0xFF; static const unsigned char pageFB[] = { 0xDE, 0xDF }; static const uint8_t pageFBStart = 0x01; bool OF_VISIBILITY_HIDDEN _OFUnicodeToMacRoman(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/windows-1251.m from [902244b996] to [fb08e37f56].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFWindows1251Table[] OF_VISIBILITY_HIDDEN = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F }; const size_t _OFWindows1251TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFWindows1251Table) / sizeof(*_OFWindows1251Table)); static const unsigned char page0[] = { 0xA0, 0x00, 0x00, 0x00, 0xA4, 0x00, 0xA6, 0xA7, 0x00, 0xA9, 0x00, 0xAB, 0xAC, 0xAD, 0xAE, 0x00, 0xB0, 0xB1, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0xB7, 0x00, 0x00, 0x00, 0xBB }; |
︙ | ︙ | |||
101 102 103 104 105 106 107 | static const unsigned char page21[] = { 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99 }; static const uint8_t page21Start = 0x16; | | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | static const unsigned char page21[] = { 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99 }; static const uint8_t page21Start = 0x16; bool OF_VISIBILITY_HIDDEN _OFUnicodeToWindows1251(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/encodings/windows-1252.m from [3f257f7d9d] to [1577a4fe9c].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFString.h" #import "common.h" | | | | | 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 50 51 52 | #include "config.h" #import "OFString.h" #import "common.h" const OFChar16 _OFWindows1252Table[] OF_VISIBILITY_HIDDEN = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFF, 0x017D, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFF, 0x017E, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; const size_t _OFWindows1252TableOffset OF_VISIBILITY_HIDDEN = 256 - (sizeof(_OFWindows1252Table) / sizeof(*_OFWindows1252Table)); static const unsigned char page0[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
︙ | ︙ | |||
97 98 99 100 101 102 103 | static const uint8_t page20Start = 0x13; static const unsigned char page21[] = { 0x99 }; static const uint8_t page21Start = 0x22; | | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | static const uint8_t page20Start = 0x13; static const unsigned char page21[] = { 0x99 }; static const uint8_t page21Start = 0x22; bool OF_VISIBILITY_HIDDEN _OFUnicodeToWindows1252(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; |
︙ | ︙ |
Modified src/exceptions/OFCreateWindowsRegistryKeyFailedException.m from [6808748419] to [cecd763f91].
︙ | ︙ | |||
80 81 82 83 84 85 86 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to create subkey at path %@: %@", | | | 80 81 82 83 84 85 86 87 88 89 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to create subkey at path %@: %@", _path, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFDNSQueryFailedException.h from [ba6bf4fd32] to [9442dc2216].
︙ | ︙ | |||
71 72 73 74 75 76 77 | - (instancetype)init OF_UNAVAILABLE; @end #ifdef __cplusplus extern "C" { #endif | | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - (instancetype)init OF_UNAVAILABLE; @end #ifdef __cplusplus extern "C" { #endif extern OFString *_OFDNSResolverErrorCodeDescription( OFDNSResolverErrorCode errorCode) OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/exceptions/OFDNSQueryFailedException.m from [cbd992d3b3] to [328c695472].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OFDNSQueryFailedException.h" #import "OFString.h" OFString * | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "config.h" #import "OFDNSQueryFailedException.h" #import "OFString.h" OFString * _OFDNSResolverErrorCodeDescription(OFDNSResolverErrorCode errorCode) { switch (errorCode) { case OFDNSResolverErrorCodeTimeout: return @"The query timed out."; case OFDNSResolverErrorCodeCanceled: return @"The query was canceled."; case OFDNSResolverErrorCodeNoResult: |
︙ | ︙ | |||
96 97 98 99 100 101 102 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"DNS query %@ could not be performed: %@", | | | 96 97 98 99 100 101 102 103 104 105 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"DNS query %@ could not be performed: %@", _query, _OFDNSResolverErrorCodeDescription(_errorCode)]; } @end |
Modified src/exceptions/OFDeleteWindowsRegistryKeyFailedException.m from [334a748840] to [fac0a7d3cf].
︙ | ︙ | |||
67 68 69 70 71 72 73 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to delete subkey at path %@: %@", | | | 67 68 69 70 71 72 73 74 75 76 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to delete subkey at path %@: %@", _subkeyPath, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFDeleteWindowsRegistryValueFailedException.m from [0e23fc3fee] to [af698f2bca].
︙ | ︙ | |||
67 68 69 70 71 72 73 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to delete value named %@: %@", | | | 67 68 69 70 71 72 73 74 75 76 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to delete value named %@: %@", _valueName, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFException.h from [b676d6c459] to [5970277a67].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFObject.h" #ifdef OF_WINDOWS # include <windows.h> #endif OF_ASSUME_NONNULL_BEGIN @class OFArray OF_GENERIC(ObjectType); @class OFString; @class OFValue; #define OFStackTraceSize 16 | > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFObject.h" #ifdef OF_WINDOWS # include <windows.h> #endif OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFArray OF_GENERIC(ObjectType); @class OFString; @class OFValue; #define OFStackTraceSize 16 |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 | */ - (nullable OFArray OF_GENERIC(OFString *) *)stackTraceSymbols; @end #ifdef __cplusplus extern "C" { #endif extern OFString *OFStrError(int errNo); #ifdef OF_WINDOWS | > > > > > > > > > > > > | | 190 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 | */ - (nullable OFArray OF_GENERIC(OFString *) *)stackTraceSymbols; @end #ifdef __cplusplus extern "C" { #endif /** * @brief Converts the specified error number (from `<errno.h>`) to a string. * * Unlike the system function `strerror`, this function is always thread-safe. * * As an addition, on Windows, it is also able to convert socket error numbers * to string. * * @param errNo The error number to convert to a string * @return A string describing the error */ extern OFString *OFStrError(int errNo); #ifdef OF_WINDOWS extern OFString *_OFWindowsStatusToString(LSTATUS status) OF_VISIBILITY_HIDDEN; #endif #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END |
Modified src/exceptions/OFException.m from [816a02d4da] to [33a4f03ee1].
︙ | ︙ | |||
212 213 214 215 216 217 218 | #endif return ret; } #ifdef OF_WINDOWS OFString * | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | #endif return ret; } #ifdef OF_WINDOWS OFString * _OFWindowsStatusToString(LSTATUS status) { OFString *string = nil; void *buffer; if ([OFSystemInfo isWindowsNT]) { if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | |
︙ | ︙ |
Modified src/exceptions/OFGetWindowsRegistryValueFailedException.m from [fb4c183eca] to [089a3beae1].
︙ | ︙ | |||
70 71 72 73 74 75 76 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to get value named %@: %@", | | | 70 71 72 73 74 75 76 77 78 79 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to get value named %@: %@", _valueName, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFOpenWindowsRegistryKeyFailedException.m from [3030425341] to [335390b890].
︙ | ︙ | |||
78 79 80 81 82 83 84 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to open subkey at path %@: %@", | | | 78 79 80 81 82 83 84 85 86 87 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to open subkey at path %@: %@", _path, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFResolveHostFailedException.m from [fe448762f6] to [0aa6b04b40].
︙ | ︙ | |||
71 72 73 74 75 76 77 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"The host %@ could not be resolved: %@", | | | 71 72 73 74 75 76 77 78 79 80 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"The host %@ could not be resolved: %@", _host, _OFDNSResolverErrorCodeDescription(_errorCode)]; } @end |
Modified src/exceptions/OFSetWindowsRegistryValueFailedException.m from [f10d7b695a] to [9d878c3278].
︙ | ︙ | |||
76 77 78 79 80 81 82 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to set value named %@ of type %u: %@", | | | 76 77 78 79 80 81 82 83 84 85 | [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to set value named %@ of type %u: %@", _valueName, _type, _OFWindowsStatusToString(_status)]; } @end |
Modified src/exceptions/OFTLSHandshakeFailedException.h from [6262e58801] to [6986a24c14].
︙ | ︙ | |||
26 27 28 29 30 31 32 | #import "OFTLSStream.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import "OFTLSStream.h" OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _OFTLSHandshakeFailedException_reference OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif /** * @class OFTLSHandshakeFailedException \ * OFTLSHandshakeFailedException.h ObjFW/OFTLSHandshakeFailedException.h |
︙ | ︙ |
Modified src/forwarding/forwarding-arm-elf.S from [6672c7d1bd] to [f6b2ed20ca].
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | mov r1, r4 bl objc_msg_lookup(PLT) mov r12, r0 ldr r0, [sp, #0] mov r1, r4 ldr r2, [sp, #4] blx r12 cmp r0, #0 beq 0f ldr r1, [sp, #0] cmp r0, r1 beq 0f | > > > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | mov r1, r4 bl objc_msg_lookup(PLT) mov r12, r0 ldr r0, [sp, #0] mov r1, r4 ldr r2, [sp, #4] #ifdef HAVE_BLX blx r12 #else mov lr, pc bx r12 #endif cmp r0, #0 beq 0f ldr r1, [sp, #0] cmp r0, r1 beq 0f |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | mov r1, r4 bl objc_msg_lookup(PLT) mov r12, r0 ldr r0, [sp, #4] mov r1, r4 ldr r2, [sp, #8] blx r12 cmp r0, #0 beq 0f ldr r1, [sp, #4] cmp r0, r1 beq 0f | > > > > > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | mov r1, r4 bl objc_msg_lookup(PLT) mov r12, r0 ldr r0, [sp, #4] mov r1, r4 ldr r2, [sp, #8] #ifdef HAVE_BLX blx r12 #else mov lr, pc bx r12 #endif cmp r0, #0 beq 0f ldr r1, [sp, #4] cmp r0, r1 beq 0f |
︙ | ︙ |
Modified src/forwarding/forwarding-mips-elf.S from [e0859d6585] to [49f4147ac2].
︙ | ︙ | |||
64 65 66 67 68 69 70 | sw $s1, 24($sp) sw $a0, 28($sp) sw $a1, 32($sp) sw $a2, 36($sp) sw $a3, 40($sp) #ifdef OF_MIPS_EABI | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | sw $s1, 24($sp) sw $a0, 28($sp) sw $a1, 32($sp) sw $a2, 36($sp) sw $a3, 40($sp) #ifdef OF_MIPS_EABI /* For some reason, $a4-$a7 are not always defined */ sw $8, 44($sp) sw $9, 48($sp) sw $10, 52($sp) sw $11, 56($sp) swc1 $f12, 60($sp) swc1 $f13, 64($sp) |
︙ | ︙ | |||
159 160 161 162 163 164 165 | lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 j_pic OFMethodNotFound .type OFForward, %function .size OFForward, .-OFForward OFForward_stret: #ifdef OF_PIC lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) |
︙ | ︙ | |||
285 286 287 288 289 290 291 | lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | lw $a0, 28($sp) lw $s1, 24($sp) lw $s0, 20($sp) lw $ra, 16($sp) addiu $sp, $sp, 96 j_pic OFMethodNotFound_stret .type OFForward_stret, %function .size OFForward_stret, .-OFForward_stret .Linit: #ifdef OF_PIC lui $gp, %hi(_gp_disp) addiu $gp, $gp, %lo(_gp_disp) |
︙ | ︙ |
Modified src/macros.h from [7e3d0a019b] to [cdc40153f2].
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include "platform.h" #ifdef OF_OBJFW_RUNTIME # ifdef OF_COMPILING_OBJFW # include "ObjFWRT.h" # else | > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> /** @file */ #include "platform.h" #ifdef OF_OBJFW_RUNTIME # ifdef OF_COMPILING_OBJFW # include "ObjFWRT.h" # else |
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # define OF_INLINE inline # define OF_LIKELY(cond) (cond) # define OF_UNLIKELY(cond) (cond) # define OF_CONST_FUNC # define OF_NO_RETURN_FUNC # define OF_WEAK_REF(sym) #endif #if __STDC_VERSION__ >= 201112L # define OF_ALIGN(size) _Alignas(size) # define OF_ALIGNOF(type) _Alignof(type) # define OF_ALIGNAS(type) _Alignas(type) #else # define OF_ALIGN(size) __attribute__((__aligned__(size))) | > > > > > > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | # define OF_INLINE inline # define OF_LIKELY(cond) (cond) # define OF_UNLIKELY(cond) (cond) # define OF_CONST_FUNC # define OF_NO_RETURN_FUNC # define OF_WEAK_REF(sym) #endif #ifndef OF_DJGPP # define OF_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden"))) #else # define OF_VISIBILITY_HIDDEN #endif #if __STDC_VERSION__ >= 201112L # define OF_ALIGN(size) _Alignas(size) # define OF_ALIGNOF(type) _Alignof(type) # define OF_ALIGNAS(type) _Alignas(type) #else # define OF_ALIGN(size) __attribute__((__aligned__(size))) |
︙ | ︙ | |||
465 466 467 468 469 470 471 | static void __attribute__((__constructor__(prio))) \ OF_PREPROCESSOR_CONCAT(constructor, __LINE__)(void) #define OF_DESTRUCTOR(prio) \ static void __attribute__((__destructor__(prio))) \ OF_PREPROCESSOR_CONCAT(destructor, __LINE__)(void) static OF_INLINE uint16_t OF_CONST_FUNC | | | | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | static void __attribute__((__constructor__(prio))) \ OF_PREPROCESSOR_CONCAT(constructor, __LINE__)(void) #define OF_DESTRUCTOR(prio) \ static void __attribute__((__destructor__(prio))) \ OF_PREPROCESSOR_CONCAT(destructor, __LINE__)(void) static OF_INLINE uint16_t OF_CONST_FUNC _OFByteSwap16Const(uint16_t i) { return (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; } static OF_INLINE uint32_t OF_CONST_FUNC _OFByteSwap32Const(uint32_t i) { return (i & UINT32_C(0xFF000000)) >> 24 | (i & UINT32_C(0x00FF0000)) >> 8 | (i & UINT32_C(0x0000FF00)) << 8 | (i & UINT32_C(0x000000FF)) << 24; } static OF_INLINE uint64_t OF_CONST_FUNC _OFByteSwap64Const(uint64_t i) { return (i & UINT64_C(0xFF00000000000000)) >> 56 | (i & UINT64_C(0x00FF000000000000)) >> 40 | (i & UINT64_C(0x0000FF0000000000)) >> 24 | (i & UINT64_C(0x000000FF00000000)) >> 8 | (i & UINT64_C(0x00000000FF000000)) << 8 | (i & UINT64_C(0x0000000000FF0000)) << 24 | (i & UINT64_C(0x000000000000FF00)) << 40 | (i & UINT64_C(0x00000000000000FF)) << 56; } static OF_INLINE uint16_t OF_CONST_FUNC _OFByteSwap16NonConst(uint16_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP16) return __builtin_bswap16(i); #elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) __asm__ ( "xchg{b} { %h0, %b0 | %b0, %h0 }" : "=Q" (i) |
︙ | ︙ | |||
524 525 526 527 528 529 530 | i = (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; #endif return i; } static OF_INLINE uint32_t OF_CONST_FUNC | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | i = (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; #endif return i; } static OF_INLINE uint32_t OF_CONST_FUNC _OFByteSwap32NonConst(uint32_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP32) return __builtin_bswap32(i); #elif (defined(OF_AMD64) || defined(OF_X86)) && defined(__GNUC__) __asm__ ( "bswap %0" : "=q" (i) |
︙ | ︙ | |||
557 558 559 560 561 562 563 | (i & UINT32_C(0x0000FF00)) << 8 | (i & UINT32_C(0x000000FF)) << 24; #endif return i; } static OF_INLINE uint64_t OF_CONST_FUNC | | | | | > > > > > > | > > > > > > > | > > > > > > > | | | | > > > > > > | | > > > > > > | | > > > > > > | | > > > > > > | | > > > > > > | > > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 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 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 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 849 850 851 852 853 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 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | (i & UINT32_C(0x0000FF00)) << 8 | (i & UINT32_C(0x000000FF)) << 24; #endif return i; } static OF_INLINE uint64_t OF_CONST_FUNC _OFByteSwap64NonConst(uint64_t i) { #if defined(OF_HAVE_BUILTIN_BSWAP64) return __builtin_bswap64(i); #elif defined(OF_AMD64) && defined(__GNUC__) __asm__ ( "bswap %0" : "=r" (i) : "0" (i) ); #elif defined(OF_X86) && defined(__GNUC__) __asm__ ( "bswap {%%}eax\n\t" "bswap {%%}edx\n\t" "xchg{l} { %%eax, %%edx | edx, eax }" : "=A" (i) : "0" (i) ); #else i = (uint64_t)_OFByteSwap32NonConst( (uint32_t)(i & UINT32_C(0xFFFFFFFF))) << 32 | _OFByteSwap32NonConst((uint32_t)(i >> 32)); #endif return i; } #if defined(__GNUC__) || defined(DOXYGEN) /** * @brief Byte swaps the specified 16 bit integer. * * @param i The integer to byte swap * @return The byte swapped integer */ # define OFByteSwap16(i) \ (__builtin_constant_p(i) ? _OFByteSwap16Const(i) : _OFByteSwap16NonConst(i)) /** * @brief Byte swaps the specified 32 bit integer. * * @param i The integer to byte swap * @return The byte swapped integer */ # define OFByteSwap32(i) \ (__builtin_constant_p(i) ? _OFByteSwap32Const(i) : _OFByteSwap32NonConst(i)) /** * @brief Byte swaps the specified 64 bit integer. * * @param i The integer to byte swap * @return The byte swapped integer */ # define OFByteSwap64(i) \ (__builtin_constant_p(i) ? _OFByteSwap64Const(i) : _OFByteSwap64NonConst(i)) #else # define OFByteSwap16(i) _OFByteSwap16Const(i) # define OFByteSwap32(i) _OFByteSwap32Const(i) # define OFByteSwap64(i) _OFByteSwap64Const(i) #endif /** * @brief Bit-converts the specified float to a uint32_t. * * @param f The float to bit-convert * @return The float bit-converted to a uint32_t */ static OF_INLINE uint32_t OF_CONST_FUNC OFBitConvertFloatToUInt32(float f) { uint32_t ret; memcpy(&ret, &f, 4); return ret; } /** * @brief Bit-converts the specified uint32_t to a float. * * @param uInt32 The uint32_t to bit-convert * @return The uint32_t bit-converted to a float */ static OF_INLINE float OF_CONST_FUNC OFBitConvertUInt32ToFloat(uint32_t uInt32) { float ret; memcpy(&ret, &uInt32, 4); return ret; } /** * @brief Bit-converts the specified double to a uint64_t. * * @param d The double to bit-convert * @return The double bit-converted to a uint64_t */ static OF_INLINE uint64_t OF_CONST_FUNC OFBitConvertDoubleToUInt64(double d) { uint64_t ret; memcpy(&ret, &d, 8); return ret; } /** * @brief Bit-converts the specified uint64_t to a double. * * @param uInt64 The uint64_t to bit-convert * @return The uint64_t bit-converted to a double */ static OF_INLINE double OF_CONST_FUNC OFBitConvertUInt64ToDouble(uint64_t uInt64) { double ret; memcpy(&ret, &uInt64, 8); return ret; } /** * @brief Byte swaps the specified float. * * @param f The float to byte swap * @return The byte swapped float */ static OF_INLINE float OF_CONST_FUNC OFByteSwapFloat(float f) { return OFBitConvertUInt32ToFloat(OFByteSwap32( OFBitConvertFloatToUInt32(f))); } /** * @brief Byte swaps the specified double. * * @param d The double to byte swap * @return The byte swapped double */ static OF_INLINE double OF_CONST_FUNC OFByteSwapDouble(double d) { return OFBitConvertUInt64ToDouble(OFByteSwap64( OFBitConvertDoubleToUInt64(d))); } #if defined(OF_BIG_ENDIAN) || defined(DOXYGEN) /** * @brief Converts the specified 16 bit integer from big endian to native * endian. * * @param i The 16 bit integer to convert * @return The 16 bit integer converted to native endian */ # define OFFromBigEndian16(i) (i) /** * @brief Converts the specified 32 bit integer from big endian to native * endian. * * @param i The 32 bit integer to convert * @return The 32 bit integer converted to native endian */ # define OFFromBigEndian32(i) (i) /** * @brief Converts the specified 64 bit integer from big endian to native * endian. * * @param i The 64 bit integer to convert * @return The 64 bit integer converted to native endian */ # define OFFromBigEndian64(i) (i) /** * @brief Converts the specified 16 bit integer from little endian to native * endian. * * @param i The 16 bit integer to convert * @return The 16 bit integer converted to native endian */ # define OFFromLittleEndian16(i) OFByteSwap16(i) /** * @brief Converts the specified 32 bit integer from little endian to native * endian. * * @param i The 32 bit integer to convert * @return The 32 bit integer converted to native endian */ # define OFFromLittleEndian32(i) OFByteSwap32(i) /** * @brief Converts the specified 64 bit integer from little endian to native * endian. * * @param i The 64 bit integer to convert * @return The 64 bit integer converted to native endian */ # define OFFromLittleEndian64(i) OFByteSwap64(i) /** * @brief Converts the specified 16 bit integer from native endian to big * endian. * * @param i The 16 bit integer to convert * @return The 16 bit integer converted to big endian */ # define OFToBigEndian16(i) (i) /** * @brief Converts the specified 32 bit integer from native endian to big * endian. * * @param i The 32 bit integer to convert * @return The 32 bit integer converted to big endian */ # define OFToBigEndian32(i) (i) /** * @brief Converts the specified 64 bit integer from native endian to big * endian. * * @param i The 64 bit integer to convert * @return The 64 bit integer converted to big endian */ # define OFToBigEndian64(i) (i) /** * @brief Converts the specified 16 bit integer from native endian to little * endian. * * @param i The 16 bit integer to convert * @return The 16 bit integer converted to little endian */ # define OFToLittleEndian16(i) OFByteSwap16(i) /** * @brief Converts the specified 32 bit integer from native endian to little * endian. * * @param i The 32 bit integer to convert * @return The 32 bit integer converted to little endian */ # define OFToLittleEndian32(i) OFByteSwap32(i) /** * @brief Converts the specified 64 bit integer from native endian to little * endian. * * @param i The 64 bit integer to convert * @return The 64 bit integer converted to little endian */ # define OFToLittleEndian64(i) OFByteSwap64(i) #else # define OFFromBigEndian16(i) OFByteSwap16(i) # define OFFromBigEndian32(i) OFByteSwap32(i) # define OFFromBigEndian64(i) OFByteSwap64(i) # define OFFromLittleEndian16(i) (i) # define OFFromLittleEndian32(i) (i) # define OFFromLittleEndian64(i) (i) # define OFToBigEndian16(i) OFByteSwap16(i) # define OFToBigEndian32(i) OFByteSwap32(i) # define OFToBigEndian64(i) OFByteSwap64(i) # define OFToLittleEndian16(i) (i) # define OFToLittleEndian32(i) (i) # define OFToLittleEndian64(i) (i) #endif #if defined(OF_FLOAT_BIG_ENDIAN) || defined(DOXYGEN) /** * @brief Converts the specified float from big endian to native endian. * * @param f The float to convert * @return The float converted to native endian */ # define OFFromBigEndianFloat(f) (f) /** * @brief Converts the specified double from big endian to native endian. * * @param d The double to convert * @return The double converted to native endian */ # define OFFromBigEndianDouble(d) (d) /** * @brief Converts the specified float from little endian to native endian. * * @param f The float to convert * @return The float converted to native endian */ # define OFFromLittleEndianFloat(f) OFByteSwapFloat(f) /** * @brief Converts the specified double from little endian to native endian. * * @param d The double to convert * @return The double converted to native endian */ # define OFFromLittleEndianDouble(d) OFByteSwapDouble(d) /** * @brief Converts the specified float from native endian to big endian. * * @param f The float to convert * @return The float converted to big endian */ # define OFToBigEndianFloat(f) (f) /** * @brief Converts the specified double from native endian to big endian. * * @param d The double to convert * @return The double converted to big endian */ # define OFToBigEndianDouble(d) (d) /** * @brief Converts the specified float from native endian to little endian. * * @param f The float to convert * @return The float converted to little endian */ # define OFToLittleEndianFloat(f) OFByteSwapFloat(f) /** * @brief Converts the specified double from native endian to little endian. * * @param d The double to convert * @return The double converted to little endian */ # define OFToLittleEndianDouble(d) OFByteSwapDouble(d) #else # define OFFromBigEndianFloat(f) OFByteSwapFloat(f) # define OFFromBigEndianDouble(d) OFByteSwapDouble(d) # define OFFromLittleEndianFloat(f) (f) # define OFFromLittleEndianDouble(d) (d) # define OFToBigEndianFloat(f) OFByteSwapFloat(f) # define OFToBigEndianDouble(d) OFByteSwapDouble(d) # define OFToLittleEndianFloat(f) (f) # define OFToLittleEndianDouble(d) (d) #endif /** * @brief Rotates the specified value left by the specified amount of bits. * * @param value The value to rotate * @param bits The number of bits to rotate left the value by * @return The value rotated left by the specified amount of bits */ #define OFRotateLeft(value, bits) \ (((bits) % (sizeof(value) * 8)) > 0 \ ? ((value) << ((bits) % (sizeof(value) * 8))) | \ ((value) >> (sizeof(value) * 8 - ((bits) % (sizeof(value) * 8)))) \ : (value)) /** * @brief Rotates the specified value right by the specified amount of bits. * * @param value The value to rotate * @param bits The number of bits to rotate right the value by * @return The value rotated right by the specified amount of bits */ #define OFRotateRight(value, bits) \ (((bits) % (sizeof(value) * 8)) > 0 \ ? ((value) >> ((bits) % (sizeof(value) * 8))) | \ ((value) << (sizeof(value) * 8 - ((bits) % (sizeof(value) * 8)))) \ : (value)) /** * @brief Rounds up the specified value to the specified power of two. * * @param pow2 The power of 2 to round up to * @param value The value to round up to the specified power of two * @return The specified value rounded up to the specified power of two */ #define OFRoundUpToPowerOf2(pow2, value) \ (((value) + (pow2) - 1) & ~((pow2) - 1)) static OF_INLINE bool OFBitsetIsSet(unsigned char *_Nonnull storage, size_t idx) { return storage[idx / CHAR_BIT] & (1u << (idx % CHAR_BIT)); |
︙ | ︙ |
Modified src/platform.h from [b44c54e58f] to [a058ae787f].
︙ | ︙ | |||
25 26 27 28 29 30 31 | # define OF_BIG_ENDIAN # define OF_FLOAT_BIG_ENDIAN # elif !__LITTLE_ENDIAN__ # error OF_UNIVERSAL defined, but neither __BIG_ENDIAN__ nor __LITTLE_ENDIAN__! # endif #endif | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # define OF_BIG_ENDIAN # define OF_FLOAT_BIG_ENDIAN # elif !__LITTLE_ENDIAN__ # error OF_UNIVERSAL defined, but neither __BIG_ENDIAN__ nor __LITTLE_ENDIAN__! # endif #endif #if (defined(__x86_64__) || defined(__amd64__)) && defined(__LP64__) # define OF_AMD64 #elif defined(__i386__) # define OF_X86 #elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) # define OF_POWERPC64 #elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) # define OF_POWERPC |
︙ | ︙ |
Modified src/platform/AmigaOS/OFPlainCondition.m from [c2df0315e9] to [264925273e].
︙ | ︙ | |||
87 88 89 90 91 92 93 | return OFPlainConditionWaitOrExecSignal(condition, mutex, &signalMask); } int OFPlainConditionWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, ULONG *signalMask) { | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | return OFPlainConditionWaitOrExecSignal(condition, mutex, &signalMask); } int OFPlainConditionWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, ULONG *signalMask) { struct _OFPlainConditionWaitingTask waitingTask = { .task = FindTask(NULL), .sigBit = AllocSignal(-1) }; int error = 0; ULONG mask; if (waitingTask.sigBit == -1) |
︙ | ︙ | |||
138 139 140 141 142 143 144 | &signalMask); } int OFPlainConditionTimedWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, OFTimeInterval timeout, ULONG *signalMask) { | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | &signalMask); } int OFPlainConditionTimedWaitOrExecSignal(OFPlainCondition *condition, OFPlainMutex *mutex, OFTimeInterval timeout, ULONG *signalMask) { struct _OFPlainConditionWaitingTask waitingTask = { .task = FindTask(NULL), .sigBit = AllocSignal(-1) }; struct MsgPort port = { .mp_Node = { .ln_Type = NT_MSGPORT }, |
︙ | ︙ |
Modified src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m from [d2c08c8ec3] to [0e4f3315ec].
︙ | ︙ | |||
244 245 246 247 248 249 250 | # endif } # endif [addresses addItem: &address]; next: | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | # endif } # endif [addresses addItem: &address]; next: # if defined(HAVE_STRUCT_SOCKADDR_SA_LEN) && !defined(OF_NETBSD) if (current->ifr_addr.sa_len > sizeof(struct sockaddr)) buffer += sizeof(struct ifreq) - sizeof(struct sockaddr) + current->ifr_addr.sa_len; else # endif buffer += sizeof(struct ifreq); |
︙ | ︙ |
Modified src/platform/Windows/OFWin32ConsoleStdIOStream.m from [ab386bcc83] to [e39c45536f].
︙ | ︙ | |||
176 177 178 179 180 181 182 | if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) { OFUnichar c = (((_incompleteUTF16Surrogate & 0x3FF) << 10) | (UTF16[0] & 0x3FF)) + 0x10000; char UTF8[4]; size_t UTF8Len; | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) { OFUnichar c = (((_incompleteUTF16Surrogate & 0x3FF) << 10) | (UTF16[0] & 0x3FF)) + 0x10000; char UTF8[4]; size_t UTF8Len; if ((UTF8Len = _OFUTF8StringEncode(c, UTF8)) == 0) @throw [OFInvalidEncodingException exception]; if (UTF8Len <= length) { memcpy(buffer, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) |
︙ | ︙ | |||
233 234 235 236 237 238 239 | c = (((c & 0x3FF) << 10) | (next & 0x3FF)) + 0x10000; i++; } | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | c = (((c & 0x3FF) << 10) | (next & 0x3FF)) + 0x10000; i++; } if ((UTF8Len = _OFUTF8StringEncode(c, UTF8)) == 0) @throw [OFInvalidEncodingException exception]; if (j + UTF8Len <= length) { memcpy(buffer + j, UTF8, UTF8Len); j += UTF8Len; } else { if (rest == nil) |
︙ | ︙ | |||
274 275 276 277 278 279 280 | if (_incompleteUTF8SurrogateLen > 0) { OFUnichar c; OFChar16 UTF16[2]; ssize_t UTF8Len; size_t toCopy; DWORD UTF16Len, bytesWritten; | | | | 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 | if (_incompleteUTF8SurrogateLen > 0) { OFUnichar c; OFChar16 UTF16[2]; ssize_t UTF8Len; size_t toCopy; DWORD UTF16Len, bytesWritten; UTF8Len = -_OFUTF8StringDecode( _incompleteUTF8Surrogate, _incompleteUTF8SurrogateLen, &c); OFEnsure(UTF8Len > 0); toCopy = UTF8Len - _incompleteUTF8SurrogateLen; if (toCopy > length) toCopy = length; memcpy(_incompleteUTF8Surrogate + _incompleteUTF8SurrogateLen, buffer, toCopy); _incompleteUTF8SurrogateLen += toCopy; if (_incompleteUTF8SurrogateLen < (size_t)UTF8Len) return 0; UTF8Len = _OFUTF8StringDecode( _incompleteUTF8Surrogate, _incompleteUTF8SurrogateLen, &c); if (UTF8Len <= 0 || c > 0x10FFFF) { OFAssert(UTF8Len == 0 || UTF8Len < -4); UTF16[0] = 0xFFFD; UTF16Len = 1; |
︙ | ︙ | |||
362 363 364 365 366 367 368 | @try { DWORD bytesWritten; while (i < length) { OFUnichar c; ssize_t UTF8Len; | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | @try { DWORD bytesWritten; while (i < length) { OFUnichar c; ssize_t UTF8Len; UTF8Len = _OFUTF8StringDecode(buffer + i, length - i, &c); if (UTF8Len < 0 && UTF8Len >= -4) { OFEnsure(length - i < 4); memcpy(_incompleteUTF8Surrogate, buffer + i, length - i); |
︙ | ︙ |
Modified src/runtime/OFOnce.m from [4cc1e7e57e] to [3ba988614c].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../OFOnce.m" | > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #import "OFOnce.h" extern void OFOnce(OFOnceControl *control, OFOnceFunction function) OF_VISIBILITY_HIDDEN; #include "../OFOnce.m" |
Modified src/runtime/OFPlainMutex.m from [bc6887b3cd] to [265bf1343a].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../OFPlainMutex.m" | > > > > > > > > > > > > > > > > > > | 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 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #import "OFPlainMutex.h" extern int OFPlainMutexNew(OFPlainMutex *mutex) OF_VISIBILITY_HIDDEN; extern int OFPlainMutexLock(OFPlainMutex *mutex) OF_VISIBILITY_HIDDEN; extern int OFPlainMutexTryLock(OFPlainMutex *mutex) OF_VISIBILITY_HIDDEN; extern int OFPlainMutexUnlock(OFPlainMutex *mutex) OF_VISIBILITY_HIDDEN; extern int OFPlainMutexFree(OFPlainMutex *mutex) OF_VISIBILITY_HIDDEN; extern int OFPlainRecursiveMutexNew(OFPlainRecursiveMutex *rmutex) OF_VISIBILITY_HIDDEN; extern int OFPlainRecursiveMutexLock(OFPlainRecursiveMutex *rmutex) OF_VISIBILITY_HIDDEN; extern int OFPlainRecursiveMutexTryLock(OFPlainRecursiveMutex *rmutex) OF_VISIBILITY_HIDDEN; extern int OFPlainRecursiveMutexUnlock(OFPlainRecursiveMutex *rmutex) OF_VISIBILITY_HIDDEN; extern int OFPlainRecursiveMutexFree(OFPlainRecursiveMutex *rmutex) OF_VISIBILITY_HIDDEN; #include "../OFPlainMutex.m" |
Modified src/runtime/OFTLSKey.m from [854846019d] to [18469a0b94].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #include "../OFTLSKey.m" | > > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 | */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #import "OFTLSKey.h" extern int OFTLSKeyNew(OFTLSKey *key) OF_VISIBILITY_HIDDEN; extern int OFTLSKeyFree(OFTLSKey key) OF_VISIBILITY_HIDDEN; #include "../OFTLSKey.m" |
Modified src/runtime/ObjFWRT.h from [94db01f911] to [9da771698a].
︙ | ︙ | |||
192 193 194 195 196 197 198 | /** @brief Associate the object like a copied property. */ OBJC_ASSOCIATION_COPY = OBJC_ASSOCIATION_COPY_NONATOMIC | 0x300 } objc_associationPolicy; #ifdef __cplusplus extern "C" { #endif | < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | /** @brief Associate the object like a copied property. */ OBJC_ASSOCIATION_COPY = OBJC_ASSOCIATION_COPY_NONATOMIC | 0x300 } objc_associationPolicy; #ifdef __cplusplus extern "C" { #endif /** * @brief Registers a selector with the specified name with the runtime. * * @param name The name for the selector to register * @return The registered selector */ extern SEL _Nonnull sel_registerName(const char *_Nonnull name); |
︙ | ︙ | |||
699 700 701 702 703 704 705 | /* * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ | | | | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | /* * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ struct _objc_module; extern void __objc_exec_class(struct _objc_module *_Nonnull module); extern IMP _Nonnull objc_msg_lookup(id _Nullable object, SEL _Nonnull selector); extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable object, SEL _Nonnull selector); extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull selector); extern IMP _Nonnull objc_msg_lookup_super_stret( struct objc_super *_Nonnull super, SEL _Nonnull selector); |
︙ | ︙ |
Modified src/runtime/init.m from [c3e6c635c2] to [e2ba2ca29c].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "ObjFWRT.h" #import "private.h" void | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "config.h" #import "ObjFWRT.h" #import "private.h" void __objc_exec_class(struct _objc_module *module) { objc_globalMutex_lock(); objc_registerAllSelectors(module->symtab); objc_registerAllClasses(module->symtab); objc_registerAllCategories(module->symtab); objc_initStaticInstances(module->symtab); |
︙ | ︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86-elf.S from [51eaca73d3] to [f683aade07].
︙ | ︙ | |||
93 94 95 96 97 98 99 100 | _CET_ENDBR movl 4(%esp), %edx movl (%edx), %eax testl %eax, %eax jz .LreturnNilMethod movl %eax, 4(%esp) | > > > > | | | > > > | 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 | _CET_ENDBR movl 4(%esp), %edx movl (%edx), %eax testl %eax, %eax jz .LreturnNilMethod subl $16, %esp movl %eax, (%esp) movl 24(%esp), %eax movl %eax, 4(%esp) movl 4(%edx), %edx movl 32(%edx), %edx call .Lmain_\lookup addl $16, %esp ret .type \name, %function .size \name, .-\name .endm GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound GENERATE_LOOKUP objc_msg_lookup_stret objc_methodNotFound_stret GENERATE_LOOKUP_SUPER objc_msg_lookup_super objc_msg_lookup |
︙ | ︙ |
Modified src/runtime/lookup-asm/lookup-asm-x86-win32.S from [60ea15786d] to [6a76ae6982].
︙ | ︙ | |||
79 80 81 82 83 84 85 | .macro GENERATE_LOOKUP_SUPER name lookup \name: _CET_ENDBR movl 4(%esp), %edx movl (%edx), %eax | | > > > > | > > > | 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 | .macro GENERATE_LOOKUP_SUPER name lookup \name: _CET_ENDBR movl 4(%esp), %edx movl (%edx), %eax testl %eax, %eax jz .LreturnNilMethod subl $16, %esp movl %eax, (%esp) movl 24(%esp), %eax movl %eax, 4(%esp) movl 4(%edx), %edx movl 32(%edx), %edx call .Lmain_\lookup addl $16, %esp ret .def \name .scl 2 .type 32 .endef .endm GENERATE_LOOKUP _objc_msg_lookup _objc_methodNotFound |
︙ | ︙ |
Modified src/runtime/private.h from [3b94bd139a] to [a33760f62e].
︙ | ︙ | |||
177 178 179 180 181 182 183 | unsigned long unknown; struct objc_selector *_Nullable selectorRefs; uint16_t classDefsCount; uint16_t categoryDefsCount; void *_Nonnull defs[1]; }; | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | unsigned long unknown; struct objc_selector *_Nullable selectorRefs; uint16_t classDefsCount; uint16_t categoryDefsCount; void *_Nonnull defs[1]; }; struct _objc_module { unsigned long version; /* 9 = non-fragile */ unsigned long size; const char *_Nullable name; struct objc_symtab *_Nonnull symtab; }; struct objc_hashtable_bucket { |
︙ | ︙ | |||
215 216 217 218 219 220 221 | } *_Nonnull buckets[256]; #else IMP _Nullable buckets[256]; #endif } *_Nonnull buckets[256]; }; | | > | | | | | > | > | | | | > | > | | | | | > | > | > | | > | | | > | | | | | | > | | | > | | | | > | | | 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 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 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 | } *_Nonnull buckets[256]; #else IMP _Nullable buckets[256]; #endif } *_Nonnull buckets[256]; }; extern void objc_registerAllCategories(struct objc_symtab *_Nonnull) OF_VISIBILITY_HIDDEN; extern struct objc_category *_Nullable *_Nullable objc_categoriesForClass(Class _Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_unregisterAllCategories(void) OF_VISIBILITY_HIDDEN; extern void objc_initializeClass(Class _Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_updateDTable(Class _Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_registerAllClasses(struct objc_symtab *_Nonnull) OF_VISIBILITY_HIDDEN; extern Class _Nullable objc_classnameToClass(const char *_Nonnull, bool) OF_VISIBILITY_HIDDEN; extern void objc_unregisterClass(Class _Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_unregisterAllClasses(void) OF_VISIBILITY_HIDDEN; extern uint32_t objc_string_hash(const void *_Nonnull) OF_VISIBILITY_HIDDEN; extern bool objc_string_equal(const void *_Nonnull, const void *_Nonnull) OF_VISIBILITY_HIDDEN; extern struct objc_hashtable *_Nonnull objc_hashtable_new( objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t) OF_VISIBILITY_HIDDEN; extern struct objc_hashtable_bucket objc_deletedBucket OF_VISIBILITY_HIDDEN; extern void objc_hashtable_set(struct objc_hashtable *_Nonnull, const void *_Nonnull, const void *_Nonnull) OF_VISIBILITY_HIDDEN; extern void *_Nullable objc_hashtable_get(struct objc_hashtable *_Nonnull, const void *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_hashtable_delete(struct objc_hashtable *_Nonnull, const void *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_hashtable_free(struct objc_hashtable *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_registerSelector(struct objc_selector *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_registerAllSelectors(struct objc_symtab *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_unregisterAllSelectors(void) OF_VISIBILITY_HIDDEN; extern struct objc_sparsearray *_Nonnull objc_sparsearray_new(uint8_t) OF_VISIBILITY_HIDDEN; extern void *_Nullable objc_sparsearray_get(struct objc_sparsearray *_Nonnull, uintptr_t) OF_VISIBILITY_HIDDEN; extern void objc_sparsearray_set(struct objc_sparsearray *_Nonnull, uintptr_t, void *_Nullable) OF_VISIBILITY_HIDDEN; extern void objc_sparsearray_free(struct objc_sparsearray *_Nonnull) OF_VISIBILITY_HIDDEN; extern struct objc_dtable *_Nonnull objc_dtable_new(void) OF_VISIBILITY_HIDDEN; extern void objc_dtable_copy(struct objc_dtable *_Nonnull, struct objc_dtable *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_dtable_set(struct objc_dtable *_Nonnull, uint32_t, IMP _Nullable) OF_VISIBILITY_HIDDEN; extern void objc_dtable_free(struct objc_dtable *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_dtable_cleanup(void) OF_VISIBILITY_HIDDEN; extern void objc_initStaticInstances(struct objc_symtab *_Nonnull) OF_VISIBILITY_HIDDEN; extern void objc_forgetPendingStaticInstances(void) OF_VISIBILITY_HIDDEN; extern void objc_zeroWeakReferences(id _Nonnull) OF_VISIBILITY_HIDDEN; extern Class _Nullable object_getTaggedPointerClass(id _Nonnull) OF_VISIBILITY_HIDDEN; #ifdef OF_HAVE_THREADS extern void objc_globalMutex_lock(void) OF_VISIBILITY_HIDDEN; extern void objc_globalMutex_unlock(void) OF_VISIBILITY_HIDDEN; extern void objc_globalMutex_free(void) OF_VISIBILITY_HIDDEN; #else # define objc_globalMutex_lock() # define objc_globalMutex_unlock() # define objc_globalMutex_free() #endif extern char *_Nullable objc_strdup(const char *_Nonnull string) OF_VISIBILITY_HIDDEN; static OF_INLINE IMP _Nullable objc_dtable_get(const struct objc_dtable *_Nonnull dtable, uint32_t idx) { #ifdef OF_SELUID24 uint8_t i = idx >> 16; uint8_t j = idx >> 8; uint8_t k = idx; return dtable->buckets[i]->buckets[j]->buckets[k]; #else uint8_t i = idx >> 8; uint8_t j = idx; return dtable->buckets[i]->buckets[j]; #endif } extern void OF_NO_RETURN_FUNC objc_error(const char *_Nonnull title, const char *_Nonnull format, ...) OF_VISIBILITY_HIDDEN; #define OBJC_ERROR(...) \ objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \ __VA_ARGS__) #if defined(OF_ELF) # if defined(OF_AMD64) || defined(OF_X86) || \ defined(OF_POWERPC64) || defined(OF_POWERPC) || \ |
︙ | ︙ |
Modified src/test/OTAssert.h from [8bd6d8696c] to [41f0812f71].
︙ | ︙ | |||
29 30 31 32 33 34 35 | * @brief Asserts that the specified condition condition holds. * * @param condition The condition to check * @param ... An optional format string to print if the assertion failed, * followed by optional arguments */ #define OTAssert(condition, ...) \ | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * @brief Asserts that the specified condition condition holds. * * @param condition The condition to check * @param ... An optional format string to print if the assertion failed, * followed by optional arguments */ #define OTAssert(condition, ...) \ _OTAssertImpl(self, _cmd, condition, @#condition, \ @__FILE__, __LINE__, ## __VA_ARGS__, nil) /** * @brief Asserts that the specified condition is true. * * @param condition The condition to check * @param ... An optional format string to print if the assertion failed, |
︙ | ︙ | |||
196 197 198 199 200 201 202 | /** * @brief Skips the current test, making it neither fail nor succeeed. * * @param ... An optional format string to print why the test was skipped, * followed by optional arguments */ #define OTSkip(...) \ | | | | | > | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /** * @brief Skips the current test, making it neither fail nor succeeed. * * @param ... An optional format string to print why the test was skipped, * followed by optional arguments */ #define OTSkip(...) \ _OTSkipImpl(self, _cmd, @__FILE__, __LINE__, ## __VA_ARGS__, nil) #ifdef __cplusplus extern "C" { #endif extern void _OTAssertImpl(id testCase, SEL test, bool condition, OFString *check, OFString *file, size_t line, ...); extern void _OTSkipImpl(id testCase, SEL test, OFString *file, size_t line, ...); #ifdef __cplusplus } #endif |
Modified src/test/OTAssert.m from [fa56e52ecc] to [8cdaeecf00].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFString.h" #import "OTAssertionFailedException.h" #import "OTTestSkippedException.h" void | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFString.h" #import "OTAssertionFailedException.h" #import "OTTestSkippedException.h" void _OTAssertImpl(id testCase, SEL test, bool condition, OFString *check, OFString *file, size_t line, ...) { va_list arguments; OFConstantString *format; OFString *message = nil; if (condition) |
︙ | ︙ | |||
46 47 48 49 50 51 52 | va_end(arguments); @throw [OTAssertionFailedException exceptionWithCondition: check message: message]; } void | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | va_end(arguments); @throw [OTAssertionFailedException exceptionWithCondition: check message: message]; } void _OTSkipImpl(id testCase, SEL test, OFString *file, size_t line, ...) { va_list arguments; OFConstantString *format; OFString *message = nil; va_start(arguments, line); format = va_arg(arguments, OFConstantString *); |
︙ | ︙ |
Modified src/unicode.h from [1b0487bb05] to [f81c1f2dbe].
︙ | ︙ | |||
15 16 17 18 19 20 21 | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #import "OFString.h" | | | | | | | | | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #import "OFString.h" #define _OFUnicodeUppercaseTableSize 0x1EA #define _OFUnicodeLowercaseTableSize 0x1EA #define _OFUnicodeTitlecaseTableSize 0x1EA #define _OFUnicodeCaseFoldingTableSize 0x1EA #ifdef __cplusplus extern "C" { #endif extern const OFUnichar *const _Nonnull _OFUnicodeUppercaseTable[_OFUnicodeUppercaseTableSize] OF_VISIBILITY_HIDDEN; extern const OFUnichar *const _Nonnull _OFUnicodeLowercaseTable[_OFUnicodeLowercaseTableSize] OF_VISIBILITY_HIDDEN; extern const OFUnichar *const _Nonnull _OFUnicodeTitlecaseTable[_OFUnicodeTitlecaseTableSize] OF_VISIBILITY_HIDDEN; extern const OFUnichar *const _Nonnull _OFUnicodeCaseFoldingTable[_OFUnicodeCaseFoldingTableSize] OF_VISIBILITY_HIDDEN; #ifdef __cplusplus } #endif |
Modified src/unicode.m from [f5c16fee83] to [31ef22e205].
︙ | ︙ | |||
15 16 17 18 19 20 21 | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * You should have received a copy of the GNU Lesser General Public License * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "unicode.h" static const OFUnichar emptyPage[0x100] = { 0 }; static const OFUnichar uppercasePage0[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
︙ | ︙ | |||
2119 2120 2121 2122 2123 2124 2125 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; | | | 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const OFUnichar *const _OFUnicodeUppercaseTable[0x1EA] = { uppercasePage0, uppercasePage1, uppercasePage2, uppercasePage3, uppercasePage4, uppercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage16, emptyPage, emptyPage, uppercasePage19, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, |
︙ | ︙ | |||
2245 2246 2247 2248 2249 2250 2251 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; | | | 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; const OFUnichar *const _OFUnicodeLowercaseTable[0x1EA] = { lowercasePage0, lowercasePage1, lowercasePage2, lowercasePage3, lowercasePage4, lowercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage16, emptyPage, emptyPage, lowercasePage19, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, |
︙ | ︙ | |||
2371 2372 2373 2374 2375 2376 2377 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage489 }; | | | 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage489 }; const OFUnichar *const _OFUnicodeTitlecaseTable[0x1EA] = { uppercasePage0, titlecasePage1, uppercasePage2, uppercasePage3, uppercasePage4, uppercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, titlecasePage16, emptyPage, emptyPage, uppercasePage19, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, |
︙ | ︙ | |||
2497 2498 2499 2500 2501 2502 2503 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; | | | 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 | emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; const OFUnichar *const _OFUnicodeCaseFoldingTable[0x1EA] = { caseFoldingPage0, caseFoldingPage1, lowercasePage2, caseFoldingPage3, lowercasePage4, lowercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage16, emptyPage, emptyPage, caseFoldingPage19, emptyPage, |
︙ | ︙ |
Modified tests/OFDateTests.m from [1b655b92f3] to [4495b273a8].
︙ | ︙ | |||
52 53 54 55 56 57 58 | - (void)testStrPTime { struct tm tm; int16_t timeZone; const char *dateString = "Wed, 09 Jun 2021 +0200x"; | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - (void)testStrPTime { struct tm tm; int16_t timeZone; const char *dateString = "Wed, 09 Jun 2021 +0200x"; OTAssertEqual(_OFStrPTime(dateString, "%a, %d %b %Y %z", &tm, &timeZone), dateString + 22); OTAssertEqual(tm.tm_wday, 3); OTAssertEqual(tm.tm_mday, 9); OTAssertEqual(tm.tm_mon, 5); OTAssertEqual(tm.tm_year, 2021 - 1900); OTAssertEqual(timeZone, 2 * 60); } |
︙ | ︙ |
Modified tests/OFFileManagerTests.m from [ff06e4c90e] to [08e4ea3058].
︙ | ︙ | |||
304 305 306 307 308 309 310 | IRIByAppendingPathComponent: @"source"]; OFIRI *destinationIRI = [_testsDirectoryIRI IRIByAppendingPathComponent: @"destination"]; OFFileAttributes attributes; [@"test" writeToIRI: sourceIRI]; | > > | | > > > | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | IRIByAppendingPathComponent: @"source"]; OFIRI *destinationIRI = [_testsDirectoryIRI IRIByAppendingPathComponent: @"destination"]; OFFileAttributes attributes; [@"test" writeToIRI: sourceIRI]; @try { [_fileManager linkItemAtPath: sourceIRI.fileSystemRepresentation toPath: destinationIRI.fileSystemRepresentation]; } @catch (OFNotImplementedException *e) { OTSkip(@"Links not supported"); } attributes = [_fileManager attributesOfItemAtIRI: destinationIRI]; OTAssertEqual(attributes.fileType, OFFileTypeRegular); OTAssertEqual(attributes.fileSize, 4); OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI], @"test"); } |
︙ | ︙ | |||
346 347 348 349 350 351 352 353 354 355 356 357 358 359 | } @catch (OFCreateSymbolicLinkFailedException *e) { if (e.errNo != EPERM) @throw e; OTSkip(@"No permission to create symlink.\n" @"On Windows, only the administrator can create symbolic " @"links."); } attributes = [_fileManager attributesOfItemAtIRI: destinationIRI]; OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink); OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI], @"test"); } | > > | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | } @catch (OFCreateSymbolicLinkFailedException *e) { if (e.errNo != EPERM) @throw e; OTSkip(@"No permission to create symlink.\n" @"On Windows, only the administrator can create symbolic " @"links."); } @catch (OFNotImplementedException *e) { OTSkip(@"Symlinks not supported"); } attributes = [_fileManager attributesOfItemAtIRI: destinationIRI]; OTAssertEqual(attributes.fileType, OFFileTypeSymbolicLink); OTAssertEqualObjects([OFString stringWithContentsOfIRI: destinationIRI], @"test"); } |
︙ | ︙ |
Modified tests/OFINIFileTests.m from [97d500cefe] to [80cce0e553].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFINIFileTests: OTTestCase { OFINIFile *_file; } @end | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" #import "OFEmbeddedIRIHandler.h" @interface OFINIFileTests: OTTestCase { OFINIFile *_file; } @end |
︙ | ︙ | |||
105 106 107 108 109 110 111 | OTAssertEqualObjects([types arrayValueForKey: @"array2"], array); OTAssertEqualObjects([types arrayValueForKey: @"array3"], [OFArray array]); } - (void)testWriteToIRIEncoding { | | > > > | > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | OTAssertEqualObjects([types arrayValueForKey: @"array2"], array); OTAssertEqualObjects([types arrayValueForKey: @"array3"], [OFArray array]); } - (void)testWriteToIRIEncoding { OFString *expectedOutput = @"; Comment in global category\r\n" @"global=yes\r\n" @"\r\n" @"[tests]\r\n" @"foo=baz\r\n" @"foobar=baz\r\n" @";comment\r\n" @"new=new\r\n" @"\r\n" @"[foobar]\r\n" @"#foobarcomment\r\n" @"qux=\" asd\"\r\n" @"quxquxqux=\"hello\\\"wörld\"\r\n" @"qux2=\"a\\f\"\r\n" @"\"asd=asd\"=foobar\r\n" @"qux3=a\fb\r\n" @"\r\n" @"[types]\r\n" @"integer=16\r\n" @"bool=false\r\n" @"float=0.25\r\n" @"array1=foo\r\n" |
︙ | ︙ |
Modified tests/OFScryptTests.m from [a6d12637a8] to [1df5c01194].
︙ | ︙ | |||
148 149 150 151 152 153 154 | @implementation OFScryptTests - (void)testSalsa20_8Core { uint32_t salsa20Buffer[16]; memcpy(salsa20Buffer, salsa20Input, 64); | | | | | 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 | @implementation OFScryptTests - (void)testSalsa20_8Core { uint32_t salsa20Buffer[16]; memcpy(salsa20Buffer, salsa20Input, 64); _OFSalsa20_8Core(salsa20Buffer); OTAssertEqual(memcmp(salsa20Buffer, salsa20Output, 64), 0); } - (void)testBlockMix { uint32_t blockMixBuffer[32]; _OFScryptBlockMix(blockMixBuffer, blockMixInput.u32, 1); OTAssertEqual(memcmp(blockMixBuffer, blockMixOutput, 128), 0); } - (void)testROMix { uint32_t ROMixBuffer[32], ROMixTmp[17 * 32]; memcpy(ROMixBuffer, ROMixInput, 128); _OFScryptROMix(ROMixBuffer, 1, 16, ROMixTmp); OTAssertEqual(memcmp(ROMixBuffer, ROMixOutput, 128), 0); } - (void)testRFC7941TestVector1 { unsigned char output[64]; |
︙ | ︙ |
Modified tests/OFStringTests.m from [46bc1e7497] to [4b858a36c1].
︙ | ︙ | |||
252 253 254 255 256 257 258 | encoding: OFStringEncodingISO8859_1], @"äöü"); } #ifdef HAVE_ISO_8859_15 - (void)testStringWithCStringEncodingISO8859_15 { OTAssertEqualObjects([self.stringClass | | | > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | encoding: OFStringEncodingISO8859_1], @"äöü"); } #ifdef HAVE_ISO_8859_15 - (void)testStringWithCStringEncodingISO8859_15 { OTAssertEqualObjects([self.stringClass stringWithCString: "a\x80\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE" encoding: OFStringEncodingISO8859_15], @"a\xC2\x80€ŠšŽžŒœŸ"); } #endif #ifdef HAVE_WINDOWS_1252 - (void)testStringWithCStringEncodingWindows1252 { OTAssertEqualObjects([self.stringClass |
︙ | ︙ |
Modified tests/plugin/TestPlugin.m from [08d2f004ac] to [4892884875].
︙ | ︙ | |||
17 18 19 20 21 22 23 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "TestPlugin.h" | < < < < < < < < < < < < < < < < < < < < | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "TestPlugin.h" @implementation TestPlugin - (int)test: (int)num { return num * 2; } @end |
︙ | ︙ |
Modified tests/subprocess/Subprocess.m from [75e4dad33e] to [f5dfed46e5].
︙ | ︙ | |||
32 33 34 35 36 37 38 | OFString *line; if (![[OFApplication arguments] isEqual: [OFArray arrayWithObjects: @"tést", @"123", nil]]) [OFApplication terminateWithStatus: 1]; if (![[[OFApplication environment] objectForKey: @"tëst"] | | | > > > > > > > > | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | OFString *line; if (![[OFApplication arguments] isEqual: [OFArray arrayWithObjects: @"tést", @"123", nil]]) [OFApplication terminateWithStatus: 1]; if (![[[OFApplication environment] objectForKey: @"tëst"] isEqual: @"yés"]) { [OFApplication terminateWithStatus: 2]; } #ifdef OF_WINDOWS /* On Windows 9x, closing the pipe doesn't seem to cause EOF. */ if (![OFSystemInfo isWindowsNT]) { if ((line = [OFStdIn readLine]) != nil) [OFStdOut writeLine: line.uppercaseString]; } else #endif while ((line = [OFStdIn readLine]) != nil) [OFStdOut writeLine: line.uppercaseString]; [OFApplication terminate]; } @end |
Modified tests/testfile.ini from [9e2ef2dc1a] to [f3a28cbc21].
1 2 3 4 5 6 | [tests] foo = bar foobar=baz ;comment [foobar] | > > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ; Comment in global category global=yes [tests] foo = bar foobar=baz ;comment [foobar] #foobarcomment qux=" asd" "quxqux " = asd quxquxqux="hello\"wörld" qux2="a\f" "asd=asd"=foobar [types] integer = 0x20 bool = true float = 0.5 array1 = 1 array2 = 1 |
︙ | ︙ |
Modified utils/ofarc/OFArc.m from [f2ee58a5d5] to [f0ee4f03f2].
︙ | ︙ | |||
478 479 480 481 482 483 484 | archive = [self openArchiveWithIRI: IRI type: type mode: mode encoding: encoding]; #ifdef OF_MACOS | > | | > | | | | | | > | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | archive = [self openArchiveWithIRI: IRI type: type mode: mode encoding: encoding]; #ifdef OF_MACOS if ([IRI.scheme isEqual: @"file"]) { @try { OFString *attributeName = @"com.apple.quarantine"; _quarantine = [[[OFFileManager defaultManager] extendedAttributeDataForName: attributeName ofItemAtIRI: IRI] retain]; } @catch (OFGetItemAttributesFailedException *e) { if (e.errNo != /*ENOATTR*/ 93) @throw e; } } #endif if (outputDir != nil) { OFFileManager *fileManager = [OFFileManager defaultManager]; |
︙ | ︙ |