aboutsummaryrefslogtreecommitdiff
path: root/src/common (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-03-29Fix the detection of installed RAM on QNX.Lasse Collin1-1/+13
The earlier version compiled but didn't actually work since sysconf(_SC_PHYS_PAGES) always fails (or so I was told). Thanks to Ole André Vadla Ravnås for the patch and testing.
2015-02-10tuklib_cpucores: Use cpuset_getaffinity() on FreeBSD if available.Lasse Collin1-0/+18
In FreeBSD, cpuset_getaffinity() is the preferred way to get the number of available cores. Thanks to Rui Paulo for the patch. I edited it slightly, but hopefully I didn't break anything.
2015-02-03Add a few casts to tuklib_integer.h to silence possible warnings.Lasse Collin1-12/+12
I heard that Visual Studio 2013 gave warnings without the casts. Thanks to Gabi Davar.
2014-12-21Fix build when --disable-threads is used.Lasse Collin1-0/+2
2014-10-09Add support for AmigaOS/AROS to tuklib_physmem().Lasse Collin1-0/+7
Thanks to Fredrik Wikstrom.
2014-01-12Windows: Add MSVC defines for inline and restrict keywords.Lasse Collin1-0/+10
2014-01-12Fix typos in comments.Lasse Collin1-1/+1
2013-09-17Add native threading support on Windows.Lasse Collin1-111/+402
Now liblzma only uses "mythread" functions and types which are defined in mythread.h matching the desired threading method. Before Windows Vista, there is no direct equivalent to pthread condition variables. Since this package doesn't use pthread_cond_broadcast(), pre-Vista threading can still be kept quite simple. The pre-Vista code doesn't use anything that wasn't already available in Windows 95, so the binaries should run even on Windows 95 if someone happens to care.
2013-08-04Fix the previous commit which broke the build.Lasse Collin1-1/+1
Apparently I didn't even compile-test the previous commit. Thanks to Christian Hesse.
2013-08-03Windows: Add Windows support to tuklib_cpucores().Lasse Collin1-1/+12
It is used for Cygwin too. I'm not sure if that is a good or bad idea. Thanks to Vincent Torri.
2012-12-14liblzma: Fix mythread_sync for nested locking.Lasse Collin1-2/+3
2011-08-09Workaround unusual SIZE_MAX on SCO OpenServer.Lasse Collin1-3/+6
2011-05-28Don't call close(-1) in tuklib_open_stdxxx() on error.Lasse Collin1-1/+3
Thanks to Jim Meyering.
2011-05-17Don't use clockid_t in mythread.h when clock_gettime() isn't available.Lasse Collin1-0/+2
Thanks to Wim Lewis for the patch.
2011-04-19Fix portability problems in mythread.h.Lasse Collin1-4/+27
Use gettimeofday() if clock_gettime() isn't available (e.g. Darwin). The test for availability of pthread_condattr_setclock() and CLOCK_MONOTONIC was incorrect. Instead of fixing the #ifdefs, use an Autoconf test. That way if there exists a system that supports them but doesn't specify the matching POSIX #defines, the features will still get detected. Don't try to use pthread_sigmask() on OpenVMS. It doesn't have that function. Guard mythread.h against being #included multiple times.
2011-04-10Revise mythread.h.Lasse Collin1-20/+180
This adds: - mythread_sync() macro to create synchronized blocks - mythread_cond structure and related functions and macros for condition variables with timed waiting using a relative timeout - mythread_create() to create a thread with all signals blocked Some of these wouldn't need to be inline functions, but I'll keep them this way for now for simplicity. For timed waiting on a condition variable, librt is now required on some systems to use clock_gettime(). configure.ac was updated to handle this.
2011-01-18Add alloc_size and malloc attributes to a few functions.Lasse Collin1-0/+6
Thanks to Cristian Rodríguez for the original patch.
2010-12-12Add missing PRIx32 and PRIx64 compatibility definitions.Lasse Collin1-0/+9
This fixes portability to systems that lack C99 inttypes.h. Thanks to Juan Manuel Guerrero.
2010-10-23Windows: Use MinGW's stdio functions.Lasse Collin1-0/+5
The non-standard ones from msvcrt.dll appear to work most of the time with XZ Utils, but there are some corner cases where things may go very wrong. So it's good to use the better replacements provided by MinGW(-w64) runtime.
2010-10-09Windows: Update common_w32res.rc.Lasse Collin1-6/+3
2010-09-10xz: Multiple fixes.Lasse Collin3-0/+161
The code assumed that printing numbers with thousand separators and decimal points would always produce only US-ASCII characters. This was used for buffer sizes (with snprintf(), no overflows) and aligning columns of the progress indicator and --list. That assumption was wrong (e.g. LC_ALL=fi_FI.UTF-8 with glibc), so multibyte character support was added in this commit. The old way is used if the operating system doesn't have enough multibyte support (e.g. lacks wcwidth()). The sizes of buffers were increased to accomodate multibyte characters. I don't know how big they should be exactly, but they aren't used for anything critical, so it's not too bad. If they still aren't big enough, I hopefully get a bug report. snprintf() takes care of avoiding buffer overflows. Some static buffers were replaced with buffers allocated on stack. double_to_str() was removed. uint64_to_str() and uint64_to_nicestr() now share the static buffer and test for thousand separator support. Integrity check names "None" and "Unknown-N" (2 <= N <= 15) were marked to be translated. I had forgot these, plus they wouldn't have worked correctly anyway before this commit, because printing tables with multibyte strings didn't work. Thanks to Marek Černocký for reporting the bug about misaligned table columns in --list output.
2010-09-07Fix use of N_() and ngettext().Lasse Collin1-2/+2
I had somehow thought that N_() is usually used as shorthand for ngettext(). This also fixes a missing \n from a call to ngettext().
2010-05-26Rename MIN() and MAX() to my_min() and my_max().Lasse Collin1-7/+5
This should avoid some minor portability issues.
2010-05-26Better #error message.Lasse Collin1-2/+2
2010-05-10Updates to tuklib_physmem and tuklib_cpucores.Lasse Collin2-3/+44
Don't use #error to generate compile error, because some compilers actually don't take it as an error. This fixes tuklib_physmem on IRIX. Fix incorrect error check for sysconf() return values. Add AIX, HP-UX, and Tru64 specific code to detect the amount RAM. Add HP-UX specific code to detect the number of CPU cores. Thanks a lot to Peter O'Gorman for initial patches, testing, and debugging these fixes.
2010-02-12Collection of language fixes to comments and docs.Lasse Collin2-2/+2
Thanks to Jonathan Nieder.
2010-01-27Silence two compiler warnings on DOS-like systems.Lasse Collin1-1/+5
2010-01-12Add IRIX-specific code to tuklib_physmem and tuklib_cpucores.Lasse Collin2-0/+25
This is untested but it will get tested soon and, if needed, fixed before 5.0.0. Thanks to Stuart Shelton.
2009-11-26Typo fix to sysdefs.h.Lasse Collin1-1/+1
Thanks to Jonathan Nieder.
2009-11-22Update tuklib_integer.h with bit scan functions.Lasse Collin1-8/+181
Thanks to Joachim Henke for the original patch.
2009-10-04Use a tuklib module for integer handling.Lasse Collin4-223/+357
This replaces bswap.h and integer.h. The tuklib module uses <byteswap.h> on GNU, <sys/endian.h> on *BSDs and <sys/byteorder.h> on Solaris, which may contain optimized code like inline assembly.
2009-09-27Work around a bug in Interix header files.Lasse Collin1-0/+6
Thanks to Markus Duft for the patch.
2009-09-22Avoid non-standard preprocessor construct.Lasse Collin1-4/+7
Thanks to Jouk Jansen.
2009-09-21Make sure that TUKLIB_DOSLIKE doesn't get defined on Cygwin.Lasse Collin1-1/+2
Thanks to Charles Wilson.
2009-09-19Various changes.Lasse Collin14-65/+410
Separate a few reusable components from XZ Utils specific code. The reusable code is now in "tuklib" modules. A few more could be separated still, e.g. bswap.h. Fix some bugs in lzmainfo. Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol for help. Add OpenVMS support into physmem. Add a few #ifdefs to ease building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the original patch.
2009-09-05Add OS/2-specific code to physmem.h.Lasse Collin1-11/+21
Also move DJGPP-specific code near the code meant for other DOS-like systems.
2009-09-05Use sysctl() != -1 instead of !sysctl() to check ifLasse Collin2-2/+2
the function call succeeded. NetBSD 4.0 returns positive values on success, but NetBSD Current and FreeBSD return zero. OpenBSD's man page doesn't tell what sysctl() returns on success. All these BSDs return -1 on error. Thanks to Robert Elz and Thomas Klausner.
2009-08-29Fix sysctl() usage.Lasse Collin2-2/+2
This fixes build on *BSDs and Darwin. Thanks to Jukka Salmi for the patches. Richard Koch reported the problem too.
2009-07-18Added public domain notice into a few files.Lasse Collin1-1/+8
2009-06-27Make physmem() work on Cygwin 1.5 and older.Lasse Collin1-37/+40
2009-06-27Moved the Windows resource files outside the windows directoryLasse Collin1-0/+46
to prepare for building them with Autotools.
2009-06-24Support HW_PHYSMEM64Lasse Collin1-11/+19
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin7-31/+21
Some minor documentation cleanups were made at the same time.
2009-03-18Fix wrong macro names in lc_cpucores.m4 and cpucores.h.Lasse Collin1-2/+2
Thanks to Bert Wesarg.
2009-02-15Make physmem.h work on old Windows versions.Lasse Collin1-4/+27
Thanks to Hongbo Ni for the original patch.
2009-02-14Cleanups to the code that detects the amount of RAM andLasse Collin2-8/+65
the number of CPU cores. Added support for using sysinfo() on Linux systems whose libc lacks appropriate sysconf() support (at least dietlibc). The Autoconf macros were split into separate files, and CPU core count detection was moved from hardware.c to cpucores.h. The core count isn't used for anything real for now, so a problematic part in process.c was commented out.
2009-02-13Improve support for DOS-like systems.Lasse Collin2-0/+16
Here DOS-like means DOS, Windows, and OS/2.
2009-02-08Fix aliasing issue in physmem.h.Lasse Collin1-9/+10
2009-02-05Various code cleanups the the xz command line tool.Lasse Collin1-0/+13
It now builds with MinGW.
2009-01-31Add LZMA_API to liblzma API headers. It's useful at leastLasse Collin1-2/+0
on Windows. sysdefs.h no longer #includes lzma.h, so lzma.h has to be #included separately where needed.
2009-01-07Use pthread_sigmask() instead of sigprocmask() when pthreadsLasse Collin1-0/+6
are enabled.
2008-12-31Remove lzma_init() and other init functions from liblzma API.Lasse Collin1-0/+34
Half of developers were already forgetting to use these functions, which could have caused total breakage in some future liblzma version or even now if --enable-small was used. Now liblzma uses pthread_once() to do the initializations unless it has been built with --disable-threads which make these initializations thread-unsafe. When --enable-small isn't used, liblzma currently gets needlessly linked against libpthread (on systems that have it). While it is stupid for now, liblzma will need threads in future anyway, so this stupidity will be temporary only. When --enable-small is used, different code CRC32 and CRC64 is now used than without --enable-small. This made the resulting binary slightly smaller, but the main reason was to clean it up and to handle the lack of lzma_init_check(). The pkg-config file lzma.pc was renamed to liblzma.pc. I'm not sure if it works correctly and portably for static linking (Libs.private includes -pthread or other operating system specific flags). Hopefully someone complains if it is bad. lzma_rc_prices[] is now included as a precomputed array even with --enable-small. It's just 128 bytes now that it uses uint8_t instead of uint32_t. Smaller array seemed to be at least as fast as the more bloated uint32_t array on x86; hopefully it's not bad on other architectures.
2008-11-19Oh well, big messy commit again. Some highlights:Lasse Collin3-14/+17
- Updated to the latest, probably final file format version. - Command line tool reworked to not use threads anymore. Threading will probably go into liblzma anyway. - Memory usage limit is now about 30 % for uncompression and about 90 % for compression. - Progress indicator with --verbose - Simplified --help and full --long-help - Upgraded to the last LGPLv2.1+ getopt_long from gnulib. - Some bug fixes
2008-09-11Fix a compiler error on big endian systems that don'tLasse Collin1-14/+18
support unaligned memory access.
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin2-17/+51
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
2008-06-18Update the code to mostly match the new simpler file formatLasse Collin2-0/+211
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
2008-05-11Remove support for pre-C89 libc versions that lack memcpy,Lasse Collin1-13/+2
memmove, and memset.
2008-01-16Added ARRAY_SIZE(array) macro.Lasse Collin1-0/+4
2008-01-08More pre-C99 inttypes.h compatibility fixes. Now the codeLasse Collin1-11/+0
should work even if the system has no inttypes.h.
2008-01-06Introduced compatibility with systems that have pre-C99Lasse Collin1-1/+58
or no inttypes.h. This is useful when the compiler has good enough support for C99, but libc headers don't. Changed liblzma API so that sys/types.h and inttypes.h have to be #included before #including lzma.h. On systems that don't have C99 inttypes.h, it's the problem of the applications to provide the required types and macros before #including lzma.h. If lzma.h defined the missing types and macros, it could conflict with third-party applications whose configure has detected that the types are missing and defined them in config.h already. An alternative would have been introducing lzma_uint32 and similar types, but that would just be an extra pain on modern systems.
2007-12-09Imported to git.Lasse Collin3-0/+227