From owner-freebsd-gnome@FreeBSD.ORG Thu Mar 29 09:56:52 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 E0A5816A401 for ; Thu, 29 Mar 2007 09:56:52 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.234]) by mx1.freebsd.org (Postfix) with ESMTP id 9DECF13C44B for ; Thu, 29 Mar 2007 09:56:52 +0000 (UTC) (envelope-from infofarmer@gmail.com) Received: by nz-out-0506.google.com with SMTP id r28so105458nza for ; Thu, 29 Mar 2007 02:56:51 -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:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=oo81evZmWiSgxnWK6A4KY/QXNRuS80KKPLCFX4pGtoQ8IWsFbIxiAkeuQhEwQZfHzTqITONR4EvN5BX7pO48EkgBjuerrkcJQsG6Eds23WY3WjxmCURuv4njSWkBXqu5yBYPvcR51ObKm+e//28ZVP7PydXM1BE8Df4+pPa6Ulk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=ckydOWXYOOMSmUYWDu9vh3JjfEObqcN5s0LOR1O8xLxiLH5drbCRSRCCta5TgwLvhs/0m79oPudL+R0LCP6xtL65JLjGCr95J9X2iSaqcF3+3qhJ2lmFjLa1SRJRoXUQASXefPBILSTunYQ7Gaja+w3ergumB38/0UMkF6CROvc= Received: by 10.115.77.1 with SMTP id e1mr170214wal.1175162211276; Thu, 29 Mar 2007 02:56:51 -0700 (PDT) Received: by 10.114.201.2 with HTTP; Thu, 29 Mar 2007 02:56:51 -0700 (PDT) Message-ID: Date: Thu, 29 Mar 2007 13:56:51 +0400 From: "Andrew Pantyukhin" Sender: infofarmer@gmail.com In-Reply-To: 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: 2c4f76ae5b463688 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:56:53 -0000 On 3/29/07, Andrew Pantyukhin wrote: > 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"? hmm, just a cast to (const char**) works for me. I'm not sure it's the best solution, though.