search for: outalloc

Displaying 20 results from an estimated 27 matches for "outalloc".

2018 Feb 28
0
[PATCH v3 1/2] common: extract UTF-8 conversion function
...rse_nonstandard_uri (const char *arg) return ret; } - -/* Would be const, but the interface to iconv is not const-correct on - * all platforms. The input string is not touched. - */ -static char * -local_string_to_utf8 (/* const */ char *input) -{ - iconv_t ic; - size_t len, inlen, outlen, outalloc, r, prev; - int err; - char *out, *inp, *outp; - - /* Convert from input locale to UTF-8. */ - ic = iconv_open ("UTF-8", nl_langinfo (CODESET)); - if (ic == (iconv_t) -1) - return NULL; - - len = strlen (input); - outalloc = len; /* Initial guess. */ - - again: -...
2010 Jul 22
0
Fwd: [PATCH hivex] non-ASCII characters in node names
...iconv_wrapper (iconv_t ic, char *input, size_t len) { - iconv_t ic = iconv_open ("UTF-8", "UTF-16"); - if (ic == (iconv_t) -1) - return NULL; - - /* iconv(3) has an insane interface ... */ - - /* Mostly UTF-8 will be smaller, so this is a good initial guess. */ size_t outalloc = len; - - again:; - size_t inlen = len; - size_t outlen = outalloc; - char *out = malloc (outlen + 1); - if (out == NULL) { - int err = errno; - iconv_close (ic); - errno = err; - return NULL; - } - char *inp = input; - char *outp = out; - - size_t r = iconv (ic, &inp, &amp...
2018 Feb 28
2
[PATCH v3 0/2] inspect: basic UTF-8 encoding for rpm
Diff to v2: * inlined local_string_to_utf8 Cédric Bosdonnat (2): common: extract UTF-8 conversion function inspector: rpm summary and description may not be utf-8 common/utils/guestfs-utils.h | 11 +++++ common/utils/libxml2-utils.c | 69 +-------------------------- common/utils/utils.c | 64 +++++++++++++++++++++++++
2018 Feb 15
3
[PATCH v2 0/2] inspect: basic UTF-8 encoding for rpm
This needs Richard's patch: https://www.redhat.com/archives/libguestfs/2018-February/msg00099.html Diff to v1: * factorized the UTF-8 conversion functions * small style fixes Cédric Bosdonnat (2): common: extract UTF-8 conversion function inspector: rpm summary and description may not be utf-8 common/utils/guestfs-utils.h | 1 + common/utils/libxml2-utils.c
2018 Feb 09
3
[PATCH] Add a cache for iconv_t handles to hive_t
...t *output_len) +_hivex_recode (hive_h *h, recode_type t, + const char *input, size_t input_len, size_t *output_len) { - iconv_t ic = iconv_open (output_encoding, input_encoding); - if (ic == (iconv_t) -1) - return NULL; - /* iconv(3) has an insane interface ... */ size_t outalloc = input_len; + iconv_t *ic = _hivex_get_iconv (h, t); again:; size_t inlen = input_len; size_t outlen = outalloc; char *out = malloc (outlen + 1); if (out == NULL) { int err = errno; - iconv_close (ic); + _hivex_release_iconv (h, t); errno = err; return NULL;...
2009 Nov 03
1
[PATCH libguestfs] hivex: fail upon integer overflow
...index b522ccf..9c28679 100644 --- a/hivex/hivex.c +++ b/hivex/hivex.c @@ -1031,9 +1031,12 @@ windows_utf16_to_utf8 (/* const */ char *input, size_t len) size_t r = iconv (ic, &inp, &inlen, &outp, &outlen); if (r == (size_t) -1) { if (errno == E2BIG) { + size_t prev = outalloc; /* Try again with a larger output buffer. */ free (out); outalloc *= 2; + if (outalloc < prev) + return NULL goto again; } else { -- 1.6.5.2.292.g1cda2
2018 Feb 15
0
[PATCH] Introduce a wrapper around xmlParseURI.
...rrno = EINVAL; + return NULL; + } + + return ret; +} + +/* Would be const, but the interface to iconv is not const-correct on + * all platforms. The input string is not touched. + */ +static char * +local_string_to_utf8 (/* const */ char *input) +{ + iconv_t ic; + size_t len, inlen, outlen, outalloc, r, prev; + int err; + char *out, *inp, *outp; + + /* Convert from input locale to UTF-8. */ + ic = iconv_open ("UTF-8", nl_langinfo (CODESET)); + if (ic == (iconv_t) -1) + return NULL; + + len = strlen (input); + outalloc = len; /* Initial guess. */ + + again: +...
2013 Nov 24
4
[PATCH 1/3] lib: Further generalize iconv wrapper function.
...t_len, + char *output_encoding, size_t *output_len) { - iconv_t ic = iconv_open ("UTF-8", input_encoding); + iconv_t ic = iconv_open (output_encoding, input_encoding); if (ic == (iconv_t) -1) return NULL; /* iconv(3) has an insane interface ... */ - size_t outalloc = len; + size_t outalloc = input_len; again:; - size_t inlen = len; + size_t inlen = input_len; size_t outlen = outalloc; char *out = malloc (outlen + 1); if (out == NULL) { @@ -79,6 +80,8 @@ _hivex_to_utf8 (/* const */ char *input, size_t len, char* input_encoding) *outp = ...
2019 Jan 22
2
[PATCH] lib: Reset errno to zero to avoid erroneously returning E2BIG
...lib/utf16.c index e099548..67fa996 100644 --- a/lib/utf16.c +++ b/lib/utf16.c @@ -58,6 +58,7 @@ _hivex_recode (hive_h *h, recode_type t, /* Reset errno here because we don't want to accidentally * return E2BIG to a library caller. */ + errno = 0; size_t prev = outalloc; /* Try again with a larger output buffer. */ free (out); -- 2.7.4
2018 Nov 02
0
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
...rrno = EINVAL; + return NULL; + } + + return ret; +} + +/* Would be const, but the interface to iconv is not const-correct on + * all platforms. The input string is not touched. + */ +static char * +local_string_to_utf8 (/* const */ char *input) +{ + iconv_t ic; + size_t len, inlen, outlen, outalloc, r, prev; + int err; + char *out, *inp, *outp; + + /* Convert from input locale to UTF-8. */ + ic = iconv_open ("UTF-8", nl_langinfo (CODESET)); + if (ic == (iconv_t) -1) + return NULL; + + len = strlen (input); + outalloc = len; /* Initial guess. */ + + again: +...
2017 Dec 12
1
[PATCH] Introduce a wrapper around xmlParseURI.
An alternate solution to: https://www.redhat.com/archives/libguestfs/2017-December/msg00035.html "[PATCH] v2v: -i vmx: Allow ssh URLs to use spaces." is to classify all URLs processed by libguestfs as either ordinary URLs or the special non-standard URLs that we use for things like ‘virt-v2v -i vmx’ and ‘guestfish --add’. For the non-standard URLs, provide a wrapper around
2018 Feb 09
0
Re: [PATCH] Add a cache for iconv_t handles to hive_t
...ode_type t, > + const char *input, size_t input_len, size_t *output_len) > { > - iconv_t ic = iconv_open (output_encoding, input_encoding); > - if (ic == (iconv_t) -1) > - return NULL; > - > /* iconv(3) has an insane interface ... */ > > size_t outalloc = input_len; > > + iconv_t *ic = _hivex_get_iconv (h, t); > again:; > size_t inlen = input_len; > size_t outlen = outalloc; > char *out = malloc (outlen + 1); > if (out == NULL) { > int err = errno; > - iconv_close (ic); > + _hivex_release_i...
2018 Nov 02
2
[PATCH REPOST] Introduce a wrapper around xmlParseURI.
Previously posted: https://www.redhat.com/archives/libguestfs/2017-December/msg00046.html Rich.
2018 Feb 09
2
[PATCH] Add a cache for iconv_t handles to hive_t
...t *output_len) +_hivex_recode (hive_h *h, recode_type t, + const char *input, size_t input_len, size_t *output_len) { - iconv_t ic = iconv_open (output_encoding, input_encoding); - if (ic == (iconv_t) -1) - return NULL; - /* iconv(3) has an insane interface ... */ size_t outalloc = input_len; + iconv_t *ic = _hivex_get_iconv (h, t); again:; size_t inlen = input_len; size_t outlen = outalloc; char *out = malloc (outlen + 1); if (out == NULL) { int err = errno; - iconv_close (ic); + _hivex_release_iconv (h, t); errno = err; return NULL;...
2017 Aug 09
0
[PATCH v12 04/11] New API: Deprecate hivex_value_utf8 and replace with hivex_value_string.
...f16_to_utf8 (/* const */ char *input, size_t len) -{ - iconv_t ic = iconv_open ("UTF-8", "UTF-16LE"); - if (ic == (iconv_t) -1) - return NULL; - - /* iconv(3) has an insane interface ... */ - - /* Mostly UTF-8 will be smaller, so this is a good initial guess. */ - size_t outalloc = len; - - again:; - size_t inlen = len; - size_t outlen = outalloc; - char *out = malloc (outlen + 1); - if (out == NULL) { - int err = errno; - iconv_close (ic); - errno = err; - return NULL; - } - char *inp = input; - char *outp = out; - - const size_t r = - iconv (ic, (IC...
2019 Jan 22
0
Re: [PATCH] lib: Reset errno to zero to avoid erroneously returning E2BIG
...4 > --- a/lib/utf16.c > +++ b/lib/utf16.c > @@ -58,6 +58,7 @@ _hivex_recode (hive_h *h, recode_type t, > /* Reset errno here because we don't want to accidentally > * return E2BIG to a library caller. > */ > + errno = 0; > size_t prev = outalloc; > /* Try again with a larger output buffer. */ > free (out); Sorry about that. I've pushed your fix now. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora...
2013 Nov 22
0
[PATCH 3/3] Correctly handle latin1-encoded key/value names
...ic = iconv_open ("UTF-8", "UTF-16LE"); + iconv_t ic = iconv_open ("UTF-8", input_encoding); if (ic == (iconv_t) -1) return NULL; /* iconv(3) has an insane interface ... */ - /* Mostly UTF-8 will be smaller, so this is a good initial guess. */ size_t outalloc = len; again:; diff --git a/lib/value.c b/lib/value.c index 66cde48..3460a8c 100644 --- a/lib/value.c +++ b/lib/value.c @@ -215,12 +215,7 @@ hivex_value_key (hive_h *h, hive_value_h value) return NULL; size_t flags = le16toh (vk->flags); if (flags & 0x01) { - char *ret = ma...
2019 Jan 22
2
Re: [PATCH] lib: Reset errno to zero to avoid erroneously returning E2BIG
...+++ b/lib/utf16.c > > @@ -58,6 +58,7 @@ _hivex_recode (hive_h *h, recode_type t, > > /* Reset errno here because we don't want to accidentally > > * return E2BIG to a library caller. > > */ > > + errno = 0; > > size_t prev = outalloc; > > /* Try again with a larger output buffer. */ > > free (out); > > Sorry about that. I've pushed your fix now. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and vi...
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...+ + return 0; +} + +static const char lfn_encoding[] = + "UTF-16LE" +#ifdef __GNU_LIBRARY__ + "//TRANSLIT" +#endif + ; + +static int +convert_to_utf16le (const char *name, char **out, size_t *output_len) +{ + iconv_t ic; + const size_t input_len = strlen (name); + size_t outalloc, inlen, outlen, prev, r; + const char *inp; + char *outp; + + /* XXX Assumes locale is UTF-8. */ + ic = iconv_open (lfn_encoding, "UTF-8"); + if (ic == (iconv_t)-1) { + nbdkit_error ("iconv: %m"); + return -1; + } + outalloc = input_len; + + again: + inlen = input_...
2012 Aug 29
5
[PATCH 0/4] Add hivex APIs into the libguestfs API (RHBZ#852394)
This adds most of the hivex APIs directly to the libguestfs API, so that you can read and write Windows Registry hive files from libguestfs without needing to download and upload hive files from the guest. This is analogous to how Augeas APIs are exposed already (guestfs_aug_*) Also, inspection is now done using the new APIs, which fixes the following bug: