From nobody Sat Jan 07 17:38:43 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nq6rM4Y1zz2r7sp; Sat, 7 Jan 2023 17:38:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nq6rM3BcNz3M0l; Sat, 7 Jan 2023 17:38:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673113123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YoxfGiZjJX572QkYChfVQGAMe3iD5wCTX/MoFUmThvE=; b=XjLfL6F37bnLr8ZWFvNEBcTAN2UZLGtWQx/AIImBO9Q9LwPOFSQjBMZCgAppLFzMq5PESE HcxIg3jKY8CIJcvvaagxk3bXbQiGYeytuy8Id69md66yWNQC1vvmNSH6aqvr5y8eZE6zOE J0r3VyfflmZCgQERRZJ7cm7Be9ZKHVlEXgIM+UTFzbROO7ByWqNqS0O+swXpTz2VXlAsYP W2lVIiWzeoI8qO+Gw3wu88tRS4JC0YKyFFtWCbuoIp82CblwDVxEon8hCaf8glzyFlDTE0 V/cA2cY7WdODyO+wIcux6z2jw9tK1c+v+MvekAzEQHIMuz3tE2cQphEOhf8mtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673113123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YoxfGiZjJX572QkYChfVQGAMe3iD5wCTX/MoFUmThvE=; b=n5clusXzIh9QOg8comkiFwhTu3SjCazX7+LdhL1XEt+aRyQ5s+E8xgKI1yB38vBXIOhtHi GMYCMItEHwcLB1vPJtm8bK0gyqIOqbwz17cBzO5Q8t3GBSRfaMaI+1+FDSILsMP8faytZ0 71GGTMbVjK9lEy60pDhK4b4e0T4g1CVP+Mn71nw26XiGaHq6btsZfHa+oE6JuAV5Sv+bX0 zuPfFOtUsb01pZkebb/jyyE6GvPDkEgir2FxLUs8NR9ALLKoX4wEJqZcSg1y1ZPZEvb6Un OgYf1rKmsspiMx+LRuzkVWgA1ZLRHeZH7oxVIqzUcrhblJJ7UjJZwfzPypdMFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673113123; a=rsa-sha256; cv=none; b=pSnydV5duLgyRqlngxt1df1hwsl0UxRuGF8IuVPo2OHsTdJ2Q27shNVv+856mmFYDe/j8z N08RxZdLSVTcBvTnXf41KNmDE4Ttj9YTQ8knyd7GC4PLxxSkptegd3wKkqO3SLp+SwWGq9 RA0ZqHSt5W+QuBv8Hak07TJDlFoYTdWW0E2fnde3ov/aAE5s7LOZd37ZiLHrTmxiZrxcJt PZ2ns3KQ43sZeDoN3Z8j1QvRsnYhjaDjOsQCbdk1UdAe70dwSnzItAjbcI5454vX6YiRfN rufuPg5IDCH2fE8ClWM61943tptf71eQmGwZPfEX2KxATAJ/8ihvTZFRXUQx4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nq6rM2DxqzJMw; Sat, 7 Jan 2023 17:38:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 307HchHA026709; Sat, 7 Jan 2023 17:38:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 307HchQD026708; Sat, 7 Jan 2023 17:38:43 GMT (envelope-from git) Date: Sat, 7 Jan 2023 17:38:43 GMT Message-Id: <202301071738.307HchQD026708@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Hiroki Sato Subject: git: fa63f46a757e - main - japanese/FreeWnn-lib: fix build with clang 15 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hrs X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa63f46a757eb3c9832ba951800dcac7e3552c09 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hrs: URL: https://cgit.FreeBSD.org/ports/commit/?id=fa63f46a757eb3c9832ba951800dcac7e3552c09 commit fa63f46a757eb3c9832ba951800dcac7e3552c09 Author: Dimitry Andric AuthorDate: 2023-01-07 17:15:22 +0000 Commit: Hiroki Sato CommitDate: 2023-01-07 17:35:40 +0000 japanese/FreeWnn-lib: fix build with clang 15 During an exp-run for llvm 15 (see bug 265425), it turned out that japanese/FreeWnn-lib failed to build with clang 15: js.c:1029:28: error: incompatible pointer to integer conversion returning 'void *' from a function with result type 'int' [-Wint-conversion] handler_of_jserver_dead (NULL); ^~~~ /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL' #define NULL ((void *)0) ^~~~~~~~~~~ js.c:150:24: note: expanded from macro 'handler_of_jserver_dead' return err_val; \ ^~~~~~~ This is because the js_disconnect() function should return an integer, not a pointer. Use the error value -1 instead. PR: 268816 --- japanese/FreeWnn-lib/files/patch-Wnn-jlib-js.c | 279 ++++++++++++------------- 1 file changed, 135 insertions(+), 144 deletions(-) diff --git a/japanese/FreeWnn-lib/files/patch-Wnn-jlib-js.c b/japanese/FreeWnn-lib/files/patch-Wnn-jlib-js.c index d6bf4c787f04..88fc2e9f6f1b 100644 --- a/japanese/FreeWnn-lib/files/patch-Wnn-jlib-js.c +++ b/japanese/FreeWnn-lib/files/patch-Wnn-jlib-js.c @@ -1,12 +1,6 @@ -Index: Wnn/jlib/js.c -=================================================================== -RCS file: /home/cvs/private/hrs/freewnn/Wnn/jlib/js.c,v -retrieving revision 1.1.1.1 -retrieving revision 1.3 -diff -u -p -r1.1.1.1 -r1.3 ---- Wnn/jlib/js.c 20 Dec 2008 07:13:30 -0000 1.1.1.1 -+++ Wnn/jlib/js.c 2 Jan 2010 11:51:21 -0000 1.3 -@@ -110,8 +110,7 @@ static WNN_JSERVER_ID *current_js = NULL +--- Wnn/jlib/js.c.orig 2005-04-10 15:26:37 UTC ++++ Wnn/jlib/js.c +@@ -110,8 +110,7 @@ static WNN_JSERVER_ID *current_js = NULL; /* Packet Buffers */ static unsigned char snd_buf[S_BUF_SIZ]; /** 送信 **/ @@ -16,7 +10,7 @@ diff -u -p -r1.1.1.1 -r1.3 #if defined(EAGAIN) # if defined(EWOULDBLOCK) -@@ -130,11 +129,10 @@ static int rbc = -1; +@@ -130,11 +129,10 @@ static int rbc = -1; /** 受信バッフ static void connect_timeout (); static int _get_server_name (); static int writen (); @@ -42,7 +36,14 @@ diff -u -p -r1.1.1.1 -r1.3 - struct sockaddr_un saddr; /** ソケット **/ - char *sock_name = NULL; - saddr.sun_family = AF_UNIX; -- ++#if !defined(AF_UNIX) ++ return -1; ++#else ++ int sd; ++ struct sockaddr_un saddr; ++ char *sock_name = NULL; ++ saddr.sun_family = AF_UNIX; + - /* find socket name from table by lang */ - if (lang && *lang) - { @@ -56,14 +57,6 @@ diff -u -p -r1.1.1.1 -r1.3 - sock_name = sockname; /* Jserver */ - } - strcpy (saddr.sun_path, sock_name); -+#if !defined(AF_UNIX) -+ return -1; -+#else -+ int sd; -+ struct sockaddr_un saddr; -+ char *sock_name = NULL; -+ saddr.sun_family = AF_UNIX; -+ + /* find socket name from table by lang */ + if (lang && *lang) { + if ((sock_name = get_unixdomain_of_serv_defs(lang)) == NULL) @@ -95,13 +88,6 @@ diff -u -p -r1.1.1.1 -r1.3 + if (connect(sd, (struct sockaddr *)&saddr, SUN_LEN(&saddr)) == ERROR) { #if DEBUG - xerror ("jslib:Can't connect unix domain socket.\n"); --#endif -- close (sd); -- return -1; -- } -- return sd; --#else -- return -1; + xerror ("jslib:Can't connect unix domain socket.\n"); +#endif /* DEBUG */ + close (sd); @@ -110,6 +96,13 @@ diff -u -p -r1.1.1.1 -r1.3 + + return sd; #endif +- close (sd); +- return -1; +- } +- return sd; +-#else +- return -1; +-#endif } static int @@ -117,7 +110,10 @@ diff -u -p -r1.1.1.1 -r1.3 - register char *server; - register char *lang; - register int timeout; --{ ++cd_open_in(const char *server, ++ const char *lang, ++ const int timeout) + { - int sd; -#ifdef INET6 - struct addrinfo hints, *res, *res0; @@ -133,26 +129,12 @@ diff -u -p -r1.1.1.1 -r1.3 - char pserver[64]; - char sserver[64]; - char *serv_name = NULL; -- -- serverNO = _get_server_name (server, pserver); -+cd_open_in(const char *server, -+ const char *lang, -+ const int timeout) -+{ + int sd; -+ + +- serverNO = _get_server_name (server, pserver); + struct addrinfo hints, *res, *res0; + struct sockaddr sa; + char sbuf[NI_MAXSERV]; -+ -+ int error; -+ -+ struct servent *sp = NULL; -+ int serverNO, port_num; -+ int ret; -+ char pserver[NI_MAXHOST]; -+ char sserver[NI_MAXHOST]; -+ char *serv_name = NULL; - /* find service name from table by lang */ - if (lang && *lang) @@ -199,6 +181,15 @@ diff -u -p -r1.1.1.1 -r1.3 - error = getaddrinfo(pserver, sport, &hints, &res0); - if (error) - { ++ int error; ++ ++ struct servent *sp = NULL; ++ int serverNO, port_num; ++ int ret; ++ char pserver[NI_MAXHOST]; ++ char sserver[NI_MAXHOST]; ++ char *serv_name = NULL; ++ #if DEBUG - xerror (gai_strerror(error)); + fprintf(stderr, "cd_open_in: Enter: server=%s, lang=%s\n", @@ -255,17 +246,16 @@ diff -u -p -r1.1.1.1 -r1.3 +#if DEBUG + fprintf(stderr, "cd_open_in: fixed serverNO=%d\n", serverNO); #endif -- ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ sprintf(sbuf, "%d", serverNO); + - if (timeout != 0 && timeout > 0) - { - signal (SIGALRM, connect_timeout); - alarm (timeout); - } -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_family = PF_UNSPEC; -+ hints.ai_socktype = SOCK_STREAM; -+ sprintf(sbuf, "%d", serverNO); -+ + error = getaddrinfo(pserver, sbuf, &hints, &res0); + if (error) { + xerror(gai_strerror(error)); @@ -304,7 +294,6 @@ diff -u -p -r1.1.1.1 -r1.3 - xerror ("jslib:Can't connect inet6 socket.\n"); -#else - xerror ("jslib:Can't connect inet socket.\n"); --#endif + case AF_INET6: + xerror ("jslib:Can't create inet6 socket.\n"); #endif @@ -334,7 +323,7 @@ diff -u -p -r1.1.1.1 -r1.3 + case AF_INET6: + fprintf(stderr, "jslib:Can't connect inet6 socket. (sd=%d)\n", sd); + break; -+#endif + #endif + default: + xerror("jslib:Cannot connect. Unknown socket type.\n"); + break; @@ -358,14 +347,14 @@ diff -u -p -r1.1.1.1 -r1.3 - xerror ("jslib:Can't create inet socket.\n"); - else if (res->ai_family == AF_INET6) - xerror ("jslib:Can't create inet6 socket.\n"); --#endif ++ fprintf(stderr, "connect: sd=%d\n", sd); + #endif - } - } - } - freeaddrinfo(res0); - if (sd == ERROR) { -+ fprintf(stderr, "connect: sd=%d\n", sd); - #endif +-#endif - return -1; - } - return sd; @@ -561,7 +550,8 @@ diff -u -p -r1.1.1.1 -r1.3 +#if DEBUG_IO + fprintf(stderr, + "writen: failed. errno=%d\n", errno); -+#endif + #endif +- return (0); + daemon_dead(); + return -1; + } @@ -571,8 +561,7 @@ diff -u -p -r1.1.1.1 -r1.3 + sbp = snd_buf; +#if DEBUG_IO + fprintf (stderr, "jslib:writen=%d\n", total); - #endif -- return (0); ++#endif + return 0; } @@ -683,7 +672,6 @@ diff -u -p -r1.1.1.1 -r1.3 - while (*p) - put1com (*p++); - put1com (0); --} + if (p == NULL) { + put1com(0x00); + return; @@ -694,13 +682,13 @@ diff -u -p -r1.1.1.1 -r1.3 + while (*p) + put1com(*p++); + put1com(0); -+} -+ + } + +-/** サーバから1バイト受ける **/ +static unsigned char rcv_buf[R_BUF_SIZ]; +static unsigned char *rbp = rcv_buf; +static unsigned char *rp = rcv_buf; - --/** サーバから1バイト受ける **/ ++ static int -get1com () +rcv_flush() @@ -712,11 +700,35 @@ diff -u -p -r1.1.1.1 -r1.3 - while (1) - { - errno = 0; --#ifdef HAVE_RECV ++#if DEBUG_IO ++ fprintf(stderr, "rcv_flush\n"); ++#endif ++ rbp = rp = &rcv_buf[0]; ++ return 0; ++} ++ ++static unsigned int ++get1com() ++{ ++ int n; ++ ++#if DEBUG_IO ++ fprintf(stderr, "get1com: Enter\n"); ++#endif ++ if (rp == rbp) { ++ /* rp == rbp case; no data in rcv_buf */ ++ ++ rbp = rp = rcv_buf; ++ ++ while (rbp == rp) { ++ errno = 0; + #ifdef HAVE_RECV - rbc = recv (current_sd, rcv_buf, R_BUF_SIZ, 0); --#else ++ n = recv(current_sd, rcv_buf, sizeof(rcv_buf), 0); + #else - rbc = read (current_sd, rcv_buf, R_BUF_SIZ); --#endif ++ n = read(current_sd, rcv_buf, sizeof(rcv_buf)); + #endif - if (rbc <= 0) - { - if (ERRNO_CHECK (errno)) @@ -743,56 +755,13 @@ diff -u -p -r1.1.1.1 -r1.3 - fprintf (stderr, "jslib:read:rbc=%d\n", rbc); -/* dmp(rcv_buf,rbc); */ +#if DEBUG_IO -+ fprintf(stderr, "rcv_flush\n"); ++ fprintf(stderr, "recvloop: n=%d\n", n); #endif - break; - } - } - rbc--; - return rcv_buf[rbp++] & 0xFF; -+ rbp = rp = &rcv_buf[0]; -+ return 0; - } - --/** サーバから2バイト受ける **/ --static int --get2com () -+static unsigned int -+get1com() - { -- register int h; -- h = get1com (); -- return (h << 8) | get1com (); --} -+ int n; - --/** サーバから4バイト受ける **/ --static int --get4com () --{ -- register int h1, h2, h3; -- h1 = get1com () << 24; -- h2 = get1com () << 16; -- h3 = get1com () << 8; -- return h1 | h2 | h3 | get1com (); -+#if DEBUG_IO -+ fprintf(stderr, "get1com: Enter\n"); -+#endif -+ if (rp == rbp) { -+ /* rp == rbp case; no data in rcv_buf */ -+ -+ rbp = rp = rcv_buf; -+ -+ while (rbp == rp) { -+ errno = 0; -+#ifdef HAVE_RECV -+ n = recv(current_sd, rcv_buf, sizeof(rcv_buf), 0); -+#else -+ n = read(current_sd, rcv_buf, sizeof(rcv_buf)); -+#endif -+#if DEBUG_IO -+ fprintf(stderr, "recvloop: n=%d\n", n); -+#endif + if (n == 0) { + if (ERRNO_CHECK(errno)) { + continue; @@ -829,12 +798,18 @@ diff -u -p -r1.1.1.1 -r1.3 + } +#endif + return (*(rbp++) & 0xff); -+} -+ + } + +-/** サーバから2バイト受ける **/ +-static int +-get2com () +/* get two bytes */ +static unsigned int +get2com() -+{ + { +- register int h; +- h = get1com (); +- return (h << 8) | get1com (); + unsigned int h; +#if DEBUG_IO + fprintf(stderr, "get2com: Enter\n"); @@ -846,12 +821,20 @@ diff -u -p -r1.1.1.1 -r1.3 + fprintf(stderr, "get2com: [%04x]\n", h); +#endif + return h; -+} -+ + } + +-/** サーバから4バイト受ける **/ +-static int +-get4com () +/* get four bytes */ +static unsigned int +get4com() -+{ + { +- register int h1, h2, h3; +- h1 = get1com () << 24; +- h2 = get1com () << 16; +- h3 = get1com () << 8; +- return h1 | h2 | h3 | get1com (); + unsigned int h; +#if DEBUG_IO + fprintf(stderr, "get4com: Enter\n"); @@ -921,42 +904,17 @@ diff -u -p -r1.1.1.1 -r1.3 -js_open_lang (server, lang, timeout) - register char *server, *lang; - register int timeout; --{ -- char *new_js; -- char host[WNN_HOSTLEN], user[WNN_ENVNAME_LEN]; -- int x; +js_open_lang (char *server, + char *lang, + int timeout) -+{ + { +- char *new_js; +- char host[WNN_HOSTLEN], user[WNN_ENVNAME_LEN]; +- int x; + char *new_js; + char host[WNN_HOSTLEN]; + char user[WNN_ENVNAME_LEN]; + int x; -+ -+ if (wnn_msg_cat == NULL) { -+ char nlspath[MAXPATHLEN]; -+ strcpy (nlspath, LIBDIR); -+ strcat (nlspath, "/%L/%N"); -+ wnn_msg_cat = msg_open ("libwnn.msg", nlspath, lang); -+ if (wnn_msg_cat == NULL) { -+ fprintf (stderr, -+ "libwnn: Cannot open message file for libwnn.a\n"); -+ } -+ } -+ -+ if (!(new_js = (char *) malloc (sizeof (WNN_JSERVER_ID)))) { -+ wnn_errorno = WNN_ALLOC_FAIL; -+ return NULL; -+ } -+ -+ current_js = (WNN_JSERVER_ID *) new_js; -+ if (server == NULL) { -+ current_js->js_name[0] = '\0'; -+ } else { -+ strncpy(current_js->js_name, server, sizeof (current_js->js_name) - 1); -+ current_js->js_name[sizeof (current_js->js_name) - 1] = '\0'; -+ } - if (wnn_msg_cat == NULL) - { @@ -987,6 +945,30 @@ diff -u -p -r1.1.1.1 -r1.3 - } - current_js->js_dead = 0; - current_js->js_dead_env_flg = 0; ++ if (wnn_msg_cat == NULL) { ++ char nlspath[MAXPATHLEN]; ++ strcpy (nlspath, LIBDIR); ++ strcat (nlspath, "/%L/%N"); ++ wnn_msg_cat = msg_open ("libwnn.msg", nlspath, lang); ++ if (wnn_msg_cat == NULL) { ++ fprintf (stderr, ++ "libwnn: Cannot open message file for libwnn.a\n"); ++ } ++ } ++ ++ if (!(new_js = (char *) malloc (sizeof (WNN_JSERVER_ID)))) { ++ wnn_errorno = WNN_ALLOC_FAIL; ++ return NULL; ++ } ++ ++ current_js = (WNN_JSERVER_ID *) new_js; ++ if (server == NULL) { ++ current_js->js_name[0] = '\0'; ++ } else { ++ strncpy(current_js->js_name, server, sizeof (current_js->js_name) - 1); ++ current_js->js_name[sizeof (current_js->js_name) - 1] = '\0'; ++ } ++ + current_js->js_dead = 0; + current_js->js_dead_env_flg = 0; /* @@ -1096,6 +1078,15 @@ diff -u -p -r1.1.1.1 -r1.3 } +@@ -979,7 +1026,7 @@ js_disconnect (env) + free((char *)env); + */ + set_current_js (env->js_id); +- handler_of_jserver_dead (NULL); ++ handler_of_jserver_dead (-1); + snd_env_head (&tmp_env, JS_DISCONNECT); + snd_flush (); + x = get4com (); @@ -2988,29 +3035,25 @@ get_serv_defs (lang, cnt) }