aboutsummaryrefslogtreecommitdiff
path: root/lib/libarchive/archive_string.c
Commit message (Collapse)AuthorAgeFilesLines
* Use contrib sources for building libarchive, tar and cpio.Martin Matuska2011-12-221-453/+0
| | | | | | | | | Make "make test" fully operational. MFC after: 2 weeks Notes: svn path=/head/; revision=228797
* Sync libarchive with vendor branch release/2.8:Martin Matuska2011-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 3730: Fix issue 174 (Windows path names, not relevant for FreeBSD) 3734: Merge r1989: archive_clear_error should set errno to 0. 3735: Merge r3247 from trunk: Clear errors before returning from archive_read_support_format_all() 3799: Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string 3824: Merge r3823 from trunk for issue 199 (hang in iso9660 reading) Obtained from: http://code.google.com/p/libarchive MFC after: 2 weeks Notes: svn path=/head/; revision=228748
* Remove an unused variable and an unnecessary increment.Tim Kientzle2009-12-281-3/+1
| | | | Notes: svn path=/head/; revision=201095
* Merge from libarchive.googlecode.com: Mostly a bunch ofTim Kientzle2009-04-121-142/+149
| | | | | | | | | | | | | | | | corrections to the Windows support to reconcile differences between Visual Studio and Cygwin. Includes parts of revisions 757, 774, 787, 815, 817, 819, 820, 844, and 886. Of particular note, r886 overhauled the UTF-8/Unicode conversions to work correctly regardless of whether the local system uses 16-bit or 32-bit wchar_t. (I assume that systems with 16-bit wchar_t use UTF-16 and those with 32-bit wchar_t use UCS-4.) This revision also added a preference for wcrtomb() (which is thread-safe) on platforms that support it. Notes: svn path=/head/; revision=190959
* Merge from libarchive.googlecode.com:Tim Kientzle2009-04-121-4/+6
| | | | | | | | | | | r751: Change __archive_strncat() to use a void * source, which reduces the amount of casting needed to use this with "char", "signed char" and "unsigned char". r752: Use additions instead of multiplications when growing buffer; faster and less chance of overflow. Notes: svn path=/head/; revision=190956
* Merge r505 from libarchive.googlecode.com: Fix %ju support. SimplifyTim Kientzle2009-03-061-15/+0
| | | | | | | | | the code here a bit by making the int formatting functions static to archive_string_sprintf.c, which is the only place this has ever been used. Notes: svn path=/head/; revision=189435
* Merge r294:337,r348:350 from libarchive.googlecode.com: A lotTim Kientzle2009-03-031-0/+84
| | | | | | | of work to make libarchive work on Windows. Notes: svn path=/head/; revision=189308
* New internal archive_string_concat utility function.Tim Kientzle2008-12-061-0/+12
| | | | Notes: svn path=/head/; revision=185667
* Rework the my_mbtowc_utf8() support function to fully match the mbtowc()Tim Kientzle2008-06-151-14/+14
| | | | | | | calling convention, not the mbrtowc() convention. Notes: svn path=/head/; revision=179802
* Since wctomb() returns int, temporaries should be int, not size_t.Tim Kientzle2008-06-151-2/+2
| | | | Notes: svn path=/head/; revision=179801
* Fix a bad cast.Tim Kientzle2008-06-151-1/+1
| | | | Notes: svn path=/head/; revision=179797
* Portability: We can get away with the older and better-supportedTim Kientzle2008-06-151-33/+23
| | | | | | | | wctomb() here; we don't need wcrtomb(). In particular, this fixes libarchive building on FreeBSD 4. Notes: svn path=/head/; revision=179792
* MFp4: libarchive 2.5.4b. (Still 'b' until I get a bit moreTim Kientzle2008-05-261-7/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | feedback, but the 2.5 branch is shaping up nicely.) In addition to many small bug fixes and code improvements: * Another iteration of versioning; I think I've got it right now. * Portability: A lot of progress on Windows support (though I'm not committing all of the Windows support files to FreeBSD CVS) * Explicit tracking of MBS, WCS, and UTF-8 versions of strings in archive_entry; the archive_entry routines now correctly return NULL only when something is unset, setting NULL properly clears string values. Most charset conversions have been pushed down to archive_string. * Better handling of charset conversion failure when writing or reading UTF-8 headers in pax archives * archive_entry_linkify() provides multiple strategies for hardlink matching to suit different format expectations * More accurate bzip2 format detection * Joerg Sonnenberger's extensive improvements to mtree support * Rough support for self-extracting ZIP archives. Not an ideal approach, but it works for the archives I've tried. * New "sparsify" option in archive_write_disk converts blocks of nulls into seeks. * Better default behavior for the test harness; it now reports all failures by default instead of coredumping at the first one. Notes: svn path=/head/; revision=179321
* archive_string_ensure() used to call exit(3) if itTim Kientzle2007-07-151-5/+6
| | | | | | | | | | | | | couldn't allocate more memory for a string. Change this so it returns NULL in that case, and update all of its callers to handle the error. Some of those callers can now return errors back to the client instead of calling exit(3). Approved by: re (bmah) Notes: svn path=/head/; revision=171460
* libarchive 2.2.3Tim Kientzle2007-05-291-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * "compression_program" support uses an external program * Portability: no longer uses "struct stat" as a primary data interchange structure internally * Part of the above: refactor archive_entry to separate out copy_stat() and stat() functions * More complete tests for archive_entry * Finish archive_entry_clone() * Isolate major()/minor()/makedev() in archive_entry; remove these from everywhere else. * Bug fix: properly handle decompression look-ahead at end-of-data * Bug fixes to 'ar' support * Fix memory leak in ZIP reader * Portability: better timegm() emulation in iso9660 reader * New write_disk flags to suppress auto dir creation and not overwrite newer files (for future cpio front-end) * Simplify trailing-'/' fixup when writing tar and pax * Test enhancements: fix various compiler warnings, improve portability, add lots of new tests. * Documentation: document new functions, first draft of libarchive_internals.3 MFC after: 14 days Thanks to: Joerg Sonnenberger (compression_program) Thanks to: Kai Wang (ar) Thanks to: Colin Percival (many small fixes) Thanks to: Many others who sent me various patches and problem reports. Notes: svn path=/head/; revision=170079
* Correct the int->text conversion. <sigh>Tim Kientzle2007-01-131-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=165993
* Fix the copyright notice; it was always intended to beTim Kientzle2007-01-091-3/+2
| | | | | | | | | | | | a vanilla 2-clause BSD license, but somehow some confusing extra verbage get copied from somewhere. Also, update the copyright dates to 2007 for all of the files. Prompted by: several questions about what those extra words really mean Notes: svn path=/head/; revision=165912
* Portability and style fixes:Tim Kientzle2006-11-101-1/+5
| | | | | | | | | | | | | | | | | * Actually use the HAVE_<header>_H macros to conditionally include system headers. They've been defined for a long time, but only used in a few places. Now they're used pretty consistently throughout. * Fill in a lot of missing casts for conversions from void*. Although Standard C doesn't require this, some people have been trying to use C++ compilers with this code, and they do require it. Bit-for-bit, the compiled object files are identical, except for one assert() whose line number changed, so I'm pretty confident I didn't break anything. ;-) Notes: svn path=/head/; revision=164142
* Add __archive_strappend_int to format a decimalTim Kientzle2004-12-221-0/+15
| | | | | | | number into a variable-length archive_string. Notes: svn path=/head/; revision=139162
* Eliminate reliance on non-portable <err.h> by implementing a veryTim Kientzle2004-08-141-2/+4
| | | | | | | | | | simple errx() function. Improve behavior when bzlib/zlib are missing by detecting and issuing an error message on attempts to read gzip/bzip2 compressed archives. Notes: svn path=/head/; revision=133710
* More work on ACLs: fix error in archive_entry's ACL parsing code,Tim Kientzle2004-04-121-3/+0
| | | | | | | | | | | | | | | | | try to set ACLs even if fflag restore fails, first cut at reading Solaris tar ACLs Code improvement: merge gnu tar read support into main tar reader; this eliminates a lot of duplicate code and generalizes the tar reader to handle formats with GNU-like extensions. Style: Makefile cleanup, eliminate 'dmalloc' references, remove 'tartype' from archive_entry (this makes archive_entry more format-agnostic) Thanks to: David Magda for providing Solaris tar test files Notes: svn path=/head/; revision=128148
* Many fixes:Tim Kientzle2004-03-191-47/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Disabled shared-library building, as some API breakage is still likely. (I didn't realize it was turned on by default.) If you have an existing /usr/lib/libarchive.so.2, I recommend deleting it. * Pax interchange format now correctly stores and reads UTF8 for extended attributes. In particular, pax format can portably handle arbitrarily long pathnames containing arbitrary characters. * Library compiles cleanly at -O2, -O3, and WARNS=6 on all FreeBSD-CURRENT platforms. * Minor portability improvements inspired by Juergen Lock and Greg Lewis. (Less reliance on stdint.h, isolating of various portability-challenged constructs.) * archive_entry transparently converts multi-byte <-> wide character strings, allowing clients and format handlers to deal with either one, as appropriate. * Support for reading 'L' and 'K' entries in standard tar archives for star compatibility. * Recognize (but don't yet handle) ACL entries from Solaris tar. * Pushed format-specific data for format readers down into format-specific storage and out of library-global storage. This should make it easier to maintain individual formats without mucking with the core library management. * Documentation updates to track the above changes. * Updates to tar.5 to correct a few mistakes and add some additional information about GNU tar and Solaris tar formats. Notes: * The basic 'tar' reader is getting more general; there's not much point in keeping the 'gnutar' reader separate. Merging the two would lose a bunch of duplicate code. * The libc ACL support is looking increasingly inadequate for my needs here. I might need to assemble some fairly significant code for parsing and building ACLs. <sigh> Notes: svn path=/head/; revision=127212
* Many fixes.Tim Kientzle2004-03-091-2/+2
| | | | | | | | | | | | | | | | | | | Portability: Thanks to Juergen Lock, libarchive now compiles cleanly on Linux. Along the way, I cleaned up a lot of error return codes and reorganized some code to simplify conditional compilation of certain sections. Bug fixes: * pax format now actually stores filenames that are 101-154 characters long. * pax format now allows newline characters in extended attributes (this fixes a long-standing bug in ACL handling) * mtime/atime are now restored for directories * directory list is now sorted prior to fix-up to permit correct restore of non-writable dir heirarchies Notes: svn path=/head/; revision=126782
* Initial import of libarchive.Tim Kientzle2004-02-091-0/+146
What it is: A library for reading and writing various streaming archive formats, especially tar and cpio. Being a library, it should be easy to incorporate into pkg_* tools, sysinstall, and any other place that needs to read or write such archives. Features: * Full automatic detection of both compression and archive format. * Extensible internal architecture to make it easy to add new formats. * Support for "pax interchange format," a new POSIX-standard tar format that eliminates essentially all of the restrictions of historic formats. * BSD license Thanks to: jkh for pushing me to start this work, gordon for encouraging me to commit it, bde for answering endless style questions, and many others for feedback and encouragement. Status: Pretty good overall, though there are still a few rough edges and the library could always use more testing. Feedback eagerly solicited. Notes: svn path=/head/; revision=125635