Overview
Comment: | Move OFBigDataArray out to its own files |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
af7e24f9ab6c961fb3450a85e0455ef8 |
User & Date: | js on 2014-02-10 19:29:00 |
Other Links: | manifest | tags |
Context
2014-02-11
| ||
14:44 | OFHTTPServer: Allow binding to port 0 check-in: 1724525754 user: js tags: trunk | |
2014-02-10
| ||
19:29 | Move OFBigDataArray out to its own files check-in: af7e24f9ab user: js tags: trunk | |
19:13 | OFDataArray: Fix double release on error in init check-in: 01fb5e6be3 user: js tags: trunk | |
Changes
Modified ObjFW.xcodeproj/project.pbxproj from [2ab14c9d0d] to [1a04b935b8].
︙ | ︙ | |||
415 416 417 418 419 420 421 422 423 424 425 426 427 428 | 4BF33B0D133807A20059CEF7 /* OFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF0749512DFAFCA00A4ADD1 /* OFURLTests.m */; }; 4BF33B0E133807A20059CEF7 /* OFXMLElementBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67C1235358D0076B512 /* OFXMLElementBuilderTests.m */; }; 4BF33B10133807A20059CEF7 /* OFXMLParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67E1235358D0076B512 /* OFXMLParserTests.m */; }; 4BF33B11133807A20059CEF7 /* PropertiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67F1235358D0076B512 /* PropertiesTests.m */; }; 4BF33B12133807A20059CEF7 /* TestsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF6811235358D0076B512 /* TestsAppDelegate.m */; }; 4BF33B4713380CE20059CEF7 /* testfile.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4313380CD40059CEF7 /* testfile.txt */; }; 4BF33B4813380D2D0059CEF7 /* testfile.bin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4213380CD40059CEF7 /* testfile.bin */; }; 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 4B23CA8E133811B20047A1D9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; | > > | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | 4BF33B0D133807A20059CEF7 /* OFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF0749512DFAFCA00A4ADD1 /* OFURLTests.m */; }; 4BF33B0E133807A20059CEF7 /* OFXMLElementBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67C1235358D0076B512 /* OFXMLElementBuilderTests.m */; }; 4BF33B10133807A20059CEF7 /* OFXMLParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67E1235358D0076B512 /* OFXMLParserTests.m */; }; 4BF33B11133807A20059CEF7 /* PropertiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF67F1235358D0076B512 /* PropertiesTests.m */; }; 4BF33B12133807A20059CEF7 /* TestsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF6811235358D0076B512 /* TestsAppDelegate.m */; }; 4BF33B4713380CE20059CEF7 /* testfile.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4313380CD40059CEF7 /* testfile.txt */; }; 4BF33B4813380D2D0059CEF7 /* testfile.bin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4213380CD40059CEF7 /* testfile.bin */; }; 4BF48CE118A95F83000E8D04 /* OFBigDataArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BF48CE218A95F83000E8D04 /* OFBigDataArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */; }; 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 4B23CA8E133811B20047A1D9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; |
︙ | ︙ | |||
884 885 886 887 888 889 890 891 892 893 894 895 896 897 | 4BF1BCCC11C9663F0025511F /* OFString+XMLUnescaping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+XMLUnescaping.h"; path = "src/OFString+XMLUnescaping.h"; sourceTree = "<group>"; }; 4BF1BCCD11C9663F0025511F /* OFString+XMLUnescaping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+XMLUnescaping.m"; path = "src/OFString+XMLUnescaping.m"; sourceTree = "<group>"; }; 4BF1BCCE11C9663F0025511F /* OFXMLAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLAttribute.h; path = src/OFXMLAttribute.h; sourceTree = "<group>"; }; 4BF1BCCF11C9663F0025511F /* OFXMLAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLAttribute.m; path = src/OFXMLAttribute.m; sourceTree = "<group>"; }; 4BF33AF0133807310059CEF7 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF33B4213380CD40059CEF7 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = testfile.bin; path = tests/testfile.bin; sourceTree = "<group>"; }; 4BF33B4313380CD40059CEF7 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = testfile.txt; path = tests/testfile.txt; sourceTree = "<group>"; }; 4BFBDD1610A0724800051AFB /* unicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = unicode.m; path = src/unicode.m; sourceTree = "<group>"; }; 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveItemFailedException.h; path = src/exceptions/OFRemoveItemFailedException.h; sourceTree = "<group>"; }; 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveItemFailedException.m; path = src/exceptions/OFRemoveItemFailedException.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 4B187E0A163EA29F0049A832 /* Frameworks */ = { | > > | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | 4BF1BCCC11C9663F0025511F /* OFString+XMLUnescaping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+XMLUnescaping.h"; path = "src/OFString+XMLUnescaping.h"; sourceTree = "<group>"; }; 4BF1BCCD11C9663F0025511F /* OFString+XMLUnescaping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+XMLUnescaping.m"; path = "src/OFString+XMLUnescaping.m"; sourceTree = "<group>"; }; 4BF1BCCE11C9663F0025511F /* OFXMLAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLAttribute.h; path = src/OFXMLAttribute.h; sourceTree = "<group>"; }; 4BF1BCCF11C9663F0025511F /* OFXMLAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLAttribute.m; path = src/OFXMLAttribute.m; sourceTree = "<group>"; }; 4BF33AF0133807310059CEF7 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF33B4213380CD40059CEF7 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = testfile.bin; path = tests/testfile.bin; sourceTree = "<group>"; }; 4BF33B4313380CD40059CEF7 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = testfile.txt; path = tests/testfile.txt; sourceTree = "<group>"; }; 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFBigDataArray.h; path = src/OFBigDataArray.h; sourceTree = "<group>"; }; 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBigDataArray.m; path = src/OFBigDataArray.m; sourceTree = "<group>"; }; 4BFBDD1610A0724800051AFB /* unicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = unicode.m; path = src/unicode.m; sourceTree = "<group>"; }; 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveItemFailedException.h; path = src/exceptions/OFRemoveItemFailedException.h; sourceTree = "<group>"; }; 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveItemFailedException.m; path = src/exceptions/OFRemoveItemFailedException.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 4B187E0A163EA29F0049A832 /* Frameworks */ = { |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | 4B9BB7B9141CDE2D000AD1CC /* OFArray_adjacentSubarray.h */, 4B9BB7BA141CDE2D000AD1CC /* OFArray_adjacentSubarray.m */, 4B9BB7BB141CDE2D000AD1CC /* OFArray_subarray.h */, 4B9BB7BC141CDE2D000AD1CC /* OFArray_subarray.m */, 4B67995C1099E7C50041064A /* OFAutoreleasePool.h */, 4B67995D1099E7C50041064A /* OFAutoreleasePool.m */, 4B1473CA17E6391900B46BB8 /* OFAutoreleasePool+Private.h */, 4BD86D801237A6C600ED9912 /* OFBlock.h */, 4BD86D811237A6C600ED9912 /* OFBlock.m */, 4BAF5F46123460C900F4E111 /* OFCollection.h */, 4B6743F7163C395900EB1E59 /* OFCondition.h */, 4B6743F8163C395900EB1E59 /* OFCondition.m */, 4BE5F0D712DF4225005C7A0C /* OFConstantString.h */, 4BE5F0D812DF4225005C7A0C /* OFConstantString.m */, | > > | 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | 4B9BB7B9141CDE2D000AD1CC /* OFArray_adjacentSubarray.h */, 4B9BB7BA141CDE2D000AD1CC /* OFArray_adjacentSubarray.m */, 4B9BB7BB141CDE2D000AD1CC /* OFArray_subarray.h */, 4B9BB7BC141CDE2D000AD1CC /* OFArray_subarray.m */, 4B67995C1099E7C50041064A /* OFAutoreleasePool.h */, 4B67995D1099E7C50041064A /* OFAutoreleasePool.m */, 4B1473CA17E6391900B46BB8 /* OFAutoreleasePool+Private.h */, 4BF48CDF18A95F83000E8D04 /* OFBigDataArray.h */, 4BF48CE018A95F83000E8D04 /* OFBigDataArray.m */, 4BD86D801237A6C600ED9912 /* OFBlock.h */, 4BD86D811237A6C600ED9912 /* OFBlock.m */, 4BAF5F46123460C900F4E111 /* OFCollection.h */, 4B6743F7163C395900EB1E59 /* OFCondition.h */, 4B6743F8163C395900EB1E59 /* OFCondition.m */, 4BE5F0D712DF4225005C7A0C /* OFConstantString.h */, 4BE5F0D812DF4225005C7A0C /* OFConstantString.m */, |
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 4B3D23BC1337FC8300DD29B8 /* OFApplication.h in Headers */, 4B3D23BD1337FC8300DD29B8 /* OFArray.h in Headers */, 4B9BB7BF141CDE2D000AD1CC /* OFArray_subarray.h in Headers */, 4B3D23BE1337FC8300DD29B8 /* OFAutoreleasePool.h in Headers */, 4B3D23BF1337FC8300DD29B8 /* OFBlock.h in Headers */, 4B3D23C01337FC8300DD29B8 /* OFCollection.h in Headers */, 4B674400163C395900EB1E59 /* OFCondition.h in Headers */, 4B3D23C11337FC8300DD29B8 /* OFConstantString.h in Headers */, 4B45355313DCFE1E0037AB4D /* OFCountedSet.h in Headers */, 4B3D23C21337FC8300DD29B8 /* OFDataArray.h in Headers */, 4B3D23C31337FC8300DD29B8 /* OFDataArray+Hashing.h in Headers */, | > | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 4B3D23BC1337FC8300DD29B8 /* OFApplication.h in Headers */, 4B3D23BD1337FC8300DD29B8 /* OFArray.h in Headers */, 4B9BB7BF141CDE2D000AD1CC /* OFArray_subarray.h in Headers */, 4B3D23BE1337FC8300DD29B8 /* OFAutoreleasePool.h in Headers */, 4BF48CE118A95F83000E8D04 /* OFBigDataArray.h in Headers */, 4B3D23BF1337FC8300DD29B8 /* OFBlock.h in Headers */, 4B3D23C01337FC8300DD29B8 /* OFCollection.h in Headers */, 4B674400163C395900EB1E59 /* OFCondition.h in Headers */, 4B3D23C11337FC8300DD29B8 /* OFConstantString.h in Headers */, 4B45355313DCFE1E0037AB4D /* OFCountedSet.h in Headers */, 4B3D23C21337FC8300DD29B8 /* OFDataArray.h in Headers */, 4B3D23C31337FC8300DD29B8 /* OFDataArray+Hashing.h in Headers */, |
︙ | ︙ | |||
1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | files = ( 4B3D238B1337FC0D00DD29B8 /* OFApplication.m in Sources */, 4B3D238C1337FC0D00DD29B8 /* OFArray.m in Sources */, 4B2B3E7E140D430500EC2F7C /* OFArray_adjacent.m in Sources */, 4B9BB7BE141CDE2D000AD1CC /* OFArray_adjacentSubarray.m in Sources */, 4B9BB7C0141CDE2D000AD1CC /* OFArray_subarray.m in Sources */, 4B3D238D1337FC0D00DD29B8 /* OFAutoreleasePool.m in Sources */, 4B3D238E1337FC0D00DD29B8 /* OFBlock.m in Sources */, 4B674401163C395900EB1E59 /* OFCondition.m in Sources */, 4B3D238F1337FC0D00DD29B8 /* OFConstantString.m in Sources */, 4B45355413DCFE1E0037AB4D /* OFCountedSet.m in Sources */, 4BA85BCB140ECCE800E91D51 /* OFCountedSet_hashtable.m in Sources */, 4B3D23901337FC0D00DD29B8 /* OFDataArray.m in Sources */, 4B3D23911337FC0D00DD29B8 /* OFDataArray+Hashing.m in Sources */, | > | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | files = ( 4B3D238B1337FC0D00DD29B8 /* OFApplication.m in Sources */, 4B3D238C1337FC0D00DD29B8 /* OFArray.m in Sources */, 4B2B3E7E140D430500EC2F7C /* OFArray_adjacent.m in Sources */, 4B9BB7BE141CDE2D000AD1CC /* OFArray_adjacentSubarray.m in Sources */, 4B9BB7C0141CDE2D000AD1CC /* OFArray_subarray.m in Sources */, 4B3D238D1337FC0D00DD29B8 /* OFAutoreleasePool.m in Sources */, 4BF48CE218A95F83000E8D04 /* OFBigDataArray.m in Sources */, 4B3D238E1337FC0D00DD29B8 /* OFBlock.m in Sources */, 4B674401163C395900EB1E59 /* OFCondition.m in Sources */, 4B3D238F1337FC0D00DD29B8 /* OFConstantString.m in Sources */, 4B45355413DCFE1E0037AB4D /* OFCountedSet.m in Sources */, 4BA85BCB140ECCE800E91D51 /* OFCountedSet_hashtable.m in Sources */, 4B3D23901337FC0D00DD29B8 /* OFDataArray.m in Sources */, 4B3D23911337FC0D00DD29B8 /* OFDataArray+Hashing.m in Sources */, |
︙ | ︙ |
Modified src/Makefile from [9bf87537a2] to [53f68f35d0].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} SRCS = OFApplication.m \ OFArray.m \ OFArray_subarray.m \ OFAutoreleasePool.m \ OFBlock.m \ OFConstantString.m \ OFCountedSet.m \ OFDataArray.m \ OFDataArray+Hashing.m \ OFDataArray+MessagePackValue.m \ OFDate.m \ | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} SRCS = OFApplication.m \ OFArray.m \ OFArray_subarray.m \ OFAutoreleasePool.m \ OFBigDataArray.m \ OFBlock.m \ OFConstantString.m \ OFCountedSet.m \ OFDataArray.m \ OFDataArray+Hashing.m \ OFDataArray+MessagePackValue.m \ OFDate.m \ |
︙ | ︙ |
Added src/OFBigDataArray.h version [1e1174c0de].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFDataArray.h" /*! * @brief A class for storing arbitrary big data in an array. * * The OFBigDataArray class is a class for storing arbitrary data in an array * and is designed to store large hunks of data. Therefore, it allocates * memory in pages rather than a chunk of memory for each item. */ @interface OFBigDataArray: OFDataArray { size_t _size; } @end |
Added src/OFBigDataArray.m version [b4d602f2c6].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "OFBigDataArray.h" #import "OFSystemInfo.h" #import "OFInvalidArgumentException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" @implementation OFBigDataArray - init { return [self initWithItemSize: 1 capacity: 0]; } - initWithItemSize: (size_t)itemSize { return [self initWithItemSize: itemSize capacity: 0]; } - initWithItemSize: (size_t)itemSize capacity: (size_t)capacity { self = [super init]; @try { size_t size, lastPageByte; if (itemSize == 0) @throw [OFInvalidArgumentException exception]; if (capacity > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; lastPageByte = [OFSystemInfo pageSize] - 1; size = (capacity * itemSize + lastPageByte) & ~lastPageByte; if (size == 0) size = lastPageByte + 1; _items = [self allocMemoryWithSize: size]; _itemSize = itemSize; _capacity = size / itemSize; _size = size; } @catch (id e) { [self release]; @throw e; } return self; } - (void)addItem: (const void*)item { if (SIZE_MAX - _count < 1 || _count + 1 > SIZE_MAX / _itemSize) @throw [OFOutOfRangeException exception]; if (_count + 1 > _capacity) { size_t size, lastPageByte; lastPageByte = [OFSystemInfo pageSize] - 1; size = ((_count + 1) * _itemSize + lastPageByte) & ~lastPageByte; _items = [self resizeMemory: _items size: size]; _capacity = size / _itemSize; _size = size; } memcpy(_items + _count * _itemSize, item, _itemSize); _count++; } - (void)addItems: (const void*)items count: (size_t)count { if (count > SIZE_MAX - _count || _count + count > SIZE_MAX / _itemSize) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { size_t size, lastPageByte; lastPageByte = [OFSystemInfo pageSize] - 1; size = ((_count + count) * _itemSize + lastPageByte) & ~lastPageByte; _items = [self resizeMemory: _items size: size]; _capacity = size / _itemSize; _size = size; } memcpy(_items + _count * _itemSize, items, count * _itemSize); _count += count; } - (void)insertItems: (const void*)items atIndex: (size_t)index count: (size_t)count { if (count > SIZE_MAX - _count || index > _count || _count + count > SIZE_MAX / _itemSize) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { size_t size, lastPageByte; lastPageByte = [OFSystemInfo pageSize] - 1; size = ((_count + count) * _itemSize + lastPageByte) & ~lastPageByte; _items = [self resizeMemory: _items size: size]; _capacity = size / _itemSize; _size = size; } memmove(_items + (index + count) * _itemSize, _items + index * _itemSize, (_count - index) * _itemSize); memcpy(_items + index * _itemSize, items, count * _itemSize); _count += count; } - (void)removeItemsInRange: (of_range_t)range { size_t lastPageByte, size; if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; memmove(_items + range.location * _itemSize, _items + (range.location + range.length) * _itemSize, (_count - range.location - range.length) * _itemSize); _count -= range.length; lastPageByte = [OFSystemInfo pageSize] - 1; size = (_count * _itemSize + lastPageByte) & ~lastPageByte; if (_size != size && size > lastPageByte) { @try { _items = [self resizeMemory: _items size: size]; _capacity = size / _itemSize; _size = size; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } } - (void)removeLastItem { size_t lastPageByte, size; if (_count == 0) return; _count--; lastPageByte = [OFSystemInfo pageSize] - 1; size = (_count * _itemSize + lastPageByte) & ~lastPageByte; if (_size != size && size > lastPageByte) { @try { _items = [self resizeMemory: _items size: size]; _capacity = size / _itemSize; _size = size; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } } - (void)removeAllItems { size_t pageSize = [OFSystemInfo pageSize]; @try { _items = [self resizeMemory: _items size: pageSize]; _capacity = pageSize / _itemSize; _size = pageSize; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } _count = 0; } @end |
Modified src/OFDataArray.h from [0fb78fb942] to [2af3ef13d9].
︙ | ︙ | |||
314 315 316 317 318 319 320 | /*! * @brief Writes the OFDataArray into the specified file. * * @param path The path of the file to write to */ - (void)writeToFile: (OFString*)path; #endif | < < < < < < < < < < < < < | 314 315 316 317 318 319 320 321 322 323 324 | /*! * @brief Writes the OFDataArray into the specified file. * * @param path The path of the file to write to */ - (void)writeToFile: (OFString*)path; #endif @end #import "OFDataArray+Hashing.h" #import "OFDataArray+MessagePackValue.h" |
Modified src/OFDataArray.m from [d6f7fc5fb8] to [4b9ac6b409].
︙ | ︙ | |||
683 684 685 686 687 688 689 690 | @throw [OFOutOfRangeException exception]; [data addItems: _items count: _count]; return data; } @end | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 683 684 685 686 687 688 689 690 | @throw [OFOutOfRangeException exception]; [data addItems: _items count: _count]; return data; } @end |
Modified src/OFXMLParser.m from [d85afd1c0b] to [e7da32bd09].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include <sys/types.h> #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <sys/types.h> #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFBigDataArray.h" #import "OFXMLAttribute.h" #import "OFStream.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFSystemInfo.h" |
︙ | ︙ |
Modified tests/OFDataArrayTests.m from [7b8b59ade2] to [58dc587a13].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | */ #include "config.h" #include <string.h> #import "OFDataArray.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFOutOfRangeException.h" #import "macros.h" | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | */ #include "config.h" #include <string.h> #import "OFDataArray.h" #import "OFBigDataArray.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFOutOfRangeException.h" #import "macros.h" |
︙ | ︙ |