mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-07 15:37:46 +00:00
Merge pull request #2255 from libgit2/rb/fix-multiple-nfd-iconv-bug
Fix bug with multiple iconv conversions in one dir
This commit is contained in:
commit
5f74c47693
@ -782,6 +782,8 @@ int git_path_iconv(git_path_iconv_t *ic, char **in, size_t *inlen)
|
|||||||
!git_path_has_non_ascii(*in, *inlen))
|
!git_path_has_non_ascii(*in, *inlen))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
git_buf_clear(&ic->buf);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (git_buf_grow(&ic->buf, wantlen + 1) < 0)
|
if (git_buf_grow(&ic->buf, wantlen + 1) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -39,8 +39,9 @@ void test_core_iconv__decomposed_to_precomposed(void)
|
|||||||
{
|
{
|
||||||
#ifdef GIT_USE_ICONV
|
#ifdef GIT_USE_ICONV
|
||||||
char *data = nfd;
|
char *data = nfd;
|
||||||
size_t datalen = strlen(nfd);
|
size_t datalen, nfdlen = strlen(nfd);
|
||||||
|
|
||||||
|
datalen = nfdlen;
|
||||||
cl_git_pass(git_path_iconv(&ic, &data, &datalen));
|
cl_git_pass(git_path_iconv(&ic, &data, &datalen));
|
||||||
GIT_UNUSED(datalen);
|
GIT_UNUSED(datalen);
|
||||||
|
|
||||||
@ -48,6 +49,15 @@ void test_core_iconv__decomposed_to_precomposed(void)
|
|||||||
* (on platforms where iconv is enabled, of course).
|
* (on platforms where iconv is enabled, of course).
|
||||||
*/
|
*/
|
||||||
cl_assert_equal_s(nfc, data);
|
cl_assert_equal_s(nfc, data);
|
||||||
|
|
||||||
|
/* should be able to do it multiple times with the same git_path_iconv_t */
|
||||||
|
data = nfd; datalen = nfdlen;
|
||||||
|
cl_git_pass(git_path_iconv(&ic, &data, &datalen));
|
||||||
|
cl_assert_equal_s(nfc, data);
|
||||||
|
|
||||||
|
data = nfd; datalen = nfdlen;
|
||||||
|
cl_git_pass(git_path_iconv(&ic, &data, &datalen));
|
||||||
|
cl_assert_equal_s(nfc, data);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user