1 Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp 2009-06-01 22:01:10.000000000 +0200
7 + * LZMA command line tool similar to gzip to encode and decode LZMA files.
9 + * Copyright (C) 2005 Ville Koskinen
11 + * This program is free software; you can redistribute it and/or
12 + * modify it under the terms of the GNU General Public License
13 + * as published by the Free Software Foundation; either version 2
14 + * of the License, or (at your option) any later version.
16 + * This program is distributed in the hope that it will be useful,
17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 + * GNU General Public License for more details.
21 + * You should have received a copy of the GNU General Public License
22 + * along with this program; if not, write to the Free Software
23 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 +#include "../../../Common/MyInitGuid.h"
42 +typedef vector<string> stringVector;
48 +#include <sys/types.h>
49 +#include <sys/stat.h>
51 +#include <sys/time.h> // futimes()
55 +//#define futimes(fd, tv) futimesat(fd, NULL, tv)
58 +#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
61 +#define MY_SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
63 +#define MY_SET_BINARY_MODE(file)
66 +#include "../../../7zip/Common/FileStreams.h"
68 +#include "../../../Common/Types.h"
70 +#include "../../../7zip/Compress/LzmaDecoder.h"
71 +#include "../../../7zip/Compress/LzmaEncoder.h"
73 +#include "Exception.h"
75 +#include "lzma_version.h"
79 +const char *PROGRAM_VERSION = PACKAGE_VERSION;
80 +const char *PROGRAM_COPYRIGHT = "Copyright (C) 2006 Ville Koskinen";
82 +/* LZMA_Alone switches:
83 + -a{N}: set compression mode - [0, 2], default: 2 (max)
84 + -d{N}: set dictionary - [0,28], default: 23 (8MB)
85 + -fb{N}: set number of fast bytes - [5, 255], default: 128
86 + -lc{N}: set number of literal context bits - [0, 8], default: 3
87 + -lp{N}: set number of literal pos bits - [0, 4], default: 0
88 + -pb{N}: set number of pos bits - [0, 4], default: 2
89 + -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
90 + pat2h, pat3h, pat4h, hc3, hc4], default: bt4
94 + short compression_mode; // -a
95 + short dictionary; // -d
96 + short fast_bytes; // -fb
97 + wchar_t *match_finder; // -mf
98 + short literal_context_bits; // -lc
99 + short literal_pos_bits; // -lp
100 + short pos_bits; // -pb
103 +/* The following is a mapping from gzip/bzip2 style -1 .. -9 compression modes
104 + * to the corresponding LZMA compression modes. Thanks, Larhzu, for coining
106 +const lzma_option option_mapping[] = {
107 + { 0, 0, 0, NULL, 0, 0, 0}, // -0 (needed for indexing)
108 + { 0, 16, 64, L"hc4", 3, 0, 2}, // -1
109 + { 0, 20, 64, L"hc4", 3, 0, 2}, // -2
110 + { 1, 19, 64, L"bt4", 3, 0, 2}, // -3
111 + { 2, 20, 64, L"bt4", 3, 0, 2}, // -4
112 + { 2, 21, 128, L"bt4", 3, 0, 2}, // -5
113 + { 2, 22, 128, L"bt4", 3, 0, 2}, // -6
114 + { 2, 23, 128, L"bt4", 3, 0, 2}, // -7
115 + { 2, 24, 255, L"bt4", 3, 0, 2}, // -8
116 + { 2, 25, 255, L"bt4", 3, 0, 2}, // -9
119 +struct extension_pair {
124 +const extension_pair known_extensions[] = {
126 + { ".tlz", ".tar" },
130 +/* Sorry, I just happen to like enumerations. */
146 +/* getopt options. */
147 +/* struct option { name, has_arg, flag, val } */
148 +const struct option long_options[] = {
149 + { "stdout", 0, 0, 'c' },
150 + { "decompress", 0, 0, 'd' },
151 + { "compress", 0, 0, 'z' },
152 + { "keep", 0, 0, 'k' },
153 + { "force", 0, 0, 'f' },
154 + { "test", 0, 0, 't' },
155 + { "suffix", 1, 0, 'S' },
156 + { "quiet", 0, 0, 'q' },
157 + { "verbose", 0, 0, 'v' },
158 + { "help", 0, 0, 'h' },
159 + { "license", 0, 0, 'L' },
160 + { "version", 0, 0, 'V' },
161 + { "fast", 0, 0, '1' },
162 + { "best", 0, 0, '9' },
166 +/* getopt option string (for the above options). */
167 +const char option_string[] = "cdzkftS:qvhLV123456789A:D:F:";
170 +PROGRAM_MODE program_mode = PM_COMPRESS;
172 +bool stdinput = false;
173 +bool stdoutput = false;
176 +int compression_mode = 7;
177 +//char *suffix = strdup(".lzma");
178 +char *suffix = strdup(known_extensions[0].from);
179 +lzma_option advanced_options = { -1, -1, -1, NULL, -1, -1, -1 };
181 +void print_help(const char *const argv0)
183 + // Help goes to stdout while other messages go to stderr.
184 + cout << "\nlzma " << PROGRAM_VERSION
185 + << " " << PROGRAM_COPYRIGHT << "\n"
186 + "Based on LZMA SDK " << LZMA_SDK_VERSION_STRING << " "
187 + << LZMA_SDK_COPYRIGHT_STRING
188 + << "\n\nUsage: " << argv0
189 + << " [flags and input files in any order]\n"
190 +" -c --stdout output to standard output\n"
191 +" -d --decompress force decompression\n"
192 +" -z --compress force compression\n"
193 +" -k --keep keep (don't delete) input files\n"
194 +" -f --force force overwrite of output file and compress links\n"
195 +" -t --test test compressed file integrity\n"
196 +" -S .suf --suffix .suf use suffix .suf on compressed files\n"
197 +" -q --quiet suppress error messages\n"
198 +" -v --verbose be verbose\n"
199 +" -h --help print this message\n"
200 +" -L --license display the license information\n"
201 +" -V --version display version numbers of LZMA SDK and lzma\n"
202 +" -1 .. -2 fast compression\n"
203 +" -3 .. -9 good to excellent compression. -7 is the default.\n"
204 +" --fast alias for -1\n"
205 +" --best alias for -9 (usually *not* what you want)\n\n"
206 +" Memory usage depends a lot on the chosen compression mode -1 .. -9.\n"
207 +" See the man page lzma(1) for details.\n\n";
210 +void print_license(void)
212 + cout << "\n LZMA command line tool " << PROGRAM_VERSION << " - "
213 + << PROGRAM_COPYRIGHT
214 + << "\n LZMA SDK " << LZMA_SDK_VERSION_STRING << " - "
215 + << LZMA_SDK_COPYRIGHT_STRING
216 + << "\n This program is a part of the LZMA utils package.\n"
217 + " http://tukaani.org/lzma/\n\n"
218 +" This program is free software; you can redistribute it and/or\n"
219 +" modify it under the terms of the GNU General Public License\n"
220 +" as published by the Free Software Foundation; either version 2\n"
221 +" of the License, or (at your option) any later version.\n"
223 +" This program is distributed in the hope that it will be useful,\n"
224 +" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
225 +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
226 +" GNU General Public License for more details.\n"
230 +void print_version(void)
232 + cout << "LZMA command line tool " << PROGRAM_VERSION << "\n"
233 + << "LZMA SDK " << LZMA_SDK_VERSION_STRING << "\n";
236 +short str2int (const char *str, const int &min, const int &max)
239 + char *endptr = NULL;
240 + if (str == NULL || str[0] == '\0')
241 + throw ArgumentException("Invalid integer option");
242 + value = strtol (str, &endptr, 10);
243 + if (*endptr != '\0' || value < min || value > max)
244 + throw ArgumentException("Invalid integer option");
248 +void parse_options(int argc, char **argv, stringVector &filenames)
250 + /* Snatched from getopt(3). */
253 + /* Check how we were called */
255 + char *p = strrchr (argv[0], '/'); // Remove path prefix, if any
258 + if (strstr (p, "un") != NULL) {
259 + program_mode = PM_DECOMPRESS;
260 + } else if (strstr (p, "cat") != NULL) {
261 + program_mode = PM_DECOMPRESS;
266 + while (-1 != (c = getopt_long(argc, argv, option_string,
267 + long_options, NULL))) {
276 + program_mode = PM_DECOMPRESS;
281 + program_mode = PM_COMPRESS;
296 + program_mode = PM_TEST;
303 + suffix = strdup(optarg);
319 + program_mode = PM_HELP;
324 + program_mode = PM_LICENSE;
329 + program_mode = PM_VERSION;
332 + case '1': case '2': case '3': case '4': case '5':
333 + case '6': case '7': case '8': case '9':
334 + compression_mode = c - '0';
337 + // Advanced options //
338 + // Compression mode
340 + advanced_options.compression_mode =
341 + str2int (optarg, 0, 2);
346 + advanced_options.dictionary =
347 + str2int (optarg, 0, 28);
352 + advanced_options.fast_bytes =
353 + str2int (optarg, 0, 273);
357 + throw ArgumentException("");
362 + for (int i = optind; i < argc; i++) {
363 + if (strcmp("-", argv[i]) == 0)
365 + filenames.push_back(argv[i]);
369 +void set_encoder_properties(NCompress::NLzma::CEncoder *encoder,
372 + /* Almost verbatim from LzmaAlone.cpp. */
375 + NCoderPropID::kDictionarySize,
376 + NCoderPropID::kPosStateBits,
377 + NCoderPropID::kLitContextBits,
378 + NCoderPropID::kLitPosBits,
379 + NCoderPropID::kAlgorithm,
380 + NCoderPropID::kNumFastBytes,
381 + NCoderPropID::kMatchFinder,
382 + NCoderPropID::kEndMarker
384 + const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
385 +#define VALUE(x) (advanced_options.x >= 0 ? advanced_options.x : opt.x)
386 + PROPVARIANT properties[kNumProps];
387 + for (int p = 0; p < 6; p++)
388 + properties[p].vt = VT_UI4;
389 + properties[0].ulVal = UInt32(1 << VALUE (dictionary));
390 + properties[1].ulVal = UInt32(VALUE (pos_bits));
391 + properties[2].ulVal = UInt32(VALUE (literal_context_bits));
392 + properties[3].ulVal = UInt32(VALUE (literal_pos_bits));
393 + properties[4].ulVal = UInt32(VALUE (compression_mode));
394 + properties[5].ulVal = UInt32(VALUE (fast_bytes));
397 + properties[6].vt = VT_BSTR;
398 + properties[6].bstrVal = (BSTR)opt.match_finder;
400 + properties[7].vt = VT_BOOL;
401 + properties[7].boolVal = stdinput ? VARIANT_TRUE : VARIANT_FALSE;
403 + if (encoder->SetCoderProperties(propIDs, properties, kNumProps) != S_OK)
404 + throw Exception("SetCoderProperties() error");
407 +void encode(NCompress::NLzma::CEncoder *encoderSpec,
408 + CMyComPtr<ISequentialInStream> inStream,
409 + CMyComPtr<ISequentialOutStream> outStream,
410 + lzma_option encoder_options,
413 + set_encoder_properties(encoderSpec, encoder_options);
415 + encoderSpec->WriteCoderProperties(outStream);
417 + for (int i = 0; i < 8; i++)
419 + Byte b = Byte(fileSize >> (8 * i));
420 + if (outStream->Write(&b, sizeof(b), 0) != S_OK)
421 + throw Exception("Write error while encoding");
424 + HRESULT result = encoderSpec->Code(inStream, outStream, 0, 0, 0);
426 + if (result == E_OUTOFMEMORY)
427 + throw Exception("Cannot allocate memory");
428 + else if (result != S_OK) {
430 + snprintf(buffer, 33, "%d", (unsigned int)result);
431 + throw Exception(string("Encoder error: ") + buffer);
435 +void decode(NCompress::NLzma::CDecoder *decoderSpec,
436 + CMyComPtr<ISequentialInStream> inStream,
437 + CMyComPtr<ISequentialOutStream> outStream)
439 + const UInt32 kPropertiesSize = 5;
440 + Byte properties[kPropertiesSize];
441 + UInt32 processedSize;
442 + UInt64 fileSize = 0;
444 + if (inStream->Read(properties, kPropertiesSize, &processedSize) != S_OK)
445 + throw Exception("Read error");
446 + if (processedSize != kPropertiesSize)
447 + throw Exception("Read error");
448 + if (decoderSpec->SetDecoderProperties2(properties, kPropertiesSize) != S_OK)
449 + throw Exception("SetDecoderProperties() error");
451 + for (int i = 0; i < 8; i++)
455 + if (inStream->Read(&b, sizeof(b), &processedSize) != S_OK)
456 + throw Exception("Read error");
457 + if (processedSize != 1)
458 + throw Exception("Read error");
460 + fileSize |= ((UInt64)b) << (8 * i);
463 + if (decoderSpec->Code(inStream, outStream, 0, &fileSize, 0) != S_OK)
464 + throw Exception("Decoder error");
467 +int open_instream(const string infile,
468 + CMyComPtr<ISequentialInStream> &inStream,
471 + CInFileStream *inStreamSpec = new CInFileStream;
472 + inStream = inStreamSpec;
473 + if (!inStreamSpec->Open(infile.c_str()))
474 + throw Exception("Cannot open input file " + infile);
476 + inStreamSpec->File.GetLength(fileSize);
478 + return inStreamSpec->File.GetHandle();
481 +int open_outstream(const string outfile,
482 + CMyComPtr<ISequentialOutStream> &outStream)
484 + COutFileStream *outStreamSpec = new COutFileStream;
485 + outStream = outStreamSpec;
487 + bool open_by_force = (program_mode == PM_TEST) | force;
489 + if (!outStreamSpec->Create(outfile.c_str(), open_by_force))
490 + throw Exception("Cannot open output file " + outfile);
492 + return outStreamSpec->File.GetHandle();
495 +double get_ratio(int inhandle, int outhandle)
497 + struct stat in_stats, out_stats;
498 + fstat(inhandle, &in_stats);
499 + fstat(outhandle, &out_stats);
501 + return (double)out_stats.st_size / (double)in_stats.st_size;
504 +mode_t get_file_mode(string filename)
506 + struct stat in_stat;
507 + lstat(filename.c_str(), &in_stat);
509 + return in_stat.st_mode;
512 +bool string_ends_with(string str, string ending)
514 + return equal(ending.rbegin(), ending.rend(), str.rbegin());
517 +bool extension_is_known(string filename)
519 + bool known_format = false;
520 + extension_pair extension; int i = 1;
522 + extension = known_extensions[0];
523 + while (extension.from != NULL) {
524 + if (string_ends_with(filename, extension.from)) {
525 + known_format = true;
528 + extension = known_extensions[i];
532 + if (!known_format) {
533 + if (!string_ends_with(filename, suffix)) {
541 +string replace_extension(string filename)
543 + int suffix_starts_at = filename.length() - strlen (suffix);
544 + string from_suffix = filename.substr(suffix_starts_at, strlen (suffix));
545 + string ret = filename.substr(0, suffix_starts_at);
546 + extension_pair extension; int i = 1;
548 + bool found_replacement = false;
549 + extension = known_extensions[0];
550 + while (extension.from != NULL) {
551 + if (from_suffix.compare(extension.from) == 0) {
552 + ret += extension.to;
553 + found_replacement = true;
557 + extension = known_extensions[i];
564 +string pretty_print_status(string filename, string output_filename,
572 + if (program_mode == PM_TEST) {
573 + ret += "decoded succesfully";
578 + if (!stdinput && !stdoutput) {
583 + if (program_mode == PM_COMPRESS) {
585 + ret += "encoded succesfully";
590 + ret += "replaced with ";
591 + ret += output_filename;
596 + if (program_mode == PM_DECOMPRESS) {
598 + ret += "decoded succesfully";
603 + ret += "replaced with ";
604 + ret += output_filename;
612 +static string archive_name; // I know, it is crude, but I haven't found any other
613 + // way then making a global variable to transfer filename to handler
615 +void signal_handler (int signum)
617 + unlink (archive_name.c_str()); // deleting
618 + signal (signum, SIG_DFL); // we return the default function to used signal
619 + kill (getpid(), signum); // and then send this signal to the process again
625 +int main(int argc, char **argv)
627 + using namespace lzma;
630 + stringVector filenames;
632 + signal (SIGTERM,signal_handler);
633 + signal (SIGHUP,signal_handler);
634 + signal (SIGINT,signal_handler);
637 + parse_options(argc, argv, filenames);
640 + return STATUS_ERROR;
643 + if (program_mode == PM_HELP) {
644 + print_help(argv[0]);
647 + else if (program_mode == PM_LICENSE) {
651 + else if (program_mode == PM_VERSION) {
656 + if (filenames.empty()) {
660 + /* FIXME: get rid of this */
661 + filenames.push_back("-");
664 + /* Protection: always create new files with 0600 in order to prevent
665 + * outsiders from reading incomplete data. */
668 + bool warning = false;
670 + for (int i = 0; i < filenames.size(); i++) {
671 + CMyComPtr<ISequentialInStream> inStream;
672 + CMyComPtr<ISequentialOutStream> outStream;
673 + UInt64 fileSize = 0;
674 + int inhandle = 0, outhandle = 0;
675 + string output_filename;
678 + inStream = new CStdInFileStream;
679 + MY_SET_BINARY_MODE(stdin);
680 + fileSize = (UInt64)(Int64)-1;
682 + inhandle = STDIN_FILENO;
684 + outStream = new CStdOutFileStream;
685 + MY_SET_BINARY_MODE(stdout);
687 + outhandle = STDOUT_FILENO;
690 + mode_t infile_mode = get_file_mode(filenames[i]);
691 + if (!S_ISREG(infile_mode)) {
692 + if (S_ISDIR(infile_mode)) {
694 + cerr << argv[0] << ": " << filenames[i] << ": "
695 + << "cowardly refusing to work on directory"
700 + else if (S_ISLNK(infile_mode)) {
701 + if (!stdoutput && !force) {
704 + cerr << argv[0] << ": " << filenames[i] << ": "
705 + << "cowardly refusing to work on symbolic link "
706 + << "(use --force to force encoding or decoding)"
715 + cerr << argv[0] << ": " << filenames[i] << ": "
716 + << "doesn't exist or is not a regular file"
723 + // Test if the file already ends with *suffix.
724 + if (program_mode == PM_COMPRESS && !force
725 + && string_ends_with(filenames[i],
729 + cerr << filenames[i] << " already has "
730 + << suffix << " suffix -- unchanged\n";
735 + // Test if the file extension is known.
736 + if (program_mode == PM_DECOMPRESS
737 + && !extension_is_known(filenames[i])) {
740 + cerr << filenames[i] << ": "
741 + << " unknown suffix -- unchanged"
748 + inhandle = open_instream(filenames[i], inStream, fileSize);
750 + catch (Exception e) {
751 + cerr << argv[0] << ": " << e.what() << endl;
752 + return STATUS_ERROR;
756 + outStream = new CStdOutFileStream;
757 + MY_SET_BINARY_MODE(stdout);
759 + outhandle = STDOUT_FILENO;
762 + /* Testing mode is nothing else but decoding
763 + * and throwing away the result. */
764 + if (program_mode == PM_TEST)
765 + output_filename = "/dev/null";
766 + else if (program_mode == PM_DECOMPRESS)
767 + output_filename = replace_extension(filenames[i]);
769 + output_filename = filenames[i]
771 + archive_name = output_filename;
774 + outhandle = open_outstream(output_filename, outStream);
776 + catch (Exception e) {
777 + cerr << argv[0] << ": " << e.what() << endl;
778 + return STATUS_ERROR;
784 + // Unless --force is specified, do not read/write compressed
785 + // data from/to a terminal.
787 + if (program_mode == PM_COMPRESS && isatty(outhandle)) {
788 + cerr << argv[0] << ": compressed data not "
789 + "written to a terminal. Use "
790 + "-f to force compression.\n"
791 + << argv[0] << ": For help, type: "
792 + << argv[0] << " -h\n";
793 + return STATUS_ERROR;
794 + } else if (program_mode == PM_DECOMPRESS
795 + && isatty(inhandle)) {
796 + cerr << argv[0] << ": compressed data not "
797 + "read from a terminal. Use "
798 + "-f to force decompression.\n"
799 + << argv[0] << ": For help, type: "
800 + << argv[0] << " -h\n";
801 + return STATUS_ERROR;
805 + if (program_mode == PM_COMPRESS) {
806 + NCompress::NLzma::CEncoder *encoderSpec =
807 + new NCompress::NLzma::CEncoder;
809 + lzma_option options = option_mapping[compression_mode];
812 + encode(encoderSpec, inStream, outStream, options, fileSize);
814 + catch (Exception e) {
815 + cerr << argv[0] << ": " << e.what() << endl;
816 + unlink(output_filename.c_str());
817 + delete(encoderSpec);
819 + return STATUS_ERROR;
822 + delete(encoderSpec);
824 + else { // PM_DECOMPRESS | PM_TEST
825 + NCompress::NLzma::CDecoder *decoderSpec =
826 + new NCompress::NLzma::CDecoder;
829 + decode(decoderSpec, inStream, outStream);
831 + catch (Exception e) {
832 + cerr << argv[0] << ": " << e.what() << endl;
833 + unlink(output_filename.c_str());
834 + delete(decoderSpec);
836 + return STATUS_ERROR;
839 + delete(decoderSpec);
842 + /* Set permissions and owners. */
843 + if ( (program_mode == PM_COMPRESS || program_mode == PM_DECOMPRESS )
844 + && (!stdinput && !stdoutput) ) {
847 + struct stat file_stats;
848 + ret = fstat(inhandle, &file_stats);
850 + ret = fchmod(outhandle, file_stats.st_mode);
851 + ret = fchown(outhandle, file_stats.st_uid, file_stats.st_gid);
852 + // We need to call fchmod() again, since otherwise the SUID bits
854 + ret = fchmod(outhandle, file_stats.st_mode);
856 + struct timeval file_times[2];
858 + file_times[0].tv_sec = file_stats.st_atime;
859 + file_times[0].tv_usec = 0;
860 + // Modification time
861 + file_times[1].tv_sec = file_stats.st_mtime;
862 + file_times[1].tv_usec = 0;
864 + ret = futimes(outhandle, file_times);
867 + unlink(filenames[i].c_str());
870 + if (verbosity > 0) {
872 + cerr << filenames[i] << ":\t ";
873 + cerr << "decoded succesfully"
878 + char buf[10] = { 0 };
880 + if (program_mode == PM_DECOMPRESS)
881 + snprintf(buf, 10, "%.2f%%",
882 + (1 - get_ratio(outhandle, inhandle)) * 100);
883 + if (program_mode == PM_COMPRESS)
884 + snprintf(buf, 10, "%.2f%%",
885 + (1 - get_ratio(inhandle, outhandle)) * 100);
887 + string ratio = buf;
888 + cerr << pretty_print_status(filenames[i], output_filename,
896 + return STATUS_WARNING;
901 Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h
902 ===================================================================
903 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
904 +++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h 2009-06-01 22:01:10.000000000 +0200
906 +/* A couple of exceptions for lzmp.
908 + * Copyright (C) 2005 Ville Koskinen
910 + * This program is free software; you can redistribute it and/or
911 + * modify it under the terms of the GNU General Public License
912 + * as published by the Free Software Foundation; either version 2
913 + * of the License, or (at your option) any later version.
915 + * This program is distributed in the hope that it will be useful,
916 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
917 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
918 + * GNU General Public License for more details.
921 +#ifndef _EXCEPTION_H_
922 +#define _EXCEPTION_H_
932 + Exception(char *what): message(what) { }
933 + Exception(string what): message(what) { }
937 + string what(void) { return message; }
940 +class ArgumentException: public Exception
943 + ArgumentException(char *what): Exception(what) { }
944 + ArgumentException(string what): Exception(what) { }
946 + ~ArgumentException() { }
951 Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
952 ===================================================================
953 --- lzma-4.65.orig/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:00:54.000000000 +0200
954 +++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:06:13.000000000 +0200
960 CXX_C = gcc -O2 -Wall
963 -CFLAGS = -c -D_FILE_OFFSET_BITS=64
964 +CFLAGS = -c -I ../../../ -D_FILE_OFFSET_BITS=64 -DPACKAGE_VERSION="\"4.32.0beta3\""
991 +all: $(PROG) $(PROG2)
994 $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
997 + $(CXX) -o $(PROG2) $(LDFLAGS) $(OBJS2) $(LIB)
1000 + $(CXX) $(CFLAGS) lzmp.cpp
1002 LzmaAlone.o: LzmaAlone.cpp
1003 $(CXX) $(CFLAGS) LzmaAlone.cpp
1006 $(CXX_C) $(CFLAGS) ../../../../C/LzmaUtil/Lzma86Enc.c
1009 - -$(RM) $(PROG) $(OBJS)
1010 + -$(RM) $(PROG) $(PROG2) $(OBJS)
1012 Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h
1013 ===================================================================
1014 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1015 +++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h 2009-06-01 22:01:10.000000000 +0200
1017 +#ifndef LZMA_VERSION_H
1018 +#define LZMA_VERSION_H
1021 + Version and copyright information used by LZMA utils.
1024 +static const char *LZMA_SDK_VERSION_STRING = "4.43";
1026 +static const char *LZMA_SDK_COPYRIGHT_STRING =
1027 + "Copyright (C) 1999-2006 Igor Pavlov";
1029 +static const char *LZMA_SDK_COPYRIGHT_INFO =
1030 + " See http://7-zip.org/sdk.html or the documentation of LZMA SDK for\n"
1031 + " the license. For reference, the version 4.43 is free software\n"
1032 + " licensed under the GNU LGPL.";
1035 +static const char *LZMA_UTILS_VERSION_STRING = PACKAGE_VERSION;
1037 +static const char *LZMA_UTILS_COPYRIGHT_STRING =
1038 + "Copyright (C) 2006 Lasse Collin";
1040 +static const char *LZMA_UTILS_COPYRIGHT_INFO =
1041 + "This program comes with ABSOLUTELY NO WARRANTY.\n"
1042 + "You may redistribute copies of this program\n"
1043 + "under the terms of the GNU General Public License.\n"
1044 + "For more information about these matters, see the file "
1045 + "named COPYING.\n";
1047 +#endif /* ifndef LZMA_VERSION_H */
1048 Index: lzma-4.65/CPP/Common/C_FileIO.h
1049 ===================================================================
1050 --- lzma-4.65.orig/CPP/Common/C_FileIO.h 2009-05-15 23:33:51.000000000 +0200
1051 +++ lzma-4.65/CPP/Common/C_FileIO.h 2009-06-01 22:06:56.000000000 +0200
1054 bool GetLength(UInt64 &length) const;
1055 off_t Seek(off_t distanceToMove, int moveMethod) const;
1056 + int GetHandle() const { return _handle; }
1059 class CInFile: public CFileBase