Subject: Re: [PATCH v2 07/12] utf8: keep NULs in reencode_string()

From: Torsten Bögershausen <[email-masked]>
Date: Sat, 30 Mar 2013 18:06:26 +0100

On 30.03.13 10:35, Nguyễn Thái Ngọc Duy wrote:
[...]
The short version of a review:
Would it make sense to leave  reencode_string() as it is,
and add a new function reencode_string_len()

+char *reencode_string_len(const char *in, int insz,
+		      const char *out_encoding, const char *in_encoding,
+		      int *outsz)

And I didn't manage to apply the patch on master (631bc94e67383b66da190550866566f09d32)
is there a specific commitID it should be applied on ?

/Torsten

> pretty output, which can contain NULs.
> -		reencoded = reencode_string(message, "UTF-8", encoding);
> +		reencoded = reencode_string(message, strlen(message),
> +					    "UTF-8", encoding, NULL);

> -	out = reencode_string(line->buf, metainfo_charset, charset);
> +	out = reencode_string(line->buf, line->len,
> +			      metainfo_charset, charset, NULL);

> -			newarg = reencode_string_iconv(oldarg, namelen, ic_precompose);
> +			newarg = reencode_string_iconv(oldarg, namelen, ic_precompose, NULL);
> -		char *reencoded = reencode_string(msg, output_encoding, utf8);

> +		char *reencoded = reencode_string(msg, strlen(msg),
> +						  output_encoding, utf8,
> +						  NULL);

> -		out = reencode_string(msg, output_encoding, use_encoding);
> +		out = reencode_string(msg, strlen(msg),
> +				      output_encoding, use_encoding, NULL);

> -		out->reencoded_message = reencode_string(commit->buffer,
> -					git_commit_encoding, encoding);
> +		out->reencoded_message =
> +			reencode_string(commit->buffer, strlen(commit->buffer),
> +					git_commit_encoding, encoding, NULL);

>  
> +char *reencode_string_len(const char *in, int insz,
> +		      const char *out_encoding, const char *in_encoding,
> +		      int *outsz)
>