ObjFW  Check-in [e633b42c0b]

Overview
Comment:OFTarArchiveEntry: Fix prefix handling for ustar
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e633b42c0bbd562c28f1d502a4ca39eb323409e6d04a6ab184b2f8a50f8954c8
User & Date: js on 2017-08-05 15:50:43
Other Links: manifest | tags
Context
2017-08-05
17:13
OFGZIPStream: Add missing documentation check-in: e1b882d70b user: js tags: trunk
15:50
OFTarArchiveEntry: Fix prefix handling for ustar check-in: e633b42c0b user: js tags: trunk
15:22
OFTarArchive: Add write and append support check-in: 0c5035dd3f user: js tags: trunk
Changes

Modified src/OFTarArchiveEntry.m from [35204f8874] to [0e7f87b9e6].

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







-
+









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







		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;
			OFString *prefix;

			_owner = [stringFromBuffer(header + 265, 32) copy];
			_group = [stringFromBuffer(header + 297, 32) copy];

			_deviceMajor = (uint32_t)octalValueFromBuffer(
			    header + 329, 8, UINT32_MAX);
			_deviceMinor = (uint32_t)octalValueFromBuffer(
			    header + 337, 8, UINT32_MAX);

			prefix = stringFromBuffer(header + 345, 155);
			if ([prefix length] > 0) {
				OFString *fileName = [OFString
			fileName = [OFString stringWithFormat: @"%@/%@",
			    stringFromBuffer(header + 345, 155), _fileName];
			[_fileName release];
			_fileName = [fileName copy];
				    stringWithFormat: @"%@/%@",
						      prefix, _fileName];
				[_fileName release];
				_fileName = [fileName copy];
			}
		}

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