From owner-svn-src-all@freebsd.org Fri May 20 19:37:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B3B0B44A7C; Fri, 20 May 2016 19:37:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F18401DEF; Fri, 20 May 2016 19:37:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4KJbl2N024878; Fri, 20 May 2016 19:37:47 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4KJbltb024877; Fri, 20 May 2016 19:37:47 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201605201937.u4KJbltb024877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 20 May 2016 19:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300328 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2016 19:37:48 -0000 Author: imp Date: Fri May 20 19:37:46 2016 New Revision: 300328 URL: https://svnweb.freebsd.org/changeset/base/300328 Log: Cleanup to use %S. Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Fri May 20 19:30:52 2016 (r300327) +++ head/sys/boot/efi/loader/main.c Fri May 20 19:37:46 2016 (r300328) @@ -75,20 +75,6 @@ EFI_GUID inputid = SIMPLE_TEXT_INPUT_PRO static void efi_zfs_probe(void); #endif -/* - * Need this because EFI uses UTF-16 unicode string constants, but we - * use UTF-8. We can't use printf due to the possibility of \0 and we - * don't support support wide characters either. - */ -static void -print_str16(const CHAR16 *str) -{ - int i; - - for (i = 0; str[i]; i++) - printf("%c", (char)str[i]); -} - static void cp16to8(const CHAR16 *src, char *dst, size_t len) { @@ -96,6 +82,8 @@ cp16to8(const CHAR16 *src, char *dst, si for (i = 0; i < len && src[i]; i++) dst[i] = (char)src[i]; + if (i < len) + dst[i] = '\0'; } static int @@ -330,10 +318,8 @@ main(int argc, CHAR16 *argv[]) BS->HandleProtocol(IH, &imgid, (VOID**)&img); printf("Command line arguments:"); - for (i = 0; i < argc; i++) { - printf(" "); - print_str16(argv[i]); - } + for (i = 0; i < argc; i++) + printf(" %S", argv[i]); printf("\n"); printf("Image base: 0x%lx\n", (u_long)img->ImageBase);