ObjFW  Check-in [42ab7308b9]

Overview
Comment:OFLHAArchive: Add support for -lz4- files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 42ab7308b9337244e032fa078ec024c88b7b9cb8be2bc4d3cdedd3bbfce688ee
User & Date: js on 2024-02-24 16:17:51
Other Links: manifest | tags
Context
2024-02-24
17:24
OFLHAArchive: Ignore trailing garbage check-in: 35257251ec user: js tags: trunk
16:17
OFLHAArchive: Add support for -lz4- files check-in: 42ab7308b9 user: js tags: trunk
15:05
OFLHAArchiveEntry: Add extra sanity checks check-in: 4c56240653 user: js tags: trunk
Changes

Modified src/OFLHAArchive.m from [80292dff55] to [f92b1ecdad].

322
323
324
325
326
327
328
329

330
331
332
333
334
335
336
			       dictionaryBits: 17];
		else if ([compressionMethod isEqual: @"-lhx-"])
			_decompressedStream = [[OFLHADecompressingStream alloc]
			    of_initWithStream: stream
				 distanceBits: 5
			       dictionaryBits: 20];
		else if ([compressionMethod isEqual: @"-lh0-"] ||
		    [compressionMethod isEqual: @"-lhd-"])

			_decompressedStream = [stream retain];
		else
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: compressionMethod];

		_entry = [entry copy];
		_toRead = entry.uncompressedSize;







|
>







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
			       dictionaryBits: 17];
		else if ([compressionMethod isEqual: @"-lhx-"])
			_decompressedStream = [[OFLHADecompressingStream alloc]
			    of_initWithStream: stream
				 distanceBits: 5
			       dictionaryBits: 20];
		else if ([compressionMethod isEqual: @"-lh0-"] ||
		    [compressionMethod isEqual: @"-lhd-"] ||
		    [compressionMethod isEqual: @"-lz4-"])
			_decompressedStream = [stream retain];
		else
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: compressionMethod];

		_entry = [entry copy];
		_toRead = entry.uncompressedSize;

Modified utils/ofarc/OFArc.m from [71ea16470c] to [6f8333dc2e].

558
559
560
561
562
563
564
565

566
567
568
569
570
571
572
	if (type == nil || [type isEqual: @"auto"]) {
		/* This one has to be first for obvious reasons */
		if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] ||
		    [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"])
			type = @"tgz";
		else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"])
			type = @"gz";
		else if ([path hasSuffix: @".lha"] || [path hasSuffix: @".lzh"])

			type = @"lha";
		else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"])
			type = @"tar";
		else
			type = @"zip";
	}








|
>







558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
	if (type == nil || [type isEqual: @"auto"]) {
		/* This one has to be first for obvious reasons */
		if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] ||
		    [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"])
			type = @"tgz";
		else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"])
			type = @"gz";
		else if ([path hasSuffix: @".lha"] ||
		    [path hasSuffix: @".lzh"] || [path hasSuffix: @".lzs"])
			type = @"lha";
		else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"])
			type = @"tar";
		else
			type = @"zip";
	}