summaryrefslogtreecommitdiff
path: root/src/buf_text.c
Commit message (Collapse)AuthorAgeFilesLines
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-10/+12
| | | | | | | | | Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
* git_buf_grow_by: increase buf asize incrementallyEdward Thomson2015-02-121-9/+4
| | | | | Introduce `git_buf_grow_by` to incrementally increase the size of a `git_buf`, performing an overflow calculation on the growth.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-1/+11
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* Make binary detection work similar to vanilla gitSven Strickroth2015-01-201-1/+4
| | | | | | Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files) Signed-off-by: Sven Strickroth <email@cs-ware.de>
* text: Null-terminate a string if we've been gouging itvmg/attr-nullVicent Marti2014-11-211-0/+1
|
* crlf: pass-through mixed EOL buffers from LF->CRLFcmn/mixed-eol-passthroughCarlos Martín Nieto2014-06-231-5/+9
| | | | | | | | | | When checking out files, we're performing conversion into the user's native line endings, but we only want to do it for files which have consistent line endings. Refuse to perform the conversion for mixed-EOL files. The CRLF->LF filter is left as-is, as that conversion is considered to be normalization by git and should force a conversion of the line endings.
* Fix longstanding valgrind warningRussell Belfer2013-09-171-1/+1
| | | | | There was a possible circumstance that could result in reading past the end of a buffer. This check fixes that.
* Start of filter API + git_blob_filtered_contentRussell Belfer2013-09-171-7/+12
| | | | | | | | | | This begins the process of exposing git_filter objects to the public API. This includes: * new public type and API for `git_buffer` through which an allocated buffer can be passed to the user * new API `git_blob_filtered_content` * make the git_filter type and GIT_FILTER_TO_... constants public
* Skip UTF-8 BOM in binary detectionEdward Thomson2013-08-191-0/+6
| | | | | | | | When a git_buf contains a UTF-8 BOM, the three bytes comprising that BOM are treated as unprintable characters. For a small git_buf, the three BOM characters overwhelm the printable characters. This is problematic when trying to check out a small file as the CR/LF filtering will not apply.
* Fix the initial linecrazymaster2013-07-151-23/+18
|
* Fix gather_statscrazymaster2013-07-141-18/+23
|
* Move crlf conversion into buf_textautocrlf-fixesRussell Belfer2013-03-251-0/+77
| | | | | | | | | | | | | | This adds crlf/lf conversion functions into buf_text with more efficient implementations that bypass the high level buffer functions. They attempt to minimize the number of reallocations done and they directly write the buffer data as needed if they know that there is enough memory allocated to memcpy data. Tests are added for these new functions. The crlf.c code is updated to use the new functions. Removed the include of buf_text.h from filter.h and just include it more narrowly in the places that need it.
* buf: Is this the function you were looking for?Vicent Marti2013-01-121-1/+1
|
* Match binary file check of core git in diffRussell Belfer2013-01-111-0/+5
| | | | | | | | | Core git just looks for NUL bytes in files when deciding about is-binary inside diff (although it uses a better algorithm in checkout, when deciding if CRLF conversion should be done). Libgit2 was using the better algorithm in both places, but that is causing some confusion. For now, this makes diff just look for NUL bytes to decide if a file is binary by content in diff.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* buf test: make sure we always set the bom variableCarlos Martín Nieto2012-11-301-0/+1
|
* Consolidate text buffer functionsRussell Belfer2012-11-281-0/+208
There are many scattered functions that look into the contents of buffers to do various text manipulations (such as escaping or unescaping data, calculating text stats, guessing if content is binary, etc). This groups all those functions together into a new file and converts the code to use that. This has two enhancements to existing functionality. The old text stats function is significantly rewritten and the BOM detection code was extended (although largely we can't deal with anything other than a UTF8 BOM).