summaryrefslogtreecommitdiff
path: root/src/win32/utf-conv.c
Commit message (Collapse)AuthorAgeFilesLines
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* win32: drop xp support in WideCharToMultiByteEdward Thomson2016-02-091-18/+3
|
* git_buf_put_w: introduce utf16->utf8 conversionEdward Thomson2015-05-011-4/+0
|
* git__*allocarray: safer realloc and mallocEdward Thomson2015-02-121-2/+1
| | | | | | | | Introduce git__reallocarray that checks the product of the number of elements and element size for overflow before allocation. Also introduce git__mallocarray that behaves like calloc, but without the `c`. (It does not zero memory, for those truly worried about every cycle.)
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-3/+2
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* win32: use NT-prefixed "\\?\" pathsEdward Thomson2014-12-161-6/+36
| | | | | | | | | | | | When turning UTF-8 paths into UCS-2 paths for Windows, always use the \\?\-prefixed paths. Because this bypasses the system's path canonicalization, handle the canonicalization functions ourselves. We must: 1. always use a backslash as a directory separator 2. only use a single backslash between directories 3. not rely on the system to translate "." and ".." in paths 4. remove trailing backslashes, except at the drive root (C:\)
* React to feedback for UTF-8 <-> WCHAR and reparse workPhilip Kelley2014-04-231-9/+1
|
* Win32: UTF-8 <-> WCHAR conversion overhaulPhilip Kelley2014-04-191-3/+130
|
* Remove unused utf8 -> utf16 conversion codeEdward Thomson2014-02-051-62/+0
|
* Fix 64-bit MSVC warningsBen Straub2013-08-101-2/+2
|
* Discriminate path-specific and general UTF-X conversionsBen Straub2013-08-081-4/+4
|
* Rename git_win_str_utf* to git_win32_path_utf*Ben Straub2013-08-071-2/+2
|
* Add typedefs for win32 utf-8 and utf-16 buffersBen Straub2013-08-071-4/+4
| | | | ...and normalize the signatures of the two conversion functions.
* Split UTF-16 and UTF-8 buffer sizes for win32Ben Straub2013-08-051-1/+1
| | | | | Also fixed up call-sites to use the correct buffer sizes, especially when converting to utf-8.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Add POSIX compat lstat() variant for win32Russell Belfer2012-11-141-4/+4
| | | | | | | | | | The existing p_lstat implementation on win32 is not quite POSIX compliant when setting errno to ENOTDIR. This adds an option to make is be compliant so that code (such as checkout) that cares to have separate behavior for ENOTDIR can use it portably. This also contains a couple of other minor cleanups in the posix_w32.c implementations to avoid unnecessary work.
* Fix MSVC amd64 compilation warningsnulltoken2012-09-201-1/+1
|
* Add bounds checking to UTF-8 conversionutf8-winVicent Marti2012-08-281-43/+18
|
* windows: Keep UTF-8 on the stack yoVicent Marti2012-08-281-83/+5
|
* UTF-8 changes yoVicent Martí2012-08-281-0/+92
|
* Fix bugs in UTF-8 <-> UTF-16 conversionRussell Belfer2012-05-241-13/+10
| | | | | | | | | | | | The function to convert UTF-16 to UTF-8 was only allocating a buffer of wcslen(utf16str) bytes for the UTF-8 string, but that is not sufficient if you have multibyte characters, and so when those occured, the conversion was failing. This updates the conversion functions to use the Win APIs to calculate the correct buffer lengths. Also fixes a comparison in the unit tests that would fail if you did not have a particular environment variable set.
* Merge remote-tracking branch 'scottjg/fix-mingw32' into developmentVicent Martí2012-05-051-0/+1
|\ | | | | | | | | | | | | | | Conflicts: src/netops.c src/netops.h src/transports/http.c tests-clar/clar
| * Fix missing prototype warning in utf-conv.cScott J. Goldman2012-05-051-0/+1
| |
* | Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-20/+11
| | | | | | | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* | Continue error conversionRussell Belfer2012-03-141-5/+15
|/ | | | | | | This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Add support for macros and cache flush API.Russell Belfer2011-12-291-0/+5
| | | | | | | | | | | | | | Add support for git attribute macro definitions. Also, add support for cache flush API to clear the attribute file content cache when needed. Additionally, improved the handling of global and system files, making common utility functions in fileops and converting config and attr to both use the common functions. Adds a bunch more tests and fixed some memory leaks. Note that adding macros required me to use refcounted attribute assignment definitions, which complicated, but probably improved memory usage.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-2/+2
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* windows: Add support for non-UTF codepagesVicent Marti2011-10-261-0/+88
Our previous assumption that all paths in Windows are encoded in UTF-8 is rather weak, specially when considering that Git is encoding-agnostic. These set of functions allow the user to change the library's active codepage globally, so it is possible to access paths and files on all international versions of Windows. Note that the default encoding here is UTF-8 because we assume that 99% of all Git repositories will be in UTF-8. Also, if you use non-ascii characters in paths, anywhere, please burn on a fire.