]>
git.proxmox.com Git - libgit2.git/blob - src/win32/utf-conv.h
6090a4b356a624eced776f3135e482ca3ccf5aa4
2 * Copyright (C) the libgit2 contributors. All rights reserved.
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
7 #ifndef INCLUDE_win32_utf_conv_h__
8 #define INCLUDE_win32_utf_conv_h__
14 #ifndef WC_ERR_INVALID_CHARS
15 # define WC_ERR_INVALID_CHARS 0x80
19 * Converts a UTF-8 string to wide characters.
21 * @param dest The buffer to receive the wide string.
22 * @param dest_size The size of the buffer, in characters.
23 * @param src The UTF-8 string to convert.
24 * @return The length of the wide string, in characters (not counting the NULL terminator), or < 0 for failure
26 int git__utf8_to_16(wchar_t *dest
, size_t dest_size
, const char *src
);
29 * Converts a wide string to UTF-8.
31 * @param dest The buffer to receive the UTF-8 string.
32 * @param dest_size The size of the buffer, in bytes.
33 * @param src The wide string to convert.
34 * @return The length of the UTF-8 string, in bytes (not counting the NULL terminator), or < 0 for failure
36 int git__utf16_to_8(char *dest
, size_t dest_size
, const wchar_t *src
);
39 * Converts a UTF-8 string to wide characters.
40 * Memory is allocated to hold the converted string.
41 * The caller is responsible for freeing the string with git__free.
43 * @param dest Receives a pointer to the wide string.
44 * @param src The UTF-8 string to convert.
45 * @return The length of the wide string, in characters (not counting the NULL terminator), or < 0 for failure
47 int git__utf8_to_16_alloc(wchar_t **dest
, const char *src
);
50 * Converts a wide string to UTF-8.
51 * Memory is allocated to hold the converted string.
52 * The caller is responsible for freeing the string with git__free.
54 * @param dest Receives a pointer to the UTF-8 string.
55 * @param src The wide string to convert.
56 * @return The length of the UTF-8 string, in bytes (not counting the NULL terminator), or < 0 for failure
58 int git__utf16_to_8_alloc(char **dest
, const wchar_t *src
);