ObjFW  Check-in [3f34a360bf]

Overview
Comment:Add OFMutableTarArchiveEntry

This is in preparation for OFTarArchive write support.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3f34a360bf814fdc91d1c1886f99e98a770175263afbb919301f97eea479d221
User & Date: js on 2017-08-05 12:27:30
Other Links: manifest | tags
Context
2017-08-05
15:22
OFTarArchive: Add write and append support check-in: 0c5035dd3f user: js tags: trunk
12:27
Add OFMutableTarArchiveEntry check-in: 3f34a360bf user: js tags: trunk
11:15
Add OFMutableZIPArchiveEntry check-in: 1aea73d8b1 user: js tags: trunk
Changes

Modified ObjFW.xcodeproj/project.pbxproj from [3f9c0253db] to [1958429fe9].

877
878
879
880
881
882
883




884
885
886
887
888
889
890
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894







+
+
+
+







		4BA355BA14879BDD00442EF4 /* of_strptime.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA355B914879BDD00442EF4 /* of_strptime.m */; };
		4BA355BD14879BF700442EF4 /* of_strptime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA355BC14879BF700442EF4 /* of_strptime.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BA4846215CC9F1E00D75360 /* OFUnsupportedVersionException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA4846015CC9F1E00D75360 /* OFUnsupportedVersionException.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BA4846315CC9F1E00D75360 /* OFUnsupportedVersionException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA4846115CC9F1E00D75360 /* OFUnsupportedVersionException.m */; };
		4BA4846615CC9FAD00D75360 /* ForwardingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA4846515CC9FAD00D75360 /* ForwardingTests.m */; };
		4BA49D9013DB113B00381CDB /* OFIntrospection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA49D8E13DB113B00381CDB /* OFIntrospection.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BA49D9113DB113B00381CDB /* OFIntrospection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA49D8F13DB113B00381CDB /* OFIntrospection.m */; };
		4BA842E61F35E53800292FC6 /* OFMutableTarArchiveEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA842E41F35E53800292FC6 /* OFMutableTarArchiveEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BA842E71F35E53800292FC6 /* OFMutableTarArchiveEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA842E41F35E53800292FC6 /* OFMutableTarArchiveEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };
		4BA842E81F35E53800292FC6 /* OFMutableTarArchiveEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA842E51F35E53800292FC6 /* OFMutableTarArchiveEntry.m */; };
		4BA842E91F35E53800292FC6 /* OFMutableTarArchiveEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA842E51F35E53800292FC6 /* OFMutableTarArchiveEntry.m */; };
		4BA85BCA140ECCE800E91D51 /* OFCountedSet_hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA85BC4140ECCE800E91D51 /* OFCountedSet_hashtable.h */; };
		4BA85BCB140ECCE800E91D51 /* OFCountedSet_hashtable.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA85BC5140ECCE800E91D51 /* OFCountedSet_hashtable.m */; };
		4BA85BCC140ECCE800E91D51 /* OFMutableSet_hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA85BC6140ECCE800E91D51 /* OFMutableSet_hashtable.h */; };
		4BA85BCD140ECCE800E91D51 /* OFMutableSet_hashtable.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA85BC7140ECCE800E91D51 /* OFMutableSet_hashtable.m */; };
		4BA85BCE140ECCE800E91D51 /* OFSet_hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA85BC8140ECCE800E91D51 /* OFSet_hashtable.h */; };
		4BA85BCF140ECCE800E91D51 /* OFSet_hashtable.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA85BC9140ECCE800E91D51 /* OFSet_hashtable.m */; };
		4BA9CFA415E129D30076DC74 /* autorelease.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA9CFA315E129D30076DC74 /* autorelease.h */; settings = {ATTRIBUTES = (Public, ); }; };
1562
1563
1564
1565
1566
1567
1568


1569
1570
1571
1572
1573
1574
1575
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581







+
+







		4BA355B914879BDD00442EF4 /* of_strptime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = of_strptime.m; path = src/of_strptime.m; sourceTree = "<group>"; };
		4BA355BC14879BF700442EF4 /* of_strptime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = of_strptime.h; path = src/of_strptime.h; sourceTree = "<group>"; };
		4BA4846015CC9F1E00D75360 /* OFUnsupportedVersionException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFUnsupportedVersionException.h; path = src/exceptions/OFUnsupportedVersionException.h; sourceTree = "<group>"; };
		4BA4846115CC9F1E00D75360 /* OFUnsupportedVersionException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFUnsupportedVersionException.m; path = src/exceptions/OFUnsupportedVersionException.m; sourceTree = "<group>"; };
		4BA4846515CC9FAD00D75360 /* ForwardingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ForwardingTests.m; path = tests/ForwardingTests.m; sourceTree = "<group>"; };
		4BA49D8E13DB113B00381CDB /* OFIntrospection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFIntrospection.h; path = src/OFIntrospection.h; sourceTree = "<group>"; };
		4BA49D8F13DB113B00381CDB /* OFIntrospection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFIntrospection.m; path = src/OFIntrospection.m; sourceTree = "<group>"; };
		4BA842E41F35E53800292FC6 /* OFMutableTarArchiveEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMutableTarArchiveEntry.h; path = src/OFMutableTarArchiveEntry.h; sourceTree = "<group>"; };
		4BA842E51F35E53800292FC6 /* OFMutableTarArchiveEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMutableTarArchiveEntry.m; path = src/OFMutableTarArchiveEntry.m; sourceTree = "<group>"; };
		4BA85BC4140ECCE800E91D51 /* OFCountedSet_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFCountedSet_hashtable.h; path = src/OFCountedSet_hashtable.h; sourceTree = "<group>"; };
		4BA85BC5140ECCE800E91D51 /* OFCountedSet_hashtable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFCountedSet_hashtable.m; path = src/OFCountedSet_hashtable.m; sourceTree = "<group>"; };
		4BA85BC6140ECCE800E91D51 /* OFMutableSet_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMutableSet_hashtable.h; path = src/OFMutableSet_hashtable.h; sourceTree = "<group>"; };
		4BA85BC7140ECCE800E91D51 /* OFMutableSet_hashtable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMutableSet_hashtable.m; path = src/OFMutableSet_hashtable.m; sourceTree = "<group>"; };
		4BA85BC8140ECCE800E91D51 /* OFSet_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFSet_hashtable.h; path = src/OFSet_hashtable.h; sourceTree = "<group>"; };
		4BA85BC9140ECCE800E91D51 /* OFSet_hashtable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFSet_hashtable.m; path = src/OFSet_hashtable.m; sourceTree = "<group>"; };
		4BA9CFA315E129D30076DC74 /* autorelease.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = autorelease.h; path = src/autorelease.h; sourceTree = "<group>"; };
2117
2118
2119
2120
2121
2122
2123


2124
2125
2126
2127
2128
2129
2130
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138







+
+







				4B39844613D3AFB400E6F825 /* OFMutableSet.m */,
				4BA85BC6140ECCE800E91D51 /* OFMutableSet_hashtable.h */,
				4BA85BC7140ECCE800E91D51 /* OFMutableSet_hashtable.m */,
				4B6799731099E7C50041064A /* OFMutableString.h */,
				4B6799741099E7C50041064A /* OFMutableString.m */,
				4B55254E147AA5DB0003BF47 /* OFMutableString_UTF8.h */,
				4B55254F147AA5DB0003BF47 /* OFMutableString_UTF8.m */,
				4BA842E41F35E53800292FC6 /* OFMutableTarArchiveEntry.h */,
				4BA842E51F35E53800292FC6 /* OFMutableTarArchiveEntry.m */,
				4B4116CD1F21654200E78916 /* OFMutableURL.h */,
				4B4116CE1F21654200E78916 /* OFMutableURL.m */,
				4B92FDDC1F35DFAC000D541D /* OFMutableZIPArchiveEntry.h */,
				4B92FDDD1F35DFAC000D541D /* OFMutableZIPArchiveEntry.m */,
				4B6743FA163C395900EB1E59 /* OFMutex.h */,
				4B6743FB163C395900EB1E59 /* OFMutex.m */,
				4B511B7A139C0A34003764A5 /* OFNull.h */,
2482
2483
2484
2485
2486
2487
2488

2489
2490
2491
2492
2493
2494
2495
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504







+







				4B2C21FE1DA292BE00735907 /* OFMessagePackExtension.h in Headers */,
				4B2C21FF1DA292BE00735907 /* OFMessagePackRepresentation.h in Headers */,
				4B2C22001DA292BE00735907 /* OFMutableArray.h in Headers */,
				4B1223181F23E6C100D9F8FF /* OFMutableData.h in Headers */,
				4B2C22011DA292BE00735907 /* OFMutableDictionary.h in Headers */,
				4B2C22021DA292BE00735907 /* OFMutableSet.h in Headers */,
				4B2C22031DA292BE00735907 /* OFMutableString.h in Headers */,
				4BA842E71F35E53800292FC6 /* OFMutableTarArchiveEntry.h in Headers */,
				4B4116D11F21654200E78916 /* OFMutableURL.h in Headers */,
				4B92FDE01F35DFB5000D541D /* OFMutableZIPArchiveEntry.h in Headers */,
				4B2C22041DA292BE00735907 /* OFMutex.h in Headers */,
				4B2C22051DA292BE00735907 /* OFNull.h in Headers */,
				4B2C22061DA292BE00735907 /* OFNumber.h in Headers */,
				4B2C22071DA292BE00735907 /* OFObject.h in Headers */,
				4B2C22081DA292BE00735907 /* OFObject+KeyValueCoding.h in Headers */,
2710
2711
2712
2713
2714
2715
2716

2717
2718
2719
2720
2721
2722
2723
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733







+







				4BCAA9AF1772432F003EF859 /* OFMessagePackExtension.h in Headers */,
				4B879A8E177231F000EBCEA4 /* OFMessagePackRepresentation.h in Headers */,
				4B3D23CD1337FCB000DD29B8 /* OFMutableArray.h in Headers */,
				4B1223151F23E6C000D9F8FF /* OFMutableData.h in Headers */,
				4B3D23CE1337FCB000DD29B8 /* OFMutableDictionary.h in Headers */,
				4B39844713D3AFB400E6F825 /* OFMutableSet.h in Headers */,
				4B3D23CF1337FCB000DD29B8 /* OFMutableString.h in Headers */,
				4BA842E61F35E53800292FC6 /* OFMutableTarArchiveEntry.h in Headers */,
				4B4116D01F21654200E78916 /* OFMutableURL.h in Headers */,
				4B92FDDF1F35DFB5000D541D /* OFMutableZIPArchiveEntry.h in Headers */,
				4B674403163C395900EB1E59 /* OFMutex.h in Headers */,
				4B511B7C139C0A34003764A5 /* OFNull.h in Headers */,
				4B3D23D01337FCB000DD29B8 /* OFNumber.h in Headers */,
				4B3D23D11337FCB000DD29B8 /* OFObject.h in Headers */,
				4BC176301D04963000C32718 /* OFObject+KeyValueCoding.h in Headers */,
3275
3276
3277
3278
3279
3280
3281

3282
3283
3284
3285
3286
3287
3288
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299







+







				4B1223191F23E6C100D9F8FF /* OFMutableData.m in Sources */,
				4B2C214A1DA292BE00735907 /* OFMutableDictionary.m in Sources */,
				4B2C214B1DA292BE00735907 /* OFMutableDictionary_hashtable.m in Sources */,
				4B2C214C1DA292BE00735907 /* OFMutableSet.m in Sources */,
				4B2C214D1DA292BE00735907 /* OFMutableSet_hashtable.m in Sources */,
				4B2C214E1DA292BE00735907 /* OFMutableString.m in Sources */,
				4B2C214F1DA292BE00735907 /* OFMutableString_UTF8.m in Sources */,
				4BA842E91F35E53800292FC6 /* OFMutableTarArchiveEntry.m in Sources */,
				4B4116D31F21654200E78916 /* OFMutableURL.m in Sources */,
				4B92FDE21F35DFBC000D541D /* OFMutableZIPArchiveEntry.m in Sources */,
				4B2C21501DA292BE00735907 /* OFMutex.m in Sources */,
				4B2C21511DA292BE00735907 /* OFNull.m in Sources */,
				4B2C21521DA292BE00735907 /* OFNumber.m in Sources */,
				4B2C21531DA292BE00735907 /* OFObject.m in Sources */,
				4B2C21541DA292BE00735907 /* OFObject+Serialization.m in Sources */,
3476
3477
3478
3479
3480
3481
3482

3483
3484
3485
3486
3487
3488
3489
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501







+







				4B1223161F23E6C000D9F8FF /* OFMutableData.m in Sources */,
				4B3D239C1337FC0D00DD29B8 /* OFMutableDictionary.m in Sources */,
				4B2B3E84140D430500EC2F7C /* OFMutableDictionary_hashtable.m in Sources */,
				4B39844813D3AFB400E6F825 /* OFMutableSet.m in Sources */,
				4BA85BCD140ECCE800E91D51 /* OFMutableSet_hashtable.m in Sources */,
				4B3D239D1337FC0D00DD29B8 /* OFMutableString.m in Sources */,
				4B552553147AA5DB0003BF47 /* OFMutableString_UTF8.m in Sources */,
				4BA842E81F35E53800292FC6 /* OFMutableTarArchiveEntry.m in Sources */,
				4B4116D21F21654200E78916 /* OFMutableURL.m in Sources */,
				4B92FDE11F35DFBB000D541D /* OFMutableZIPArchiveEntry.m in Sources */,
				4B674404163C395900EB1E59 /* OFMutex.m in Sources */,
				4B511B7D139C0A34003764A5 /* OFNull.m in Sources */,
				4B3D239E1337FC0D00DD29B8 /* OFNumber.m in Sources */,
				4B3D239F1337FC0D00DD29B8 /* OFObject.m in Sources */,
				4BB25E89139C388A00F574EA /* OFObject+Serialization.m in Sources */,

Modified src/Makefile from [3a5e227dc0] to [8fdff9637f].

36
37
38
39
40
41
42

43
44
45
46
47
48
49
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50







+







       OFMD5Hash.m			\
       OFMessagePackExtension.m		\
       OFMutableArray.m			\
       OFMutableData.m			\
       OFMutableDictionary.m		\
       OFMutableSet.m			\
       OFMutableString.m		\
       OFMutableTarArchiveEntry.m	\
       OFMutableURL.m			\
       OFMutableZIPArchiveEntry.m	\
       OFNull.m				\
       OFNumber.m			\
       OFObject.m			\
       OFObject+KeyValueCoding.m	\
       OFObject+Serialization.m		\

Added src/OFMutableTarArchiveEntry.h version [47bcdec64f].


























































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * 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 "OFTarArchiveEntry.h"

OF_ASSUME_NONNULL_BEGIN

/*!
 * @class OFMutableTarArchiveEntry \
 *	  OFMutableTarArchiveEntry.h ObjFW/OFMutableTarArchiveEntry.h
 *
 * @brief A class which represents a mutable entry of a tar archive.
 */
@interface OFMutableTarArchiveEntry: OFTarArchiveEntry

/*!
 * The file name of the entry.
 */
@property (readwrite, nonatomic, copy) OFString *fileName;

/*!
 * The mode of the entry.
 */
@property (readwrite, nonatomic) uint32_t mode;

/*!
 * The size of the file.
 */
@property (readwrite, nonatomic) uint64_t size;

/*!
 * The date of the last modification of the file.
 */
@property (readwrite, nonatomic, retain) OFDate *modificationDate;

/*!
 * The type of the archive entry.
 *
 * See @ref of_tar_archive_entry_type_t.
 */
@property (readwrite, nonatomic) of_tar_archive_entry_type_t type;

/*!
 * The file name of the target (for a hard link or symbolic link).
 */
@property OF_NULLABLE_PROPERTY (readwrite, nonatomic, copy)
    OFString *targetFileName;

/*!
 * The owner of the file.
 */
@property OF_NULLABLE_PROPERTY (readwrite, nonatomic, copy) OFString *owner;

/*!
 * The group of the file.
 */
@property OF_NULLABLE_PROPERTY (readwrite, nonatomic, copy) OFString *group;

/*!
 * The device major (if the file is a device).
 */
@property (readwrite, nonatomic) uint32_t deviceMajor;

/*!
 * The device major (if the file is a device).
 */
@property (readwrite, nonatomic) uint32_t deviceMinor;

/*!
 * @brief Converts the OFMutableTarArchiveEntry to an immutable
 *	  OFTarArchiveEntry.
 */
- (void)makeImmutable;
@end

OF_ASSUME_NONNULL_END

Added src/OFMutableTarArchiveEntry.m version [f430c94c33].



































































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
 *   Jonathan Schleifer <js@heap.zone>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFMutableTarArchiveEntry.h"

@implementation OFMutableTarArchiveEntry
@dynamic fileName, mode, size, modificationDate, type, targetFileName;
@dynamic owner, group, deviceMajor, deviceMinor;

- copy
{
	OFMutableTarArchiveEntry *copy = [self mutableCopy];

	[copy makeImmutable];

	return copy;
}

- (void)setFileName: (OFString *)fileName
{
	OFString *old = _fileName;
	_fileName = [fileName copy];
	[old release];
}

- (void)setMode: (uint32_t)mode
{
	_mode = mode;
}

- (void)setSize: (uint64_t)size
{
	_size = size;
}

- (void)setDate: (OFDate *)modificationDate
{
	OFDate *old = _modificationDate;
	_modificationDate = [modificationDate retain];
	[old release];
}

- (void)setType: (of_tar_archive_entry_type_t)type
{
	_type = type;
}

- (void)setTargetFileName: (OFString *)targetFileName
{
	OFString *old = _targetFileName;
	_targetFileName = [targetFileName copy];
	[old release];
}

- (void)setOwner: (OFString *)owner
{
	OFString *old = _owner;
	_owner = [owner copy];
	[old release];
}

- (void)setGroup: (OFString *)group
{
	OFString *old = _group;
	_group = [group copy];
	[old release];
}

- (void)setDeviceMajor: (uint32_t)deviceMajor
{
	_deviceMajor = deviceMajor;
}

- (void)setDeviceMinor: (uint32_t)deviceMinor
{
	_deviceMinor = deviceMinor;
}

- (void)makeImmutable
{
	object_setClass(self, [OFTarArchiveEntry class]);
}
@end

Modified src/OFMutableZIPArchiveEntry.h from [af3ebd0c7b] to [051d102b30].

109
110
111
112
113
114
115
116


117
118
119
120
121
109
110
111
112
113
114
115

116
117
118
119
120
121
122







-
+
+





 * The general purpose bit flag of the entry.
 *
 * See the ZIP specification for details.
 */
@property (readwrite, nonatomic) uint16_t generalPurposeBitFlag;

/*!
 * @brief Converts the OFMutableZIPArchive to an immutable OFZIPArchive.
 * @brief Converts the OFMutableZIPArchiveEntry to an immutable
 *	  OFZIPArchiveEntry.
 */
- (void)makeImmutable;
@end

OF_ASSUME_NONNULL_END

Modified src/OFTarArchive.h from [32c44fd3a1] to [b27de43f94].

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
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







+








-
-
-

-





-
+







#import "OFObject.h"
#import "OFTarArchiveEntry.h"

OF_ASSUME_NONNULL_BEGIN

@class OFString;
@class OFStream;
@class OFTarArchive_FileReadStream;

/*!
 * @class OFTarArchive OFTarArchive.h ObjFW/OFTarArchive.h
 *
 * @brief A class for accessing and manipulating tar archives.
 */
@interface OFTarArchive: OFObject
{
#ifdef OF_TAR_ARCHIVE_ENTRY_M
@public
#endif
	OFStream *_stream;
@protected
	enum {
		OF_TAR_ARCHIVE_MODE_READ,
		OF_TAR_ARCHIVE_MODE_WRITE,
		OF_TAR_ARCHIVE_MODE_APPEND
	} _mode;
	OFTarArchiveEntry *_lastReturnedEntry;
	OFTarArchive_FileReadStream *_lastReturnedStream;
}

/*!
 * @brief Creates a new OFTarArchive object with the specified stream.
 *
 * @param stream A stream from which the tar archive will be read
 * @param mode The mode for the tar file. Valid modes are "r" for reading,
98
99
100
101
102
103
104
105
106
107



108
109
110
111
112







113
114
115
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







-
-
-
+
+
+





+
+
+
+
+
+
+




/*!
 * @brief Returns the next entry from the tar archive or `nil` if all entries
 *	  have been read.
 *
 * This is only available in read mode.
 *
 * @warning Calling @ref nextEntry will invalidate all streams returned by the
 *	    previous entry! Reading from an invalidated stream will throw an
 *	    @ref OFReadFailedException!
 * @warning Calling @ref nextEntry will invalidate all streams returned by
 *	    @ref streamForReadingCurrentEntry entry! Reading from an
 *	    invalidated stream will throw an @ref OFReadFailedException!
 *
 * @return The next entry from the tar archive or `nil` if all entries have
 *	   been read
 */
- (OFTarArchiveEntry *)nextEntry;

/*!
 * @brief Returns a stream for reading the current entry.
 *
 * @return A stream for reading the current entry
 */
- (OFStream *)streamForReadingCurrentEntry;
@end

OF_ASSUME_NONNULL_END

Modified src/OFTarArchive.m from [8e5558d27e] to [0db6ddc7de].

22
23
24
25
26
27
28














29
30
31
32
33
34
35
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+







#import "OFStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"

@interface OFTarArchive_FileReadStream: OFStream
{
	OFStream *_stream;
	OFTarArchiveEntry *_entry;
	size_t _toRead;
	bool _atEndOfStream;
}

- initWithEntry: (OFTarArchiveEntry *)entry
	 stream: (OFStream *)stream;
- (void)of_skip;
@end

@implementation OFTarArchive: OFObject
+ (instancetype)archiveWithStream: (OFStream *)stream
			     mode: (OFString *)mode
{
	return [[[self alloc] initWithStream: stream
					mode: mode] autorelease];
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
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







-
+






+









-
-
-
-
+
+
+
+







	return self;
}
#endif

- (void)dealloc
{
	[_stream release];
	[_lastReturnedEntry release];
	[_lastReturnedStream release];

	[super dealloc];
}

- (OFTarArchiveEntry *)nextEntry
{
	OFTarArchiveEntry *entry;
	union {
		char c[512];
		uint32_t u32[512 / sizeof(uint32_t)];
	} buffer;
	bool empty = true;

	if (_mode != OF_TAR_ARCHIVE_MODE_READ)
		@throw [OFInvalidArgumentException exception];

	[_lastReturnedEntry of_skip];
	[_lastReturnedEntry close];
	[_lastReturnedEntry release];
	_lastReturnedEntry = nil;
	[_lastReturnedStream of_skip];
	[_lastReturnedStream close];
	[_lastReturnedStream release];
	_lastReturnedStream = nil;

	if ([_stream isAtEndOfStream])
		return nil;

	[_stream readIntoBuffer: buffer.c
		    exactLength: 512];

122
123
124
125
126
127
128
129
130
131






132













































133
134




























































135
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







-
-
-
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

		for (size_t i = 0; i < 512 / sizeof(uint32_t); i++)
			if (buffer.u32[i] != 0)
				@throw [OFInvalidFormatException exception];

		return nil;
	}

	_lastReturnedEntry = [[OFTarArchiveEntry alloc]
	    of_initWithHeader: buffer.c
		       stream: _stream];
	entry = [[[OFTarArchiveEntry alloc]
	    of_initWithHeader: buffer.c] autorelease];

	_lastReturnedStream = [[OFTarArchive_FileReadStream alloc]
	    initWithEntry: entry
		   stream: _stream];

	return entry;
}

- (OFStream *)streamForReadingCurrentEntry
{
	return [[_lastReturnedStream retain] autorelease];
}
@end

@implementation OFTarArchive_FileReadStream
- initWithEntry: (OFTarArchiveEntry *)entry
	 stream: (OFStream *)stream
{
	self = [super init];

	@try {
		_entry = [entry copy];
		_stream = [stream retain];
		_toRead = [entry size];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[self close];

	[_entry release];

	[super dealloc];
}

- (size_t)lowlevelReadIntoBuffer: (void *)buffer
			  length: (size_t)length
{
	size_t ret;

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
	return _lastReturnedEntry;
}
		return 0;

	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

	ret = [_stream readIntoBuffer: buffer
			       length: length];

	if (ret == 0)
		_atEndOfStream = true;

	_toRead -= ret;

	return ret;
}

- (bool)lowlevelIsAtEndOfStream
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	return _atEndOfStream;
}

- (bool)hasDataInReadBuffer
{
	return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]);
}

- (void)close
{
	[_stream release];
	_stream = nil;

	[super close];
}

- (void)of_skip
{
	char buffer[512];
	uint64_t size;

	while (_toRead >= 512) {
		[_stream readIntoBuffer: buffer
			    exactLength: 512];
		_toRead -= 512;
	}

	if (_toRead > 0) {
		[_stream readIntoBuffer: buffer
			    exactLength: (size_t)_toRead];
		_toRead = 0;
	}

	size = [_entry size];

	if (size % 512 != 0)
		[_stream readIntoBuffer: buffer
			    exactLength: 512 - ((size_t)size % 512)];
}
@end

Modified src/OFTarArchiveEntry+Private.h from [ca35be2adb] to [b914204d31].

16
17
18
19
20
21
22
23

24
25
26
27
16
17
18
19
20
21
22

23

24
25
26







-
+
-




#import "OFTarArchiveEntry.h"

OF_ASSUME_NONNULL_BEGIN

@interface OFTarArchiveEntry ()
- (instancetype)of_initWithHeader: (char [_Nonnull 512])header
			   stream: (OFStream *)stream OF_METHOD_FAMILY(init);
    OF_METHOD_FAMILY(init);
- (void)of_skip;
@end

OF_ASSUME_NONNULL_END

Modified src/OFTarArchiveEntry.h from [37e5a4326d] to [cbb13e9f37].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
11
12
13
14
15
16
17

18
19
20
21
22
23
24







-







 * 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 "OFObject.h"
#import "OFStream.h"

OF_ASSUME_NONNULL_BEGIN

@class OFDate;

/*!
 * @brief The type of the archive entry.
44
45
46
47
48
49
50
51

52
53
54
55
56
57

58
59
60
61
62
63
64
43
44
45
46
47
48
49

50
51


52
53

54
55
56
57
58
59
60
61







-
+

-
-


-
+







} of_tar_archive_entry_type_t;

/*!
 * @class OFTarArchiveEntry OFTarArchiveEntry.h ObjFW/OFTarArchiveEntry.h
 *
 * @brief A class which represents an entry of a tar archive.
 */
@interface OFTarArchiveEntry: OFStream
@interface OFTarArchiveEntry: OFObject <OFCopying, OFMutableCopying>
{
	OFStream *_stream;
	bool _atEndOfStream;
	OFString *_fileName;
	uint32_t _mode;
	uint64_t _size, _toRead;
	uint64_t _size;
	OFDate *_modificationDate;
	of_tar_archive_entry_type_t _type;
	OFString *_targetFileName;
	OFString *_owner, *_group;
	uint32_t _deviceMajor, _deviceMinor;
}

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


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







-
+




-
+




-
+











+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+



+
+
 * See @ref of_tar_archive_entry_type_t.
 */
@property (readonly, nonatomic) of_tar_archive_entry_type_t type;

/*!
 * The file name of the target (for a hard link or symbolic link).
 */
@property (readonly, nonatomic) OFString *targetFileName;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *targetFileName;

/*!
 * The owner of the file.
 */
@property (readonly, nonatomic) OFString *owner;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *owner;

/*!
 * The group of the file.
 */
@property (readonly, nonatomic) OFString *group;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *group;

/*!
 * The device major (if the file is a device).
 */
@property (readonly, nonatomic) uint32_t deviceMajor;

/*!
 * The device major (if the file is a device).
 */
@property (readonly, nonatomic) uint32_t deviceMinor;

/*!
 * @brief Creates a new OFTarArchiveEntry with the specified file name.
 *
 * @param fileName The file name for the OFTarArchiveEntry
 * @return A new, autoreleased OFTarArchiveEntry
 */
+ (instancetype)entryWithFileName: (OFString *)fileName;

- init OF_UNAVAILABLE;

/*!
 * @brief Initializes an already allocated OFTarArchiveEntry with the specified
 *	  file name.
 *
 * @param fileName The file name for the OFTarArchiveEntry
 * @return An initialized OFTarArchiveEntry
 */
- initWithFileName: (OFString *)fileName;
@end

OF_ASSUME_NONNULL_END

#import "OFMutableTarArchiveEntry.h"

Modified src/OFTarArchiveEntry.m from [e3da7730a5] to [9618c37951].

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
10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32







-
-









-







 *
 * 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.
 */

#define OF_TAR_ARCHIVE_ENTRY_M

#include "config.h"

#include <inttypes.h>

#import "OFTarArchiveEntry.h"
#import "OFTarArchiveEntry+Private.h"
#import "OFStream.h"
#import "OFDate.h"

#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"

static OFString *
stringFromBuffer(const char *buffer, size_t length)
{
	for (size_t i = 0; i < length; i++)
		if (buffer[i] == '\0')
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
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







-
+
-
-
+
+
-
-
+







-





-
+
-




-
+






+
-
+
+
+







	if (value > max)
		@throw [OFOutOfRangeException exception];

	return value;
}

@implementation OFTarArchiveEntry
@synthesize fileName = _fileName, mode = _mode, size = _size;
+ (instancetype)entryWithFileName: (OFString *)fileName
@synthesize modificationDate = _modificationDate, type = _type;
@synthesize targetFileName = _targetFileName;
{
	return [[[self alloc] initWithFileName: fileName] autorelease];
@synthesize owner = _owner, group = _group;
@synthesize deviceMajor = _deviceMajor, deviceMinor = _deviceMinor;
}

- init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)of_initWithHeader: (char [512])header
			   stream: (OFStream *)stream
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();

		OFString *targetFileName;
		_stream = [stream retain];

		_fileName = [stringFromBuffer(header, 100) copy];
		_mode = (uint32_t)octalValueFromBuffer(
		    header + 100, 8, UINT32_MAX);
		_size = _toRead = (uint64_t)octalValueFromBuffer(
		_size = (uint64_t)octalValueFromBuffer(
		    header + 124, 12, UINT64_MAX);
		_modificationDate = [[OFDate alloc]
		    initWithTimeIntervalSince1970:
		    (of_time_interval_t)octalValueFromBuffer(
		    header + 136, 12, UINTMAX_MAX)];
		_type = header[156];

		_targetFileName = [stringFromBuffer(header + 157, 100) copy];
		targetFileName = stringFromBuffer(header + 157, 100);
		if ([targetFileName length] > 0)
			_targetFileName = [targetFileName copy];

		if (_type == '\0')
			_type = OF_TAR_ARCHIVE_ENTRY_TYPE_FILE;

		if (memcmp(header + 257, "ustar\0" "00", 8) == 0) {
			OFString *fileName;

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
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+



-
-









-
+
-

-
-
-
+
+
+
-
-
-
+
+
+
+
-

+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-

-
+
-
-
-
-
-
+
+
+
+
+


-
+

-
+
-
-
+
-
-
-
-
+
+
+
+
+
+
+

-
+


-
+

-
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+

-
-
-
-
-
+
+
+
+

-
-
+
-
+
+







	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithFileName: (OFString *)fileName
{
	self = [super init];

	@try {
		_fileName = [fileName copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[self close];

	[_fileName release];
	[_modificationDate release];
	[_targetFileName release];
	[_owner release];
	[_group release];

	[super dealloc];
}

- (size_t)lowlevelReadIntoBuffer: (void *)buffer
- copy
			  length: (size_t)length
{
	size_t ret;

	if (_stream == nil)
	return [self retain];
}

		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
- mutableCopy
{
	OFTarArchiveEntry *copy = [[OFMutableTarArchiveEntry alloc]
	    initWithFileName: _fileName];
		return 0;

	@try {
	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

		copy->_mode = _mode;
		copy->_size = _size;
		copy->_modificationDate = [_modificationDate copy];
		copy->_type = _type;
		copy->_targetFileName = [_targetFileName copy];
		copy->_owner = [_owner copy];
		copy->_group = [_group copy];
		copy->_deviceMajor = _deviceMajor;
		copy->_deviceMinor = _deviceMinor;
	} @catch (id e) {
		[copy release];
		@throw e;
	}
	ret = [_stream readIntoBuffer: buffer
			       length: length];

	if (ret == 0)
	return copy;
		_atEndOfStream = true;

	_toRead -= ret;

	return ret;
}

- (OFString *)fileName
{
	return _fileName;
}

- (bool)lowlevelIsAtEndOfStream
- (uint32_t)mode
{
	if (_stream == nil)
	return _mode;
		@throw [OFNotOpenException exceptionWithObject: self];

}
	return _atEndOfStream;
}

- (bool)hasDataInReadBuffer

- (uint64_t)size
{
	return _size;
}

- (OFDate *)modificationDate
{
	return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]);
	return _modificationDate;
}

- (void)close
- (of_tar_archive_entry_type_t)type
{
	[_stream release];
	_stream = nil;

	return _type;
}
	[super close];
}


- (OFString *)targetFileName
{
- (void)of_skip
{
	char buffer[512];

	while (_toRead >= 512) {
	return _targetFileName;
}

- (OFString *)owner
{
	return _owner;
}

		[_stream readIntoBuffer: buffer
			    exactLength: 512];
- (OFString *)group
		_toRead -= 512;
	}
{
	return _group;
}

	if (_toRead > 0) {
		[_stream readIntoBuffer: buffer
			    exactLength: (size_t)_toRead];
		_toRead = 0;
	}
- (uint32_t)deviceMajor
{
	return _deviceMajor;
}

	if (_size % 512 != 0)
		[_stream readIntoBuffer: buffer
- (uint32_t)deviceMinor
			    exactLength: 512 - ((size_t)_size % 512)];
{
	return _deviceMinor;
}

- (OFString *)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat: @"<%@:\n"
	     @"\tFile name = %@\n"

Modified src/OFZIPArchive.m from [c549fb1fd1] to [77923608cb].

376
377
378
379
380
381
382
383

384
385
386
387
388
389
390
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390







-
+








	_lastReturnedStream = [[OFZIPArchive_FileStream alloc]
	     initWithStream: _stream
	    localFileHeader: localFileHeader];

	objc_autoreleasePoolPop(pool);

	return _lastReturnedStream;
	return [[_lastReturnedStream retain] autorelease];
}
@end

@implementation OFZIPArchive_LocalFileHeader
- initWithStream: (OFStream *)stream
{
	self = [super init];

Modified utils/ofzip/TarArchive.m from [b67377ac42] to [49a8dc5d2b].

235
236
237
238
239
240
241

242
243
244
245
246
247
248
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249







+







	while ((entry = [_archive nextEntry]) != nil) {
		void *pool = objc_autoreleasePoolPush();
		OFString *fileName = [entry fileName];
		OFString *outFileName = [fileName stringByStandardizingPath];
		OFArray OF_GENERIC(OFString *) *pathComponents;
		OFString *directory;
		OFFile *output;
		OFStream *stream;
		uint64_t written = 0, size = [entry size];
		int8_t percent = -1, newPercent;

		if (!all && ![files containsObject: fileName])
			continue;

		if ([entry type] != OF_TAR_ARCHIVE_ENTRY_TYPE_FILE) {
315
316
317
318
319
320
321


322
323


324
325
326
327
328
329
330
316
317
318
319
320
321
322
323
324


325
326
327
328
329
330
331
332
333







+
+
-
-
+
+







				outFileName: outFileName])
			goto outer_loop_end;

		output = [OFFile fileWithPath: outFileName
					 mode: @"w"];
		setPermissions(outFileName, entry);

		stream = [_archive streamForReadingCurrentEntry];

		while (![entry isAtEndOfStream]) {
			ssize_t length = [app copyBlockFromStream: entry
		while (![stream isAtEndOfStream]) {
			ssize_t length = [app copyBlockFromStream: stream
							 toStream: output
							 fileName: fileName];

			if (length < 0) {
				app->_exitStatus = 1;
				goto outer_loop_end;
			}
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
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







+




+
+
-
-
+
+










-
+













		return;
	}

	files = [OFMutableSet setWithArray: files_];

	while ((entry = [_archive nextEntry]) != nil) {
		OFString *fileName = [entry fileName];
		OFStream *stream;

		if (![files containsObject: fileName])
			continue;

		stream = [_archive streamForReadingCurrentEntry];

		while (![entry isAtEndOfStream]) {
			ssize_t length = [app copyBlockFromStream: entry
		while (![stream isAtEndOfStream]) {
			ssize_t length = [app copyBlockFromStream: stream
							 toStream: of_stdout
							 fileName: fileName];

			if (length < 0) {
				app->_exitStatus = 1;
				return;
			}
		}

		[files removeObject: fileName];
		[entry close];
		[stream close];

		if ([files count] == 0)
			break;
	}

	for (OFString *file in files) {
		[of_stderr writeLine: OF_LOCALIZED(@"file_not_in_archive",
		    @"File %[file] is not in the archive!",
		    @"file", file)];
		app->_exitStatus = 1;
	}
}
@end