From patchwork Wed Apr 4 13:57:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 895010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91419-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="bx4itwBu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40GSFz5YhRz9ryr for ; Wed, 4 Apr 2018 23:57:43 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= Orf+7B5rWi8zaJ7US8NVATZV7wutOb0ICsN3+nw3bWqurmV7Bunn0UNDugW/j7up 55CEEXzk4KFEFTUn0PzSDhv/WPPZcQ4JLVY0zo1SHbL4gB0zLlwgeilJivfp0hrY FX9/JbY+GfGvMs/gw2N5X61hCWsv91Fc1NcRlZddP18= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=0B0vf7 Ni3jmeUDKaFCRZcshGUV8=; b=bx4itwBueOOEsEE3HGaVyfuBZ6FfH7pRTFOHKv zX0OX84Fwy/UtxAjHa6WLQiLo9NE4wlFFJCeMPIbWwswVnXu843/e1srMIsMu7HX LQBT37BoIkzxh/Nw822n3Aaybn+ixRR90rpETPOU7yopatDzjr1K0pNuXc64mtKW 9DwAw= Received: (qmail 61258 invoked by alias); 4 Apr 2018 13:57:38 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 61140 invoked by uid 89); 4 Apr 2018 13:57:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Date: Wed, 04 Apr 2018 15:57:33 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] manual: Result of mbrtowc is a single wide character User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20180404135733.3097D406F5A23@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) 2018-04-04 Florian Weimer * manual/charset.texi (Converting a Character): Result of mbrtowc is not a string, but a single wide character. * manual/examples/mbstouwcs.c (mbstouwcs): Adjust. diff --git a/manual/charset.texi b/manual/charset.texi index 6831ebec27..b37fac4df1 100644 --- a/manual/charset.texi +++ b/manual/charset.texi @@ -643,8 +643,8 @@ and they also do not require it to be in the initial state. @cindex stateful The @code{mbrtowc} function (``multibyte restartable to wide character'') converts the next multibyte character in the string pointed -to by @var{s} into a wide character and stores it in the wide character -string pointed to by @var{pwc}. The conversion is performed according +to by @var{s} into a wide character and stores it in the location +pointed to by @var{pwc}. The conversion is performed according to the locale currently selected for the @code{LC_CTYPE} category. If the conversion for the character set used in the locale requires a state, the multibyte string is interpreted in the state represented by the @@ -690,7 +690,7 @@ checking, and sometimes leaks memory): @end smallexample The use of @code{mbrtowc} should be clear. A single wide character is -stored in @code{@var{tmp}[0]}, and the number of consumed bytes is stored +stored in @code{*@var{tmp}}, and the number of consumed bytes is stored in the variable @var{nbytes}. If the conversion is successful, the uppercase variant of the wide character is stored in the @var{result} array and the pointer to the input string and the number of available diff --git a/manual/examples/mbstouwcs.c b/manual/examples/mbstouwcs.c index 5d223da2ae..3a8b9a65f9 100644 --- a/manual/examples/mbstouwcs.c +++ b/manual/examples/mbstouwcs.c @@ -20,7 +20,7 @@ mbstouwcs (const char *s) if (nbytes >= (size_t) -2) /* Invalid input string. */ return NULL; - *wcp++ = towupper (tmp[0]); + *wcp++ = towupper (*tmp); len -= nbytes; s += nbytes; }