diff options
author | Russell Belfer <rb@github.com> | 2014-04-07 11:45:32 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-07 11:45:32 -0700 |
commit | c813b345503f7b086da7ca1b2d95270e00594323 (patch) | |
tree | 5886b1512228c2b651f7c646a277ebf605ec3761 /tests | |
parent | 6720eef938d7614cd7a9fd2138a27da3667d62cf (diff) | |
download | libgit2-c813b345503f7b086da7ca1b2d95270e00594323.tar.gz |
Fix bug with multiple iconv conversions in one dir
The internal buffer in the `git_path_iconv_t` structure was not
being reset before the calls to `iconv` were made to convert data,
so if there were multiple decomposed Unicode paths in a single
directory, paths after the first one were being appended to the
first instead of treated as independent data.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/iconv.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/core/iconv.c b/tests/core/iconv.c index 8aedab206..cb85f458a 100644 --- a/tests/core/iconv.c +++ b/tests/core/iconv.c @@ -39,8 +39,9 @@ void test_core_iconv__decomposed_to_precomposed(void) { #ifdef GIT_USE_ICONV 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)); GIT_UNUSED(datalen); @@ -48,6 +49,15 @@ void test_core_iconv__decomposed_to_precomposed(void) * (on platforms where iconv is enabled, of course). */ 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 } |