threads / patch / 21866

patchCast &cp to eliminate a compile-time warning on FreeBSD 8-STABLE.

Subject: [PATCH] Cast &cp to eliminate a compile-time warning on FreeBSD 8-STABLE.

## tl;dr

3 messages between Dec 4, 2009 and Dec 5, 2009. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

James P. Howard, II· Dec 4, 2009, 23:12 UTC · lore
Signed-off-by: James P. Howard, II <jh@jameshoward.us>
---
 utf8.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to utf8.c +1 −1
diff --git a/utf8.c b/utf8.c
index 7ddff23..a6cc280 100644
--- a/utf8.c
+++ b/utf8.c
@@ -449,7 +449,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
 	cp = (iconv_ibp)in;
 
 	while (1) {
-		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
+		size_t cnt = iconv(conv, (const char **)&cp, &insz, &outpos, &outsz);
 
 		if (cnt == -1) {
 			size_t sofar;
-- 
1.6.5.3
Jeff King· Dec 5, 2009, 16:14 UTC · re: James P. Howard, II · lore

Re: [PATCH] Cast &cp to eliminate a compile-time warning on FreeBSD 8-STABLE.

On Fri, Dec 04, 2009 at 06:12:02PM -0500, James P. Howard, II wrote:
Show 11 quoted lines
> --- a/utf8.c
> +++ b/utf8.c
> @@ -449,7 +449,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
>  	cp = (iconv_ibp)in;
>  
>  	while (1) {
> -		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
> +		size_t cnt = iconv(conv, (const char **)&cp, &insz, &outpos, &outsz);
>  
>  		if (cnt == -1) {
>  			size_t sofar;

Aren't you now introducing a warning for all of the other platforms which take a "char **"? Should you instead just be building with OLD_ICONV=Yes on your platform? See commit fd547a9 for details.

-Peff
James P. Howard, II· Dec 5, 2009, 23:03 UTC · re: Jeff King · lore

Re: [PATCH] Cast &cp to eliminate a compile-time warning on FreeBSD 8-STABLE.

On Sat, Dec 05, 2009 at 11:14:05AM -0500, Jeff King wrote:
Show 17 quoted lines
> On Fri, Dec 04, 2009 at 06:12:02PM -0500, James P. Howard, II wrote:
> 
> > --- a/utf8.c
> > +++ b/utf8.c
> > @@ -449,7 +449,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
> >  	cp = (iconv_ibp)in;
> >  
> >  	while (1) {
> > -		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
> > +		size_t cnt = iconv(conv, (const char **)&cp, &insz, &outpos, &outsz);
> >  
> >  		if (cnt == -1) {
> >  			size_t sofar;
> 
> Aren't you now introducing a warning for all of the other platforms
> which take a "char **"? Should you instead just be building with
> OLD_ICONV=Yes on your platform? See commit fd547a9 for details.

Yes, and it was brought to my attention within 10 minutes of my first post.

James
-- 
James P. Howard, II, MPA MBCS
jh@jameshoward.us

← back to recent threads