From owner-freebsd-gnome@FreeBSD.ORG Thu Mar 29 09:23:28 2007 Return-Path: X-Original-To: freebsd-gnome@freebsd.org Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9925D16A400 for ; Thu, 29 Mar 2007 09:23:28 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.freebsd.org (Postfix) with ESMTP id 2FAE213C484 for ; Thu, 29 Mar 2007 09:23:28 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: by ug-out-1314.google.com with SMTP id 71so466791ugh for ; Thu, 29 Mar 2007 02:23:27 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=rqLhTIBqfDNrdrdF1pPqMR0p5+fVQQ92x5NDQsAmOpzJLbh9Wmpa1abEDxMRy6csb/uIpvQFVVRy3JntfvghUlTB7K9nj3o2YLhPTGQLO/oD1KFUC8oTWPSHoidBx+MUBM8LdPdaBHK7vnREMhA/LuN8UoW4+rnEv+zB5sJWzU8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Whqi+tvwPpnQSUUzGsyS/Ijbc+fgKf7eia+v/1EiwWKcXstb6EUpQNJQ4oFuJIUPsHPHdEoJEQTmhF/mQ3BvYWtaSJ/n6zXePM++X7uj8hjrgt7/0+UBnVZ30tMfLR9jGktZwT9nxpm8k/aTasrOHoiy9v3dbd2O6L5qjNor6Ms= Received: by 10.115.47.1 with SMTP id z1mr193819waj.1175158688752; Thu, 29 Mar 2007 01:58:08 -0700 (PDT) Received: by 10.114.201.2 with HTTP; Thu, 29 Mar 2007 01:58:08 -0700 (PDT) Message-ID: Date: Thu, 29 Mar 2007 12:58:08 +0400 From: "Andrew Pantyukhin" Sender: infofarmer@gmail.com To: "Alexander Nedotsukov" In-Reply-To: <45C7F45D.4020407@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45C7F45D.4020407@FreeBSD.org> X-Google-Sender-Auth: b1118399ecc7b700 Cc: freebsd-gnome@freebsd.org Subject: Re: Need a suggest the best way to fix iconv.. X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2007 09:23:28 -0000 On 2/6/07, Alexander Nedotsukov wrote: > Jeremy Messenger wrote: > > Hello folks, > > > > I am not sure what is the best way to fix iconv. I get following build > > error: > > > > =================================== > > client/Text.cpp: In static member function `static std::string& > > Text::convert(const std::string&, std::string&, const std::string&, > > const std::string&)': > > client/Text.cpp:312: error: invalid conversion from `char**' to `const > > char**' > > client/Text.cpp:312: error: initializing argument 2 of `size_t > > libiconv(void*, const char**, size_t*, char**, size_t*)' > > =================================== > > > > The code looks like (last line is 312 line): > > > > =================================== > > size_t rv; > > size_t len = str.length() * 2; // optimization > > size_t inleft = str.length(); > > size_t outleft = len; > > tmp.resize(len); > > const char *inbuf = str.data(); > > char *outbuf = (char *)tmp.data(); > > > > while(inleft > 0) { > > rv = iconv(cd, (char **)&inbuf, &inleft, &outbuf, &outleft); > > =================================== > > > > Which should I change it to? > > > > rv = iconv(cd, (const char **)&inbuf, &inleft, &outbuf, &outleft); > > > > or > > > > rv = iconv(cd, &inbuf, &inleft, &outbuf, &outleft); > This one. And if you have a plan to send your patch back to the authors > it is better to declare inbuf as ICONV_CONST char* as well (though not > sure if their configure smart enough to define that macro. check > produced config.h to be sure). This iconv issue appears every now and again. I'm sorry to bother you guys, but any suggestions how to fix this one are welcome: ================================================== size_t inSize; char *in; if (myBuffer.empty()) { inSize = srcEnd - srcStart; in = (char*)srcStart; } else { myBuffer.append(srcStart, srcEnd - srcStart); inSize = myBuffer.length(); in = (char*)myBuffer.data(); } size_t outSize = 3 * inSize; const size_t startOutSize = outSize; size_t oldLength = dst.length(); dst.append(outSize, '\0'); char *out = (char*)dst.data() + oldLength; iconvlabel: iconv(myIConverter, &in, &inSize, &out, &outSize); ================================================== Should I add another const and initialize with "in"? Thanks!